Public Types | Static Public Member Functions | Static Protected Attributes | List of all members
sick_scan::ColaParser Class Reference

class ColaParser parses and converts binary Cola telegrams to ros messages SickLocColaTelegramMsg and vice versa. More...

#include <cola_parser.h>

Public Types

typedef enum sick_scan::ColaParser::COLA_SOPAS_COMMAND_ENUM COLA_SOPAS_COMMAND
 Enumeration of SOPAS commands in cola telegrams: The command_type in SickLocColaTelegramMsg is one of the following SOPAS Commands: sINVALID (0, uninitialized, command_type should never have this value) sRN (1, Read by name request), or sRA (2, Read by name response), or sMN (3, Method by name request), or sMA (4, Method by name response), or sWN (5, Write by name request) More...
 
enum  COLA_SOPAS_COMMAND_ENUM {
  sINVALID = 0, sRN = 1, sRA = 2, sMN = 3,
  sAN = 4, sMA = 5, sWN = 6, sWA = 7,
  sEN = 8, sEA = 9, sSN = 10, sFA = 11,
  MAX_COLA_COMMAND_NUMBER
}
 Enumeration of SOPAS commands in cola telegrams: The command_type in SickLocColaTelegramMsg is one of the following SOPAS Commands: sINVALID (0, uninitialized, command_type should never have this value) sRN (1, Read by name request), or sRA (2, Read by name response), or sMN (3, Method by name request), or sMA (4, Method by name response), or sWN (5, Write by name request) More...
 

Static Public Member Functions

static const std::string & asciiETX (void)
 Returns the "end of text" tag in a Cola ASCII command, i.e. "<ETX>". More...
 
static const std::string & asciiSTX (void)
 Returns the "start of text" tag in a Cola ASCII command, i.e. "<STX>". More...
 
static std::vector< uint8_t > binaryETX (void)
 Returns the binary "end of text" tag in a Cola-Binary command, i.e. {0x03}. More...
 
static std::vector< uint8_t > binarySTX (void)
 Returns the binary "start of text" tag in a Cola-Binary command, i.e. {0x02}. More...
 
static int32_t convertColaArg (const std::string &cola_arg, int base=10, int32_t default_value=0)
 
static uint32_t convertColaArg (const std::string &cola_arg, int base=10, uint32_t default_value=0)
 
static bool convertColaResponseBool (const std::string &cola_response_arg, bool default_value)
 
static std::string convertSopasCommand (COLA_SOPAS_COMMAND command_type)
 Converts and returns a COLA_SOPAS_COMMAND to string. Example: convertSopasCommand(sMN) returns "sMN". More...
 
static COLA_SOPAS_COMMAND convertSopasCommand (const std::string &sopas_command)
 Converts and returns a COLA_SOPAS_COMMAND from string. Example: convertSopasCommand("sMN") returns sMN. More...
 
static sick_scan::SickLocColaTelegramMsg createColaTelegram (const COLA_SOPAS_COMMAND &command_type, const std::string &command_name, const std::vector< std::string > &parameter=std::vector< std::string >())
 Creates and returns a Cola telegram (type SickLocColaTelegramMsg). More...
 
static sick_scan::SickLocColaTelegramMsg decodeColaTelegram (const std::vector< uint8_t > &cola_binary)
 Decodes and returns a Cola message of type SickLocColaTelegramMsg from a Cola-Binary telegram. Note: If decoding fails (invalid binary telegram or parse error), command_type of the returned Cola telegram message will be sINVALID. More...
 
static sick_scan::SickLocColaTelegramMsg decodeColaTelegram (const std::string &cola_ascii)
 Converts and returns a Cola message of type SickLocColaTelegramMsg from a Cola-ASCII telegram. More...
 
static std::vector< uint8_t > encodeColaTelegram (const sick_scan::SickLocColaTelegramMsg &cola_telegram, bool parameter_is_ascii=true)
 Encodes and returns a Cola Binary telegram from ros message SickLocColaTelegramMsg. More...
 
static std::vector< uint8_t > encodeColaTelegram (const COLA_SOPAS_COMMAND &command_type, const std::string &command_name, const std::vector< std::string > &parameter=std::vector< std::string >(), bool parameter_is_ascii=true)
 Encodes and returns a Cola telegram. More...
 

Static Protected Attributes

static const std::string s_cola_ascii_end_tag = "<ETX>"
 All Cola-ACSII telegrams start with s_cola_ascii_start_tag := "<ETX>" ("End of TeXt") More...
 
static const std::string s_cola_ascii_start_tag = "<STX>"
 All Cola-ACSII telegrams start with s_cola_ascii_start_tag := "<STX>" ("Start of TeXt") More...
 
static const std::map< std::string, COLA_SOPAS_COMMANDs_command_type_map
 static map to convert COLA_SOPAS_COMMANDs from string to enum, f.e. s_command_type_map["sRN"]:=sRN, s_command_type_map["sRA"]:=sRA and so on More...
 
static const std::string s_command_type_string [MAX_COLA_COMMAND_NUMBER]
 static table to convert COLA_SOPAS_COMMAND to string, f.e. s_command_type_string[sRN]:="sRN", s_command_type_string[sRA]:="sRA" and so on More...
 

Detailed Description

class ColaParser parses and converts binary Cola telegrams to ros messages SickLocColaTelegramMsg and vice versa.

See Operation-Instruction-v1.1.0.241R.pdf, chapter 5.8 "About CoLa-A telegrams", page 46-48, Telegram-Listing-v1.1.0.241R.pdf, chapter 2.3.9 "Command: LocRequestTimestamp", page 21, and Technical_information_Telegram_Listing_NAV_LOC_en_IM0076556.PDF for further details about Cola telegrams.

Definition at line 78 of file cola_parser.h.

Member Typedef Documentation

◆ COLA_SOPAS_COMMAND

Enumeration of SOPAS commands in cola telegrams: The command_type in SickLocColaTelegramMsg is one of the following SOPAS Commands: sINVALID (0, uninitialized, command_type should never have this value) sRN (1, Read by name request), or sRA (2, Read by name response), or sMN (3, Method by name request), or sMA (4, Method by name response), or sWN (5, Write by name request)

Member Enumeration Documentation

◆ COLA_SOPAS_COMMAND_ENUM

Enumeration of SOPAS commands in cola telegrams: The command_type in SickLocColaTelegramMsg is one of the following SOPAS Commands: sINVALID (0, uninitialized, command_type should never have this value) sRN (1, Read by name request), or sRA (2, Read by name response), or sMN (3, Method by name request), or sMA (4, Method by name response), or sWN (5, Write by name request)

Enumerator
sINVALID 

uninitialized, command_type should never have this value)

sRN 

Read by name (request)

sRA 

Read by name (response)

sMN 

Method by name (request)

sAN 

Response to sMN.

sMA 

Method by name (response)

sWN 

Write by name (request)

sWA 

Write answer (response)

sEN 

Event by name (request)

sEA 

Event answer (response)

sSN 

Answer (response)

sFA 

Error Answer with error code (response)

MAX_COLA_COMMAND_NUMBER 

Number of possible COLA_SOPAS_COMMANDs incl. invalid command.

Definition at line 92 of file cola_parser.h.

Member Function Documentation

◆ asciiETX()

static const std::string& sick_scan::ColaParser::asciiETX ( void  )
inlinestatic

Returns the "end of text" tag in a Cola ASCII command, i.e. "<ETX>".

Returns
"<ETX>"

Definition at line 164 of file cola_parser.h.

◆ asciiSTX()

static const std::string& sick_scan::ColaParser::asciiSTX ( void  )
inlinestatic

Returns the "start of text" tag in a Cola ASCII command, i.e. "<STX>".

Returns
"<STX>"

Definition at line 158 of file cola_parser.h.

◆ binaryETX()

static std::vector<uint8_t> sick_scan::ColaParser::binaryETX ( void  )
inlinestatic

Returns the binary "end of text" tag in a Cola-Binary command, i.e. {0x03}.

Returns
{0x03}

Definition at line 176 of file cola_parser.h.

◆ binarySTX()

static std::vector<uint8_t> sick_scan::ColaParser::binarySTX ( void  )
inlinestatic

Returns the binary "start of text" tag in a Cola-Binary command, i.e. {0x02}.

Returns
{0x02}

Definition at line 170 of file cola_parser.h.

◆ convertColaArg() [1/2]

int32_t sick_scan::ColaParser::convertColaArg ( const std::string &  cola_arg,
int  base = 10,
int32_t  default_value = 0 
)
static

Converts and returns the parameter of a cola ascii telegram into a numeric value.

Parameters
[in]cola_argparameter of a cola ascii telegram
[in]basenumeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex)
[in]default_valuedefault value returned in case of parse errors
Returns
parameter converted to integer value

Definition at line 245 of file cola_parser.cpp.

◆ convertColaArg() [2/2]

uint32_t sick_scan::ColaParser::convertColaArg ( const std::string &  cola_arg,
int  base = 10,
uint32_t  default_value = 0 
)
static

Converts and returns the parameter of a cola ascii telegram into an unsigned numeric value.

Parameters
[in]cola_argparameter of a cola ascii telegram
[in]basenumeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex)
[in]default_valuedefault value returned in case of parse errors
Returns
parameter converted to integer value

Converts and returns the parameter of a cola ascii telegram into a numeric value.

Parameters
[in]cola_argparameter of a cola ascii telegram
[in]basenumeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex)
[in]default_valuedefault value returned in case of parse errors
Returns
parameter converted to integer value

Definition at line 267 of file cola_parser.cpp.

◆ convertColaResponseBool()

bool sick_scan::ColaParser::convertColaResponseBool ( const std::string &  cola_response_arg,
bool  default_value 
)
static

Converts and returns the parameter of a cola ascii response into a boolean value.

Parameters
[in]cola_response_argparameter of a cola ascii response
[in]default_valuedefault value returned in case of parse errors
Returns
parameter converted to boolean value

Definition at line 288 of file cola_parser.cpp.

◆ convertSopasCommand() [1/2]

std::string sick_scan::ColaParser::convertSopasCommand ( COLA_SOPAS_COMMAND  command_type)
static

Converts and returns a COLA_SOPAS_COMMAND to string. Example: convertSopasCommand(sMN) returns "sMN".

Parameters
[in]command_typeOne of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN)
Returns
COLA_SOPAS_COMMAND as string.

Definition at line 220 of file cola_parser.cpp.

◆ convertSopasCommand() [2/2]

sick_scan::ColaParser::COLA_SOPAS_COMMAND sick_scan::ColaParser::convertSopasCommand ( const std::string &  sopas_command)
static

Converts and returns a COLA_SOPAS_COMMAND from string. Example: convertSopasCommand("sMN") returns sMN.

Parameters
[in]sopas_commandOne of the SOPAS commands ("sRN", "sRA", "sMN", "sMA", or "sWN")
Returns
COLA_SOPAS_COMMAND from string.

Definition at line 231 of file cola_parser.cpp.

◆ createColaTelegram()

sick_scan::SickLocColaTelegramMsg sick_scan::ColaParser::createColaTelegram ( const COLA_SOPAS_COMMAND command_type,
const std::string &  command_name,
const std::vector< std::string > &  parameter = std::vector<std::string>() 
)
static

Creates and returns a Cola telegram (type SickLocColaTelegramMsg).

Create and returns a Cola telegram (type SickLocColaTelegramMsg).

Parameters
[in]command_typeOne of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN)
[in]command_nameName of command like "SetAccessMode", "LocSetResultPoseEnabled", "LocRequestTimestamp", etc.
[in]parameterOptional list of command parameter
Returns
Cola telegram of type SickLocColaTelegramMsg

Definition at line 100 of file cola_parser.cpp.

◆ decodeColaTelegram() [1/2]

sick_scan::SickLocColaTelegramMsg sick_scan::ColaParser::decodeColaTelegram ( const std::vector< uint8_t > &  cola_binary)
static

Decodes and returns a Cola message of type SickLocColaTelegramMsg from a Cola-Binary telegram. Note: If decoding fails (invalid binary telegram or parse error), command_type of the returned Cola telegram message will be sINVALID.

Parameters
[in]cola_binaryCola-Binary telegram, f.e. { 0x02, 0x73, 0x4D, 0x4E, 0x20, 0x53, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4D, 0x6F, 0x64, 0x65, 0x20, 0x33, 0x20, 0x46, 0x34, 0x37, 0x32, 0x34, 0x37, 0x34, 0x34, 0x03 }
Returns
Cola telegram message (type SickLocColaTelegramMsg)

Definition at line 119 of file cola_parser.cpp.

◆ decodeColaTelegram() [2/2]

sick_scan::SickLocColaTelegramMsg sick_scan::ColaParser::decodeColaTelegram ( const std::string &  cola_ascii)
static

Converts and returns a Cola message of type SickLocColaTelegramMsg from a Cola-ASCII telegram.

Parameters
[in]cola_asciiCola-ASCII telegram, f.e. "<STX>sMN LocRequestTimestamp<ETX>"
Returns
Cola telegram message (type SickLocColaTelegramMsg)

Definition at line 130 of file cola_parser.cpp.

◆ encodeColaTelegram() [1/2]

std::vector< uint8_t > sick_scan::ColaParser::encodeColaTelegram ( const sick_scan::SickLocColaTelegramMsg &  cola_telegram,
bool  parameter_is_ascii = true 
)
static

Encodes and returns a Cola Binary telegram from ros message SickLocColaTelegramMsg.

Parameters
[in]cola_telegramCola telegram, f.e. createColaTelegram(sMN, "SetAccessMode", {"3", "F4724744"})
Returns
Cola-Binary telegram, f.e. { 0x02, 0x73, 0x4D, 0x4E, 0x20, 0x53, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4D, 0x6F, 0x64, 0x65, 0x20, 0x33, 0x20, 0x46, 0x34, 0x37, 0x32, 0x34, 0x37, 0x34, 0x34, 0x03 }

Definition at line 182 of file cola_parser.cpp.

◆ encodeColaTelegram() [2/2]

std::vector< uint8_t > sick_scan::ColaParser::encodeColaTelegram ( const COLA_SOPAS_COMMAND command_type,
const std::string &  command_name,
const std::vector< std::string > &  parameter = std::vector<std::string>(),
bool  parameter_is_ascii = true 
)
static

Encodes and returns a Cola telegram.

Parameters
[in]command_typeOne of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN)
[in]command_nameName of command like "SetAccessMode", "LocSetResultPoseEnabled", "LocRequestTimestamp", etc.
[in]parameterOptional list of command parameter
Returns
Cola-Binary telegram

Definition at line 208 of file cola_parser.cpp.

Member Data Documentation

◆ s_cola_ascii_end_tag

const std::string sick_scan::ColaParser::s_cola_ascii_end_tag = "<ETX>"
staticprotected

All Cola-ACSII telegrams start with s_cola_ascii_start_tag := "<ETX>" ("End of TeXt")

Definition at line 225 of file cola_parser.h.

◆ s_cola_ascii_start_tag

const std::string sick_scan::ColaParser::s_cola_ascii_start_tag = "<STX>"
staticprotected

All Cola-ACSII telegrams start with s_cola_ascii_start_tag := "<STX>" ("Start of TeXt")

Definition at line 224 of file cola_parser.h.

◆ s_command_type_map

const std::map< std::string, sick_scan::ColaParser::COLA_SOPAS_COMMAND > sick_scan::ColaParser::s_command_type_map
staticprotected
Initial value:
=
{
{"", sINVALID}, {"sINVALID", sINVALID}, {"sRN", sRN}, {"sRA", sRA}, {"sMN", sMN}, {"sAN", sAN}, {"sMA", sMA}, {"sWN", sWN}, {"sWA", sWA}, {"sEN", sEN}, {"sEA", sEA}, {"sSN", sSN}, {"sFA", sFA}
}

static map to convert COLA_SOPAS_COMMANDs from string to enum, f.e. s_command_type_map["sRN"]:=sRN, s_command_type_map["sRA"]:=sRA and so on

Definition at line 223 of file cola_parser.h.

◆ s_command_type_string

const std::string sick_scan::ColaParser::s_command_type_string
staticprotected
Initial value:
=
{
"sINVALID", "sRN", "sRA", "sMN", "sAN", "sMA", "sWN", "sWA", "sEN", "sEA", "sSN", "sFA"
}

static table to convert COLA_SOPAS_COMMAND to string, f.e. s_command_type_string[sRN]:="sRN", s_command_type_string[sRA]:="sRA" and so on

Definition at line 222 of file cola_parser.h.


The documentation for this class was generated from the following files:


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Wed Sep 7 2022 02:25:06