Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
sick_scan_xd::SickScanCommon Class Referenceabstract

#include <sick_scan_common.h>

Inheritance diagram for sick_scan_xd::SickScanCommon:
Inheritance graph
[legend]

Classes

struct  ScanLayerFilterCfg
 

Public Types

enum  SOPAS_CMD {
  CMD_DEVICE_IDENT_LEGACY, CMD_DEVICE_IDENT, CMD_SERIAL_NUMBER, CMD_REBOOT,
  CMD_WRITE_EEPROM, CMD_FIRMWARE_VERSION, CMD_DEVICE_STATE, CMD_OPERATION_HOURS,
  CMD_POWER_ON_COUNT, CMD_LOCATION_NAME, CMD_ACTIVATE_STANDBY, CMD_SET_PARTICLE_FILTER,
  CMD_SET_MEAN_FILTER, CMD_SCAN_LAYER_FILTER, CMD_APPLICATION_MODE, CMD_APPLICATION_MODE_FIELD_ON,
  CMD_APPLICATION_MODE_FIELD_OFF, CMD_APPLICATION_MODE_RANGING_ON, CMD_READ_ACTIVE_APPLICATIONS, CMD_SET_ACCESS_MODE_3,
  CMD_SET_ACCESS_MODE_3_SAFETY_SCANNER, CMD_SET_OUTPUT_RANGES, CMD_SET_OUTPUT_RANGES_NAV3, CMD_GET_OUTPUT_RANGES,
  CMD_RUN, CMD_SET_PARTIAL_SCAN_CFG, CMD_GET_PARTIAL_SCAN_CFG, CMD_GET_PARTIAL_SCANDATA_CFG,
  CMD_SET_PARTIAL_SCANDATA_CFG, CMD_STOP_SCANDATA, CMD_START_SCANDATA, CMD_START_RADARDATA,
  CMD_ACTIVATE_NTP_CLIENT, CMD_SET_NTP_INTERFACE_ETH, CMD_SET_ENCODER_MODE, CMD_SET_ENCODER_MODE_NO,
  CMD_SET_ENCODER_MODE_SI, CMD_SET_ENCODER_MODE_DP, CMD_SET_ENCODER_MODE_DL, CMD_SET_ENCODER_MODE_FI,
  CMD_SET_INCREMENTSOURCE_ENC, CMD_SET_3_4_TO_ENCODER, CMD_SET_ENOCDER_RES_1, CMD_SET_ENCODER_RES,
  CMD_START_IMU_DATA, CMD_STOP_IMU_DATA, CMD_SET_TRANSMIT_RAWTARGETS_ON, CMD_SET_TRANSMIT_RAWTARGETS_OFF,
  CMD_SET_TRANSMIT_OBJECTS_ON, CMD_SET_TRANSMIT_OBJECTS_OFF, CMD_SET_TRACKING_MODE_0, CMD_SET_TRACKING_MODE_1,
  CMD_LOAD_APPLICATION_DEFAULT, CMD_DEVICE_TYPE, CMD_ORDER_NUMBER, CMD_START_MEASUREMENT,
  CMD_STOP_MEASUREMENT, CMD_SET_ECHO_FILTER, CMD_SET_NTP_UPDATETIME, CMD_SET_NTP_TIMEZONE,
  CMD_SET_IP_ADDR, CMD_SET_GATEWAY, CMD_SET_NTP_SERVER_IP_ADDR, CMD_SET_SCANDATACONFIGNAV,
  CMD_GET_SCANDATACONFIGNAV, CMD_SEN_SCANDATACONFIGNAV, CMD_GET_ANGLE_COMPENSATION_PARAM, CMD_SET_TO_COLA_A_PROTOCOL,
  CMD_SET_TO_COLA_B_PROTOCOL, CMD_GET_SAFTY_FIELD_CFG, CMD_SET_LFEREC_ACTIVE, CMD_SET_LID_OUTPUTSTATE_ACTIVE,
  CMD_SET_LID_INPUTSTATE_ACTIVE, CMD_SET_SCAN_CFG_LIST, CMD_SET_NAV_OPERATIONAL_MODE_0, CMD_SET_NAV_OPERATIONAL_MODE_1,
  CMD_SET_NAV_OPERATIONAL_MODE_2, CMD_SET_NAV_OPERATIONAL_MODE_3, CMD_SET_NAV_OPERATIONAL_MODE_4, CMD_SET_NAV_CURR_LAYER,
  CMD_SET_NAV_LANDMARK_DATA_FORMAT, CMD_SET_NAV_SCAN_DATA_FORMAT, CMD_SET_NAV_POSE_DATA_FORMAT, CMD_SET_NAV_MAP_CFG,
  CMD_SET_NAV_REFL_SIZE, CMD_SET_NAV_DO_MAPPING, CMD_SET_NAV_ADD_LANDMARK, CMD_SET_NAV_ERASE_LAYOUT,
  CMD_SET_NAV_STORE_LAYOUT, CMD_SET_NAV_POSE, CMD_SET_LFPMEANFILTER, CMD_SET_LFPMEDIANFILTER,
  CMD_SET_LMDSCANDATASCALEFACTOR, CMD_SET_GLARE_DETECTION_SENS, CMD_SET_SCAN_LAYER_FILTER, CMD_END
}
 

Public Member Functions

int ActivateStandBy (void)
 
bool changeIPandreboot (const std::string &IpAdress)
 Send a SOPAS command to the scanner that logs in the authorized client, changes the ip address and the reboots the scanner. More...
 
void check_angle_range (SickScanConfig &conf)
 check angle setting in the config and adjust the min_ang to the max_ang if min_ang greater than max_ax More...
 
ExitCode checkColaTypeAndSwitchToConfigured (bool useBinaryCmd)
 
std::string cmdSetAccessMode3 (void)
 Returns "sMN SetAccessMode 3 F4724744" resp. "\x02sMN SetAccessMode 3 6FD62C05\x03\0" for safety scanner. More...
 
int convertAscii2BinaryCmd (const char *requestAscii, std::vector< unsigned char > *requestBinary)
 Convert ASCII-message to Binary-message. More...
 
virtual int convertSendSOPASCommand (const std::string &sopas_ascii_request, std::vector< unsigned char > *reply, bool wait_for_reply=true)
 Converts a given SOPAS command from ascii to binary (in case of binary communication), sends sopas (ascii or binary) and returns the response (if wait_for_reply:=true) More...
 
std::vector< std::string > generateExpectedAnswerString (const std::vector< unsigned char > &requestStr)
 Generate expected answer strings from the command string. More...
 
std::vector< std::string > generateUnexpectedAnswerString (const std::string &requestStr)
 
int get2ndSopasResponse (std::vector< uint8_t > &sopas_response, const std::string &sopas_keyword)
 
double get_expected_frequency () const
 
SickScanConfiggetConfigPtr ()
 
ScannerBasicParamgetCurrentParamPtr ()
 
uint64_t getNanosecTimestampLastTcpMessageReceived (void)
 
int getProtocolType (void)
 get protocol type as enum More...
 
int getReadTimeOutInMs ()
 get timeout in milliseconds More...
 
bool handleNAV350BinaryPositionData (const uint8_t *receiveBuffer, int receiveBufferLength, short &elevAngleX200, double &elevationAngleInRad, rosTime &recvTimeStamp, bool config_sw_pll_only_publish, double config_time_offset, SickGenericParser *parser_, int &numEchos, ros_sensor_msgs::LaserScan &msg, NAV350mNPOSData &navdata)
 
virtual int init (rosNodePtr nh)
 init routine of scanner More...
 
int init_cmdTables (rosNodePtr nh)
 init command tables and define startup sequence More...
 
int loopOnce (rosNodePtr nh)
 parsing datagram and publishing ros messages More...
 
void messageCbNavOdomVelocity (const sick_scan_msg::NAVOdomVelocity &msg)
 
int readActiveFieldSet (int &active_field_set, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
 
int readFieldSetSelectionMethod (int &field_set_selection_method, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
 
virtual bool rebootScanner ()
 Send a SOPAS command to the scanner that should cause a soft reset. More...
 
int sendNAV350mNPOSGetData (void)
 
int sendSopasAndCheckAnswer (std::string request, std::vector< unsigned char > *reply, int cmdId)
 send command and check answer More...
 
int sendSopasAndCheckAnswer (std::vector< unsigned char > request, std::vector< unsigned char > *reply, int cmdId)
 send command and check answer More...
 
int sendSopasAorBgetAnswer (const std::string &request, std::vector< unsigned char > *reply, bool useBinaryCmd)
 
bool sendSopasRunSetAccessMode (bool useBinaryCmd)
 
int setAligmentMode (int _AligmentMode)
 
int setApplicationMode (bool _active, int _mode)
 
void setLengthAndCRCinBinarySopasRequest (std::vector< uint8_t > *requestBinary)
 
int setMeanFilter (bool _active, int _numberOfScans)
 
int setParticleFilter (bool _active, int _particleThreshold)
 
void setProtocolType (SopasProtocol cola_dialect_id)
 set protocol type as enum More...
 
void setReadTimeOutInMs (int timeOutInMs)
 set timeout in milliseconds More...
 
 SickScanCommon (rosNodePtr nh, SickGenericParser *parser)
 Construction of SickScanCommon. More...
 
std::string sopasReplyToString (const std::vector< unsigned char > &reply)
 Converts reply from sendSOPASCommand to string. More...
 
bool testsetActivateStandBy ()
 
bool testsetAligmentMode ()
 
bool testsetApplicationMode ()
 
bool testsetMeanFilter ()
 
bool testsetParticleFilter ()
 
bool testSettingIpAddress ()
 
void update_config (sick_scan_xd::SickScanConfig &new_config, uint32_t level=0)
 updating configuration More...
 
int writeActiveFieldSet (int active_field_set, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
 
int writeFieldSetSelectionMethod (int field_set_selection_method, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
 
virtual ~SickScanCommon ()
 Destructor of SickScanCommon. More...
 

Static Public Member Functions

static bool dumpDatagramForDebugging (unsigned char *buffer, int bufLen, bool isBinary=true)
 

Public Attributes

ros_sensor_msgs::PointCloud2 cloud_
 
ros_sensor_msgs::PointCloud2 cloud_polar_
 
rosPublisher< ros_sensor_msgs::PointCloud2 > cloud_pub_
 
SickScanConfig config_
 
rosPublisher< sick_scan_msg::Encoder > Encoder_pub
 
rosPublisher< ros_sensor_msgs::Imu > imuScan_pub_
 
SickScanCommonNw m_nw
 

Protected Member Functions

int checkForBinaryAnswer (const std::vector< unsigned char > *reply)
 Check block for correct framing and starting sequence of a binary message. More...
 
virtual int close_device ()=0
 
unsigned long convertBigEndianCharArrayToUnsignedLong (const unsigned char *vecArr)
 Convert little endian to big endian (should be replaced by swap-routine) More...
 
virtual int get_datagram (rosNodePtr nh, rosTime &recvTimeStamp, unsigned char *receiveBuffer, int bufferSize, int *actual_length, bool isBinaryProtocol, int *numberOfRemainingFifoEntries, const std::vector< std::string > &datagram_keywords)=0
 Read a datagram from the device. More...
 
virtual int init_device ()=0
 
virtual int init_scanner (rosNodePtr nh)
 initialize scanner More...
 
bool isCompatibleDevice (const std::string identStr) const
 check the identification string More...
 
int readLIDinputstate (SickScanFieldMonSingleton *fieldMon, bool useBinaryCmd)
 
virtual int readWithTimeout (size_t timeout_ms, char *buffer, int buffer_size, int *bytes_read, const std::vector< std::string > &datagram_keywords)=0
 
std::string replyToString (const std::vector< unsigned char > &reply)
 Converts reply from sendSOPASCommand to string. More...
 
virtual int sendSOPASCommand (const char *request, std::vector< unsigned char > *reply, int cmdLen, bool wait_for_reply=true)=0
 Send a SOPAS command to the device and print out the response to the console. More...
 
virtual int stop_scanner (bool force_immediate_shutdown=false)
 Stops sending scan data. More...
 
bool switchColaProtocol (bool useBinaryCmd)
 

Private Member Functions

bool checkForProtocolChangeAndMaybeReconnect (bool &useBinaryCmdNow)
 checks the current protocol type and gives information about necessary change More...
 
bool getSensorIsRadar (void)
 
int readParseSafetyFields (bool useBinaryCmd)
 
bool setNewIpAddress (const std::string &ipNewIPAddr, bool useBinaryCmd)
 
bool setNTPServerAndStart (const std::string &ipNewIPAddr, bool useBinaryCmd)
 
void setSensorIsRadar (bool _isRadar)
 

Private Attributes

AngleCompensatorangleCompensator = NULL
 
SickScanMarkercloud_marker_
 
std::string cloud_topic_val = "cloud"
 
rosPublisher< ros_std_msgs::String > datagram_pub_
 
std::string deviceIdentStr
 
uint8_t * diagnosticPub_
 
double expectedFrequency_
 
rosPublisher< sick_scan_msg::LFErecMsg > lferec_pub_
 
rosPublisher< sick_scan_msg::LIDinputstateMsg > lidinputstate_pub_
 
rosPublisher< sick_scan_msg::LIDoutputstateMsg > lidoutputstate_pub_
 
sick_scan_xd::SickCloudTransform m_add_transform_xyz_rpy
 
double m_min_intensity
 
rosNodePtr m_nh
 
SopasProtocol m_protocolId
 
int m_read_timeout_millisec_default
 
int m_read_timeout_millisec_startup
 
ScanLayerFilterCfg m_scan_layer_filter_cfg
 
rosPublisher< sick_scan_msg::NAVLandmarkData > nav_landmark_data_pub_
 
rosPublisher< sick_scan_msg::NAVPoseData > nav_pose_data_pub_
 
rosPublisher< ros_visualization_msgs::MarkerArray > nav_reflector_pub_
 
std::string nav_tf_child_frame_id_
 
std::string nav_tf_parent_frame_id_
 
int outputChannelFlagId
 
SickGenericParserparser_ = 0
 
rosPublisher< ros_sensor_msgs::LaserScan > pub_
 
bool publish_datagram_
 
bool publish_lferec_
 
bool publish_lidinputstate_
 
bool publish_lidoutputstate_
 
bool publish_nav_landmark_data_
 
bool publish_nav_pose_data_
 
int readTimeOutInMs
 
bool sensorIsRadar
 
std::vector< int > sopasCmdChain
 
std::vector< std::string > sopasCmdErrMsg
 
std::vector< std::string > sopasCmdMaskVec
 
std::vector< std::string > sopasCmdVec
 
std::vector< std::vector< unsigned char > > sopasReplyBinVec
 
std::vector< std::string > sopasReplyStrVec
 
std::vector< std::string > sopasReplyVec
 
std::mutex sopasSendMutex
 

Detailed Description

Definition at line 102 of file sick_scan_common.h.

Member Enumeration Documentation

◆ SOPAS_CMD

Enumerator
CMD_DEVICE_IDENT_LEGACY 
CMD_DEVICE_IDENT 
CMD_SERIAL_NUMBER 
CMD_REBOOT 
CMD_WRITE_EEPROM 
CMD_FIRMWARE_VERSION 
CMD_DEVICE_STATE 
CMD_OPERATION_HOURS 
CMD_POWER_ON_COUNT 
CMD_LOCATION_NAME 
CMD_ACTIVATE_STANDBY 
CMD_SET_PARTICLE_FILTER 
CMD_SET_MEAN_FILTER 
CMD_SCAN_LAYER_FILTER 
CMD_APPLICATION_MODE 
CMD_APPLICATION_MODE_FIELD_ON 
CMD_APPLICATION_MODE_FIELD_OFF 
CMD_APPLICATION_MODE_RANGING_ON 
CMD_READ_ACTIVE_APPLICATIONS 
CMD_SET_ACCESS_MODE_3 
CMD_SET_ACCESS_MODE_3_SAFETY_SCANNER 
CMD_SET_OUTPUT_RANGES 
CMD_SET_OUTPUT_RANGES_NAV3 
CMD_GET_OUTPUT_RANGES 
CMD_RUN 
CMD_SET_PARTIAL_SCAN_CFG 
CMD_GET_PARTIAL_SCAN_CFG 
CMD_GET_PARTIAL_SCANDATA_CFG 
CMD_SET_PARTIAL_SCANDATA_CFG 
CMD_STOP_SCANDATA 
CMD_START_SCANDATA 
CMD_START_RADARDATA 
CMD_ACTIVATE_NTP_CLIENT 
CMD_SET_NTP_INTERFACE_ETH 
CMD_SET_ENCODER_MODE 
CMD_SET_ENCODER_MODE_NO 
CMD_SET_ENCODER_MODE_SI 
CMD_SET_ENCODER_MODE_DP 
CMD_SET_ENCODER_MODE_DL 
CMD_SET_ENCODER_MODE_FI 
CMD_SET_INCREMENTSOURCE_ENC 
CMD_SET_3_4_TO_ENCODER 
CMD_SET_ENOCDER_RES_1 
CMD_SET_ENCODER_RES 
CMD_START_IMU_DATA 
CMD_STOP_IMU_DATA 
CMD_SET_TRANSMIT_RAWTARGETS_ON 
CMD_SET_TRANSMIT_RAWTARGETS_OFF 
CMD_SET_TRANSMIT_OBJECTS_ON 
CMD_SET_TRANSMIT_OBJECTS_OFF 
CMD_SET_TRACKING_MODE_0 
CMD_SET_TRACKING_MODE_1 
CMD_LOAD_APPLICATION_DEFAULT 
CMD_DEVICE_TYPE 
CMD_ORDER_NUMBER 
CMD_START_MEASUREMENT 
CMD_STOP_MEASUREMENT 
CMD_SET_ECHO_FILTER 
CMD_SET_NTP_UPDATETIME 
CMD_SET_NTP_TIMEZONE 
CMD_SET_IP_ADDR 
CMD_SET_GATEWAY 
CMD_SET_NTP_SERVER_IP_ADDR 
CMD_SET_SCANDATACONFIGNAV 
CMD_GET_SCANDATACONFIGNAV 
CMD_SEN_SCANDATACONFIGNAV 
CMD_GET_ANGLE_COMPENSATION_PARAM 
CMD_SET_TO_COLA_A_PROTOCOL 
CMD_SET_TO_COLA_B_PROTOCOL 
CMD_GET_SAFTY_FIELD_CFG 
CMD_SET_LFEREC_ACTIVE 
CMD_SET_LID_OUTPUTSTATE_ACTIVE 
CMD_SET_LID_INPUTSTATE_ACTIVE 
CMD_SET_SCAN_CFG_LIST 
CMD_SET_NAV_OPERATIONAL_MODE_0 
CMD_SET_NAV_OPERATIONAL_MODE_1 
CMD_SET_NAV_OPERATIONAL_MODE_2 
CMD_SET_NAV_OPERATIONAL_MODE_3 
CMD_SET_NAV_OPERATIONAL_MODE_4 
CMD_SET_NAV_CURR_LAYER 
CMD_SET_NAV_LANDMARK_DATA_FORMAT 
CMD_SET_NAV_SCAN_DATA_FORMAT 
CMD_SET_NAV_POSE_DATA_FORMAT 
CMD_SET_NAV_MAP_CFG 
CMD_SET_NAV_REFL_SIZE 
CMD_SET_NAV_DO_MAPPING 
CMD_SET_NAV_ADD_LANDMARK 
CMD_SET_NAV_ERASE_LAYOUT 
CMD_SET_NAV_STORE_LAYOUT 
CMD_SET_NAV_POSE 
CMD_SET_LFPMEANFILTER 
CMD_SET_LFPMEDIANFILTER 
CMD_SET_LMDSCANDATASCALEFACTOR 
CMD_SET_GLARE_DETECTION_SENS 
CMD_SET_SCAN_LAYER_FILTER 
CMD_END 

Definition at line 105 of file sick_scan_common.h.

Constructor & Destructor Documentation

◆ SickScanCommon()

sick_scan_xd::SickScanCommon::SickScanCommon ( rosNodePtr  nh,
SickGenericParser parser 
)

Construction of SickScanCommon.

Parameters
parserCorresponding parser holding specific scanner parameter

Definition at line 462 of file sick_scan_common.cpp.

◆ ~SickScanCommon()

sick_scan_xd::SickScanCommon::~SickScanCommon ( )
virtual

Destructor of SickScanCommon.

Definition at line 919 of file sick_scan_common.cpp.

Member Function Documentation

◆ ActivateStandBy()

int sick_scan_xd::SickScanCommon::ActivateStandBy ( void  )

◆ changeIPandreboot()

bool sick_scan_xd::SickScanCommon::changeIPandreboot ( const std::string &  IpAdress)

Send a SOPAS command to the scanner that logs in the authorized client, changes the ip address and the reboots the scanner.

Parameters
IpAdressnew IP address
Returns
true if ip was changed and scanner is rebooting

◆ check_angle_range()

void sick_scan_xd::SickScanCommon::check_angle_range ( SickScanConfig conf)

check angle setting in the config and adjust the min_ang to the max_ang if min_ang greater than max_ax

Definition at line 5384 of file sick_scan_common.cpp.

◆ checkColaTypeAndSwitchToConfigured()

ExitCode sick_scan_xd::SickScanCommon::checkColaTypeAndSwitchToConfigured ( bool  useBinaryCmd)

Definition at line 1289 of file sick_scan_common.cpp.

◆ checkForBinaryAnswer()

int sick_scan_xd::SickScanCommon::checkForBinaryAnswer ( const std::vector< unsigned char > *  reply)
protected

Check block for correct framing and starting sequence of a binary message.

Parameters
[in]replycheck reply whether is SOPAS-ASCII or SOPAS-Binary
Returns
-1 if ascii otherwise the length of data content following offset 8
Parameters
replyPointer to datablock
Returns
length of message (-1 if message format is not correct)

Definition at line 793 of file sick_scan_common.cpp.

◆ checkForProtocolChangeAndMaybeReconnect()

bool sick_scan_xd::SickScanCommon::checkForProtocolChangeAndMaybeReconnect ( bool &  useBinaryCmdNow)
private

checks the current protocol type and gives information about necessary change

Parameters
useBinaryCmdNowInput/Output: Holds information about current protocol
Returns
true, if protocol type is already the right one

Definition at line 6059 of file sick_scan_common.cpp.

◆ close_device()

virtual int sick_scan_xd::SickScanCommon::close_device ( )
protectedpure virtual

◆ cmdSetAccessMode3()

std::string sick_scan_xd::SickScanCommon::cmdSetAccessMode3 ( void  )

Returns "sMN SetAccessMode 3 F4724744" resp. "\x02sMN SetAccessMode 3 6FD62C05\x03\0" for safety scanner.

Returns
error code

Definition at line 715 of file sick_scan_common.cpp.

◆ convertAscii2BinaryCmd()

int sick_scan_xd::SickScanCommon::convertAscii2BinaryCmd ( const char *  requestAscii,
std::vector< unsigned char > *  requestBinary 
)

Convert ASCII-message to Binary-message.

Parameters
requestAsciiholds ASCII-encoded command
requestBinaryhold binary command as vector of unsigned char
Returns
success = 0

Definition at line 5455 of file sick_scan_common.cpp.

◆ convertBigEndianCharArrayToUnsignedLong()

unsigned long sick_scan_xd::SickScanCommon::convertBigEndianCharArrayToUnsignedLong ( const unsigned char *  vecArr)
protected

Convert little endian to big endian (should be replaced by swap-routine)

Parameters
[in]*vecArrto (unsigned) char buffer in big endian byte oder (MSB first)
Returns
unsigned long value as interpretation of big endian long value
Parameters
*vecArrPointer to 4 byte block
Returns
swapped 4-byte-value as long

Definition at line 776 of file sick_scan_common.cpp.

◆ convertSendSOPASCommand()

int sick_scan_xd::SickScanCommon::convertSendSOPASCommand ( const std::string &  sopas_ascii_request,
std::vector< unsigned char > *  sopas_reply,
bool  wait_for_reply = true 
)
virtual

Converts a given SOPAS command from ascii to binary (in case of binary communication), sends sopas (ascii or binary) and returns the response (if wait_for_reply:=true)

Parameters
[in]requestthe command to send.
[in]cmdLenLength of the Comandstring in bytes used for Binary Mode only

Definition at line 830 of file sick_scan_common.cpp.

◆ dumpDatagramForDebugging()

bool sick_scan_xd::SickScanCommon::dumpDatagramForDebugging ( unsigned char *  buffer,
int  bufLen,
bool  isBinary = true 
)
static

Definition at line 4233 of file sick_scan_common.cpp.

◆ generateExpectedAnswerString()

std::vector< std::string > sick_scan_xd::SickScanCommon::generateExpectedAnswerString ( const std::vector< unsigned char > &  requestStr)

Generate expected answer strings from the command string.

Changes the Identifier of a commandstr. to its expected answer counterpart

Parameters
requestStrsent request string
Returns
Expected answer
Parameters
requestStrcommand string (either as ASCII or BINARY)
Returns
expected answer string

Map that defines expected answer identifiers

Definition at line 932 of file sick_scan_common.cpp.

◆ generateUnexpectedAnswerString()

std::vector< std::string > sick_scan_xd::SickScanCommon::generateUnexpectedAnswerString ( const std::string &  requestStr)

Returns a list of unexpected lidar responses like "" for request ""

Parameters
requestStrsent request string
Returns
Expected answer

Definition at line 1050 of file sick_scan_common.cpp.

◆ get2ndSopasResponse()

int sick_scan_xd::SickScanCommon::get2ndSopasResponse ( std::vector< uint8_t > &  sopas_response,
const std::string &  sopas_keyword 
)

Definition at line 1252 of file sick_scan_common.cpp.

◆ get_datagram()

virtual int sick_scan_xd::SickScanCommon::get_datagram ( rosNodePtr  nh,
rosTime recvTimeStamp,
unsigned char *  receiveBuffer,
int  bufferSize,
int *  actual_length,
bool  isBinaryProtocol,
int *  numberOfRemainingFifoEntries,
const std::vector< std::string > &  datagram_keywords 
)
protectedpure virtual

Read a datagram from the device.

Parameters
[out]recvTimeStamptimestamp of received packet
[in]receiveBufferdata buffer to fill
[in]bufferSizemax data size to write to buffer (result should be 0 terminated)
[out]actual_lengththe actual amount of data written
[in]isBinaryProtocolused Communication protocol True=Binary false=ASCII
[in]datagram_keywordskeyword in returned datagram, e.g. { "LMDscandata" } to get scandata telegrams, or {} (empty vector) for next received datagram

Implemented in sick_scan_xd::SickScanCommonTcp.

◆ get_expected_frequency()

double sick_scan_xd::SickScanCommon::get_expected_frequency ( ) const
inline

Definition at line 319 of file sick_scan_common.h.

◆ getConfigPtr()

SickScanConfig* sick_scan_xd::SickScanCommon::getConfigPtr ( )
inline

Definition at line 343 of file sick_scan_common.h.

◆ getCurrentParamPtr()

ScannerBasicParam* sick_scan_xd::SickScanCommon::getCurrentParamPtr ( )
inline

Definition at line 348 of file sick_scan_common.h.

◆ getNanosecTimestampLastTcpMessageReceived()

uint64_t sick_scan_xd::SickScanCommon::getNanosecTimestampLastTcpMessageReceived ( void  )
inline

Definition at line 365 of file sick_scan_common.h.

◆ getProtocolType()

int sick_scan_xd::SickScanCommon::getProtocolType ( void  )

get protocol type as enum

Returns
enum type of type SopasProtocol
See also
setProtocolType

Definition at line 1483 of file sick_scan_common.cpp.

◆ getReadTimeOutInMs()

int sick_scan_xd::SickScanCommon::getReadTimeOutInMs ( )

get timeout in milliseconds

Returns
timeout in milliseconds
See also
setReadTimeOutInMs

Definition at line 1473 of file sick_scan_common.cpp.

◆ getSensorIsRadar()

bool sick_scan_xd::SickScanCommon::getSensorIsRadar ( void  )
private

Definition at line 6218 of file sick_scan_common.cpp.

◆ handleNAV350BinaryPositionData()

bool sick_scan_xd::SickScanCommon::handleNAV350BinaryPositionData ( const uint8_t *  receiveBuffer,
int  receiveBufferLength,
short &  elevAngleX200,
double &  elevationAngleInRad,
rosTime recvTimeStamp,
bool  config_sw_pll_only_publish,
double  config_time_offset,
SickGenericParser parser_,
int &  numEchos,
ros_sensor_msgs::LaserScan &  msg,
NAV350mNPOSData navdata 
)

Definition at line 1376 of file sick_scan_common.cpp.

◆ init()

int sick_scan_xd::SickScanCommon::init ( rosNodePtr  nh)
virtual

init routine of scanner

Returns
exit code

Definition at line 1513 of file sick_scan_common.cpp.

◆ init_cmdTables()

int sick_scan_xd::SickScanCommon::init_cmdTables ( rosNodePtr  nh)

init command tables and define startup sequence

Returns
exit code

Definition at line 1541 of file sick_scan_common.cpp.

◆ init_device()

virtual int sick_scan_xd::SickScanCommon::init_device ( )
protectedpure virtual

◆ init_scanner()

int sick_scan_xd::SickScanCommon::init_scanner ( rosNodePtr  nh)
protectedvirtual

initialize scanner

Returns
exit code

Definition at line 2046 of file sick_scan_common.cpp.

◆ isCompatibleDevice()

bool sick_scan_xd::SickScanCommon::isCompatibleDevice ( const std::string  identStr) const
protected

check the identification string

Parameters
identStrstring (got from sopas request)
Returns
true, if this driver supports the scanner identified by the identification string

Definition at line 4277 of file sick_scan_common.cpp.

◆ loopOnce()

int sick_scan_xd::SickScanCommon::loopOnce ( rosNodePtr  nh)

parsing datagram and publishing ros messages

Returns
error code

Definition at line 4360 of file sick_scan_common.cpp.

◆ messageCbNavOdomVelocity()

void sick_scan_xd::SickScanCommon::messageCbNavOdomVelocity ( const sick_scan_msg::NAVOdomVelocity &  msg)

Definition at line 1422 of file sick_scan_common.cpp.

◆ readActiveFieldSet()

int sick_scan_xd::SickScanCommon::readActiveFieldSet ( int &  active_field_set,
std::vector< unsigned char > &  sopasReply,
bool  useBinaryCmd = true 
)

Definition at line 6461 of file sick_scan_common.cpp.

◆ readFieldSetSelectionMethod()

int sick_scan_xd::SickScanCommon::readFieldSetSelectionMethod ( int &  field_set_selection_method,
std::vector< unsigned char > &  sopasReply,
bool  useBinaryCmd = true 
)

Definition at line 6409 of file sick_scan_common.cpp.

◆ readLIDinputstate()

int sick_scan_xd::SickScanCommon::readLIDinputstate ( SickScanFieldMonSingleton fieldMon,
bool  useBinaryCmd 
)
protected

Definition at line 6358 of file sick_scan_common.cpp.

◆ readParseSafetyFields()

int sick_scan_xd::SickScanCommon::readParseSafetyFields ( bool  useBinaryCmd)
private

Definition at line 6270 of file sick_scan_common.cpp.

◆ readWithTimeout()

virtual int sick_scan_xd::SickScanCommon::readWithTimeout ( size_t  timeout_ms,
char *  buffer,
int  buffer_size,
int *  bytes_read,
const std::vector< std::string > &  datagram_keywords 
)
protectedpure virtual

◆ rebootScanner()

bool sick_scan_xd::SickScanCommon::rebootScanner ( )
virtual

Send a SOPAS command to the scanner that should cause a soft reset.

Reboot scanner.

Returns
true if reboot command was accepted, false otherwise
Result of rebooting attempt

Definition at line 853 of file sick_scan_common.cpp.

◆ replyToString()

std::string sick_scan_xd::SickScanCommon::replyToString ( const std::vector< unsigned char > &  reply)
protected

Converts reply from sendSOPASCommand to string.

convert ASCII or binary reply to a human readable string

Parameters
[in]replyreply from sendSOPASCommand
Returns
reply as string with special characters stripped out
Parameters
replydatablock, which should be converted
Returns
human readable string (used for debug/monitoring output)

Definition at line 4190 of file sick_scan_common.cpp.

◆ sendNAV350mNPOSGetData()

int sick_scan_xd::SickScanCommon::sendNAV350mNPOSGetData ( void  )

Definition at line 1364 of file sick_scan_common.cpp.

◆ sendSopasAndCheckAnswer() [1/2]

int sick_scan_xd::SickScanCommon::sendSopasAndCheckAnswer ( std::string  requestStr,
std::vector< unsigned char > *  reply,
int  cmdId = -1 
)

send command and check answer

Parameters
requestStrSopas-Command
*replyAntwort-String
cmdIdCommand index to derive the correct error message (optional)
Returns
error code

Definition at line 1068 of file sick_scan_common.cpp.

◆ sendSopasAndCheckAnswer() [2/2]

int sick_scan_xd::SickScanCommon::sendSopasAndCheckAnswer ( std::vector< unsigned char >  requestStr,
std::vector< unsigned char > *  reply,
int  cmdId = -1 
)

send command and check answer

Parameters
requestStrSopas-Command given as byte-vector
*replyAntwort-String
cmdIdCommand index to derive the correct error message (optional)
Returns
error code

Definition at line 1086 of file sick_scan_common.cpp.

◆ sendSopasAorBgetAnswer()

int sick_scan_xd::SickScanCommon::sendSopasAorBgetAnswer ( const std::string &  request,
std::vector< unsigned char > *  reply,
bool  useBinaryCmd 
)

Definition at line 1227 of file sick_scan_common.cpp.

◆ sendSOPASCommand()

virtual int sick_scan_xd::SickScanCommon::sendSOPASCommand ( const char *  request,
std::vector< unsigned char > *  reply,
int  cmdLen,
bool  wait_for_reply = true 
)
protectedpure virtual

Send a SOPAS command to the device and print out the response to the console.

Parameters
[in]requestthe command to send.
[out]replyif not NULL, will be filled with the reply package to the command.
[in]cmdLenLength of the Comandstring in bytes used for Binary Mode only

Implemented in sick_scan_xd::SickScanCommonTcp.

◆ sendSopasRunSetAccessMode()

bool sick_scan_xd::SickScanCommon::sendSopasRunSetAccessMode ( bool  useBinaryCmd)

Definition at line 1337 of file sick_scan_common.cpp.

◆ setAligmentMode()

int sick_scan_xd::SickScanCommon::setAligmentMode ( int  _AligmentMode)

◆ setApplicationMode()

int sick_scan_xd::SickScanCommon::setApplicationMode ( bool  _active,
int  _mode 
)

◆ setLengthAndCRCinBinarySopasRequest()

void sick_scan_xd::SickScanCommon::setLengthAndCRCinBinarySopasRequest ( std::vector< uint8_t > *  requestBinary)

Definition at line 6031 of file sick_scan_common.cpp.

◆ setMeanFilter()

int sick_scan_xd::SickScanCommon::setMeanFilter ( bool  _active,
int  _numberOfScans 
)

◆ setNewIpAddress()

bool sick_scan_xd::SickScanCommon::setNewIpAddress ( const std::string &  ipNewIPAddr,
bool  useBinaryCmd 
)
private

Definition at line 6095 of file sick_scan_common.cpp.

◆ setNTPServerAndStart()

bool sick_scan_xd::SickScanCommon::setNTPServerAndStart ( const std::string &  ipNewIPAddr,
bool  useBinaryCmd 
)
private

Definition at line 6154 of file sick_scan_common.cpp.

◆ setParticleFilter()

int sick_scan_xd::SickScanCommon::setParticleFilter ( bool  _active,
int  _particleThreshold 
)

◆ setProtocolType()

void sick_scan_xd::SickScanCommon::setProtocolType ( SopasProtocol  cola_dialect_id)

set protocol type as enum

See also
getProtocolType

Definition at line 1492 of file sick_scan_common.cpp.

◆ setReadTimeOutInMs()

void sick_scan_xd::SickScanCommon::setReadTimeOutInMs ( int  timeOutInMs)

set timeout in milliseconds

Parameters
timeOutInMsin milliseconds
See also
getReadTimeOutInMs

Definition at line 1463 of file sick_scan_common.cpp.

◆ setSensorIsRadar()

void sick_scan_xd::SickScanCommon::setSensorIsRadar ( bool  _isRadar)
private

Definition at line 6213 of file sick_scan_common.cpp.

◆ sopasReplyToString()

std::string sick_scan_xd::SickScanCommon::sopasReplyToString ( const std::vector< unsigned char > &  reply)
inline

Converts reply from sendSOPASCommand to string.

Parameters
[in]replyreply from sendSOPASCommand
Returns
reply as string with special characters stripped out

Definition at line 360 of file sick_scan_common.h.

◆ stop_scanner()

int sick_scan_xd::SickScanCommon::stop_scanner ( bool  force_immediate_shutdown = false)
protectedvirtual

Stops sending scan data.

Returns
error code

Definition at line 727 of file sick_scan_common.cpp.

◆ switchColaProtocol()

bool sick_scan_xd::SickScanCommon::switchColaProtocol ( bool  useBinaryCmd)
protected

Definition at line 1267 of file sick_scan_common.cpp.

◆ testsetActivateStandBy()

bool sick_scan_xd::SickScanCommon::testsetActivateStandBy ( )

◆ testsetAligmentMode()

bool sick_scan_xd::SickScanCommon::testsetAligmentMode ( )

◆ testsetApplicationMode()

bool sick_scan_xd::SickScanCommon::testsetApplicationMode ( )

◆ testsetMeanFilter()

bool sick_scan_xd::SickScanCommon::testsetMeanFilter ( )

◆ testsetParticleFilter()

bool sick_scan_xd::SickScanCommon::testsetParticleFilter ( )

◆ testSettingIpAddress()

bool sick_scan_xd::SickScanCommon::testSettingIpAddress ( )

◆ update_config()

void sick_scan_xd::SickScanCommon::update_config ( sick_scan_xd::SickScanConfig new_config,
uint32_t  level = 0 
)

updating configuration

Parameters
new_configPointer to new configuration
level(not used - should be removed)

Definition at line 5398 of file sick_scan_common.cpp.

◆ writeActiveFieldSet()

int sick_scan_xd::SickScanCommon::writeActiveFieldSet ( int  active_field_set,
std::vector< unsigned char > &  sopasReply,
bool  useBinaryCmd = true 
)

Definition at line 6438 of file sick_scan_common.cpp.

◆ writeFieldSetSelectionMethod()

int sick_scan_xd::SickScanCommon::writeFieldSetSelectionMethod ( int  field_set_selection_method,
std::vector< unsigned char > &  sopasReply,
bool  useBinaryCmd = true 
)

Definition at line 6386 of file sick_scan_common.cpp.

Member Data Documentation

◆ angleCompensator

AngleCompensator* sick_scan_xd::SickScanCommon::angleCompensator = NULL
private

Definition at line 550 of file sick_scan_common.h.

◆ cloud_

ros_sensor_msgs::PointCloud2 sick_scan_xd::SickScanCommon::cloud_

Definition at line 386 of file sick_scan_common.h.

◆ cloud_marker_

SickScanMarker* sick_scan_xd::SickScanCommon::cloud_marker_
private

Definition at line 477 of file sick_scan_common.h.

◆ cloud_polar_

ros_sensor_msgs::PointCloud2 sick_scan_xd::SickScanCommon::cloud_polar_

Definition at line 387 of file sick_scan_common.h.

◆ cloud_pub_

rosPublisher<ros_sensor_msgs::PointCloud2> sick_scan_xd::SickScanCommon::cloud_pub_

Definition at line 383 of file sick_scan_common.h.

◆ cloud_topic_val

std::string sick_scan_xd::SickScanCommon::cloud_topic_val = "cloud"
private

Definition at line 465 of file sick_scan_common.h.

◆ config_

SickScanConfig sick_scan_xd::SickScanCommon::config_

Definition at line 395 of file sick_scan_common.h.

◆ datagram_pub_

rosPublisher<ros_std_msgs::String> sick_scan_xd::SickScanCommon::datagram_pub_
private

Definition at line 468 of file sick_scan_common.h.

◆ deviceIdentStr

std::string sick_scan_xd::SickScanCommon::deviceIdentStr
private

Definition at line 514 of file sick_scan_common.h.

◆ diagnosticPub_

uint8_t* sick_scan_xd::SickScanCommon::diagnosticPub_
private

Definition at line 511 of file sick_scan_common.h.

◆ Encoder_pub

rosPublisher<sick_scan_msg::Encoder> sick_scan_xd::SickScanCommon::Encoder_pub

Definition at line 385 of file sick_scan_common.h.

◆ expectedFrequency_

double sick_scan_xd::SickScanCommon::expectedFrequency_
private

Definition at line 513 of file sick_scan_common.h.

◆ imuScan_pub_

rosPublisher<ros_sensor_msgs::Imu> sick_scan_xd::SickScanCommon::imuScan_pub_

Definition at line 384 of file sick_scan_common.h.

◆ lferec_pub_

rosPublisher<sick_scan_msg::LFErecMsg> sick_scan_xd::SickScanCommon::lferec_pub_
private

Definition at line 471 of file sick_scan_common.h.

◆ lidinputstate_pub_

rosPublisher<sick_scan_msg::LIDinputstateMsg> sick_scan_xd::SickScanCommon::lidinputstate_pub_
private

Definition at line 473 of file sick_scan_common.h.

◆ lidoutputstate_pub_

rosPublisher<sick_scan_msg::LIDoutputstateMsg> sick_scan_xd::SickScanCommon::lidoutputstate_pub_
private

Definition at line 474 of file sick_scan_common.h.

◆ m_add_transform_xyz_rpy

sick_scan_xd::SickCloudTransform sick_scan_xd::SickScanCommon::m_add_transform_xyz_rpy
private

Definition at line 560 of file sick_scan_common.h.

◆ m_min_intensity

double sick_scan_xd::SickScanCommon::m_min_intensity
private

Definition at line 552 of file sick_scan_common.h.

◆ m_nh

rosNodePtr sick_scan_xd::SickScanCommon::m_nh
private

Definition at line 580 of file sick_scan_common.h.

◆ m_nw

SickScanCommonNw sick_scan_xd::SickScanCommon::m_nw

Definition at line 341 of file sick_scan_common.h.

◆ m_protocolId

SopasProtocol sick_scan_xd::SickScanCommon::m_protocolId
private

Definition at line 464 of file sick_scan_common.h.

◆ m_read_timeout_millisec_default

int sick_scan_xd::SickScanCommon::m_read_timeout_millisec_default
private

Definition at line 557 of file sick_scan_common.h.

◆ m_read_timeout_millisec_startup

int sick_scan_xd::SickScanCommon::m_read_timeout_millisec_startup
private

Definition at line 558 of file sick_scan_common.h.

◆ m_scan_layer_filter_cfg

ScanLayerFilterCfg sick_scan_xd::SickScanCommon::m_scan_layer_filter_cfg
private

Definition at line 578 of file sick_scan_common.h.

◆ nav_landmark_data_pub_

rosPublisher<sick_scan_msg::NAVLandmarkData> sick_scan_xd::SickScanCommon::nav_landmark_data_pub_
private

Definition at line 481 of file sick_scan_common.h.

◆ nav_pose_data_pub_

rosPublisher<sick_scan_msg::NAVPoseData> sick_scan_xd::SickScanCommon::nav_pose_data_pub_
private

Definition at line 479 of file sick_scan_common.h.

◆ nav_reflector_pub_

rosPublisher<ros_visualization_msgs::MarkerArray> sick_scan_xd::SickScanCommon::nav_reflector_pub_
private

Definition at line 482 of file sick_scan_common.h.

◆ nav_tf_child_frame_id_

std::string sick_scan_xd::SickScanCommon::nav_tf_child_frame_id_
private

Definition at line 486 of file sick_scan_common.h.

◆ nav_tf_parent_frame_id_

std::string sick_scan_xd::SickScanCommon::nav_tf_parent_frame_id_
private

Definition at line 485 of file sick_scan_common.h.

◆ outputChannelFlagId

int sick_scan_xd::SickScanCommon::outputChannelFlagId
private

Definition at line 529 of file sick_scan_common.h.

◆ parser_

SickGenericParser* sick_scan_xd::SickScanCommon::parser_ = 0
private

Definition at line 520 of file sick_scan_common.h.

◆ pub_

rosPublisher<ros_sensor_msgs::LaserScan> sick_scan_xd::SickScanCommon::pub_
private

Definition at line 467 of file sick_scan_common.h.

◆ publish_datagram_

bool sick_scan_xd::SickScanCommon::publish_datagram_
private

Definition at line 469 of file sick_scan_common.h.

◆ publish_lferec_

bool sick_scan_xd::SickScanCommon::publish_lferec_
private

Definition at line 472 of file sick_scan_common.h.

◆ publish_lidinputstate_

bool sick_scan_xd::SickScanCommon::publish_lidinputstate_
private

Definition at line 475 of file sick_scan_common.h.

◆ publish_lidoutputstate_

bool sick_scan_xd::SickScanCommon::publish_lidoutputstate_
private

Definition at line 476 of file sick_scan_common.h.

◆ publish_nav_landmark_data_

bool sick_scan_xd::SickScanCommon::publish_nav_landmark_data_
private

Definition at line 483 of file sick_scan_common.h.

◆ publish_nav_pose_data_

bool sick_scan_xd::SickScanCommon::publish_nav_pose_data_
private

Definition at line 480 of file sick_scan_common.h.

◆ readTimeOutInMs

int sick_scan_xd::SickScanCommon::readTimeOutInMs
private

Definition at line 543 of file sick_scan_common.h.

◆ sensorIsRadar

bool sick_scan_xd::SickScanCommon::sensorIsRadar
private

Definition at line 548 of file sick_scan_common.h.

◆ sopasCmdChain

std::vector<int> sick_scan_xd::SickScanCommon::sopasCmdChain
private

Definition at line 527 of file sick_scan_common.h.

◆ sopasCmdErrMsg

std::vector<std::string> sick_scan_xd::SickScanCommon::sopasCmdErrMsg
private

Definition at line 526 of file sick_scan_common.h.

◆ sopasCmdMaskVec

std::vector<std::string> sick_scan_xd::SickScanCommon::sopasCmdMaskVec
private

Definition at line 522 of file sick_scan_common.h.

◆ sopasCmdVec

std::vector<std::string> sick_scan_xd::SickScanCommon::sopasCmdVec
private

Definition at line 521 of file sick_scan_common.h.

◆ sopasReplyBinVec

std::vector<std::vector<unsigned char> > sick_scan_xd::SickScanCommon::sopasReplyBinVec
private

Definition at line 524 of file sick_scan_common.h.

◆ sopasReplyStrVec

std::vector<std::string> sick_scan_xd::SickScanCommon::sopasReplyStrVec
private

Definition at line 525 of file sick_scan_common.h.

◆ sopasReplyVec

std::vector<std::string> sick_scan_xd::SickScanCommon::sopasReplyVec
private

Definition at line 523 of file sick_scan_common.h.

◆ sopasSendMutex

std::mutex sick_scan_xd::SickScanCommon::sopasSendMutex
private

Definition at line 545 of file sick_scan_common.h.


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


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:21