Class SickScanCommon

Nested Relationships

Nested Types

Inheritance Relationships

Derived Type

Class Documentation

class SickScanCommon

Subclassed by sick_scan_xd::SickScanCommonTcp

Public Types

enum SOPAS_CMD

Values:

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

Public Functions

SickScanCommon(rosNodePtr nh, SickGenericParser *parser)
virtual ~SickScanCommon()
int setParticleFilter(bool _active, int _particleThreshold)
std::vector<std::string> generateExpectedAnswerString(const std::vector<unsigned char> &requestStr)

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

Parameters:

requestStr – sent request string

Returns:

Expected answer

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

Returns a list of unexpected lidar responses like “” for request “”

Parameters:

requestStr – sent request string

Returns:

Expected answer

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)

Parameters:
  • request[in] the command to send.

  • cmdLen[in] Length of the Comandstring in bytes used for Binary Mode only

int sendSopasAndCheckAnswer(std::string request, std::vector<unsigned char> *reply, int cmdId)
int sendSopasAndCheckAnswer(std::vector<unsigned char> request, std::vector<unsigned char> *reply, int cmdId)
int sendSopasAorBgetAnswer(const std::string &request, std::vector<unsigned char> *reply, bool useBinaryCmd)
int get2ndSopasResponse(std::vector<uint8_t> &sopas_response, const std::string &sopas_keyword)
ExitCode checkColaTypeAndSwitchToConfigured(bool useBinaryCmd)
bool sendSopasRunSetAccessMode(bool useBinaryCmd)
int sendNAV350mNPOSGetData(void)
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)
int setAligmentMode(int _AligmentMode)
int setMeanFilter(bool _active, int _numberOfScans)
int setApplicationMode(bool _active, int _mode)
int ActivateStandBy(void)
bool testSettingIpAddress()
bool testsetParticleFilter()
bool testsetMeanFilter()
bool testsetAligmentMode()
bool testsetActivateStandBy()
bool testsetApplicationMode()
int getReadTimeOutInMs()
void setReadTimeOutInMs(int timeOutInMs)
int getProtocolType(void)
void setProtocolType(SopasProtocol cola_dialect_id)
virtual int init(rosNodePtr nh)
int loopOnce(rosNodePtr nh)
void check_angle_range(SickScanConfig &conf)
void update_config(sick_scan_xd::SickScanConfig &new_config, uint32_t level = 0)
inline double get_expected_frequency() const
int convertAscii2BinaryCmd(const char *requestAscii, std::vector<unsigned char> *requestBinary)
void setLengthAndCRCinBinarySopasRequest(std::vector<uint8_t> *requestBinary)
int init_cmdTables(rosNodePtr nh)
virtual bool rebootScanner()

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

Returns:

true if reboot command was accepted, false otherwise

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.

Parameters:

IpAdress – new IP address

Returns:

true if ip was changed and scanner is rebooting

inline SickScanConfig *getConfigPtr()
inline ScannerBasicParam *getCurrentParamPtr()
std::string cmdSetAccessMode3(void)
inline std::string sopasReplyToString(const std::vector<unsigned char> &reply)

Converts reply from sendSOPASCommand to string.

Parameters:

reply[in] reply from sendSOPASCommand

Returns:

reply as string with special characters stripped out

inline uint64_t getNanosecTimestampLastTcpMessageReceived(void)
int writeFieldSetSelectionMethod(int field_set_selection_method, std::vector<unsigned char> &sopasReply, bool useBinaryCmd = true)
int readFieldSetSelectionMethod(int &field_set_selection_method, std::vector<unsigned char> &sopasReply, bool useBinaryCmd = true)
int writeActiveFieldSet(int active_field_set, std::vector<unsigned char> &sopasReply, bool useBinaryCmd = true)
int readActiveFieldSet(int &active_field_set, std::vector<unsigned char> &sopasReply, bool useBinaryCmd = true)
void messageCbNavOdomVelocity(const sick_scan_msg::NAVOdomVelocity &msg)

Public Members

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

Public Static Functions

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

Protected Functions

virtual int init_device() = 0
virtual int init_scanner(rosNodePtr nh)
virtual int stop_scanner(bool force_immediate_shutdown = false)
virtual int close_device() = 0
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.

Parameters:
  • request[in] the command to send.

  • reply[out] if not NULL, will be filled with the reply package to the command.

  • cmdLen[in] Length of the Comandstring in bytes used for Binary Mode only

virtual int readWithTimeout(size_t timeout_ms, char *buffer, int buffer_size, int *bytes_read, const std::vector<std::string> &datagram_keywords) = 0
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.

Parameters:
  • recvTimeStamp[out] timestamp of received packet

  • receiveBuffer[in] data buffer to fill

  • bufferSize[in] max data size to write to buffer (result should be 0 terminated)

  • actual_length[out] the actual amount of data written

  • isBinaryProtocol[in] used Communication protocol True=Binary false=ASCII

  • datagram_keywords[in] keyword in returned datagram, e.g. { “LMDscandata” } to get scandata telegrams, or {} (empty vector) for next received datagram

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

Converts reply from sendSOPASCommand to string.

Parameters:

reply[in] reply from sendSOPASCommand

Returns:

reply as string with special characters stripped out

unsigned long convertBigEndianCharArrayToUnsignedLong(const unsigned char *vecArr)
Parameters:

*vecArr[in] to (unsigned) char buffer in big endian byte oder (MSB first)

Returns:

unsigned long value as interpretation of big endian long value

int checkForBinaryAnswer(const std::vector<unsigned char> *reply)
Parameters:

reply[in] check reply whether is SOPAS-ASCII or SOPAS-Binary

Returns:

-1 if ascii otherwise the length of data content following offset 8

bool isCompatibleDevice(const std::string identStr) const

check the identification string

Parameters:

identStr – string (got from sopas request)

Returns:

true, if this driver supports the scanner identified by the identification string

bool switchColaProtocol(bool useBinaryCmd)
int readLIDinputstate(SickScanFieldMonSingleton *fieldMon, bool useBinaryCmd)