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 > ¶meter=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 > ¶meter=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_COMMAND > | s_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... | |
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.
typedef enum sick_scan::ColaParser::COLA_SOPAS_COMMAND_ENUM sick_scan::ColaParser::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)
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)
Definition at line 92 of file cola_parser.h.
|
inlinestatic |
Returns the "end of text" tag in a Cola ASCII command, i.e. "<ETX>".
Definition at line 164 of file cola_parser.h.
|
inlinestatic |
Returns the "start of text" tag in a Cola ASCII command, i.e. "<STX>".
Definition at line 158 of file cola_parser.h.
|
inlinestatic |
Returns the binary "end of text" tag in a Cola-Binary command, i.e. {0x03}.
Definition at line 176 of file cola_parser.h.
|
inlinestatic |
Returns the binary "start of text" tag in a Cola-Binary command, i.e. {0x02}.
Definition at line 170 of file cola_parser.h.
|
static |
Converts and returns the parameter of a cola ascii telegram into a numeric value.
[in] | cola_arg | parameter of a cola ascii telegram |
[in] | base | numeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex) |
[in] | default_value | default value returned in case of parse errors |
Definition at line 245 of file cola_parser.cpp.
|
static |
Converts and returns the parameter of a cola ascii telegram into an unsigned numeric value.
[in] | cola_arg | parameter of a cola ascii telegram |
[in] | base | numeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex) |
[in] | default_value | default value returned in case of parse errors |
Converts and returns the parameter of a cola ascii telegram into a numeric value.
[in] | cola_arg | parameter of a cola ascii telegram |
[in] | base | numeric base (10 for decimal values, 16 for hex strings or -1 for autodetection with base 10 in case of +/-sign, otherwise hex) |
[in] | default_value | default value returned in case of parse errors |
Definition at line 267 of file cola_parser.cpp.
|
static |
Converts and returns the parameter of a cola ascii response into a boolean value.
[in] | cola_response_arg | parameter of a cola ascii response |
[in] | default_value | default value returned in case of parse errors |
Definition at line 288 of file cola_parser.cpp.
|
static |
Converts and returns a COLA_SOPAS_COMMAND to string. Example: convertSopasCommand(sMN) returns "sMN".
[in] | command_type | One of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN) |
Definition at line 220 of file cola_parser.cpp.
|
static |
Converts and returns a COLA_SOPAS_COMMAND from string. Example: convertSopasCommand("sMN") returns sMN.
[in] | sopas_command | One of the SOPAS commands ("sRN", "sRA", "sMN", "sMA", or "sWN") |
Definition at line 231 of file cola_parser.cpp.
|
static |
Creates and returns a Cola telegram (type SickLocColaTelegramMsg).
Create and returns a Cola telegram (type SickLocColaTelegramMsg).
[in] | command_type | One of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN) |
[in] | command_name | Name of command like "SetAccessMode", "LocSetResultPoseEnabled", "LocRequestTimestamp", etc. |
[in] | parameter | Optional list of command parameter |
Definition at line 100 of file cola_parser.cpp.
|
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.
[in] | cola_binary | 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 119 of file cola_parser.cpp.
|
static |
Converts and returns a Cola message of type SickLocColaTelegramMsg from a Cola-ASCII telegram.
[in] | cola_ascii | Cola-ASCII telegram, f.e. "<STX>sMN LocRequestTimestamp<ETX>" |
Definition at line 130 of file cola_parser.cpp.
|
static |
Encodes and returns a Cola Binary telegram from ros message SickLocColaTelegramMsg.
[in] | cola_telegram | Cola telegram, f.e. createColaTelegram(sMN, "SetAccessMode", {"3", "F4724744"}) |
Definition at line 182 of file cola_parser.cpp.
|
static |
Encodes and returns a Cola telegram.
[in] | command_type | One of the SOPAS Commands enumerated in COLA_SOPAS_COMMAND (sRN, sRA, sMN, sMA, or sWN) |
[in] | command_name | Name of command like "SetAccessMode", "LocSetResultPoseEnabled", "LocRequestTimestamp", etc. |
[in] | parameter | Optional list of command parameter |
Definition at line 208 of file cola_parser.cpp.
|
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.
|
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.
|
staticprotected |
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.
|
staticprotected |
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.