Class SickScanServices

Class Documentation

class SickScanServices

Public Functions

SickScanServices(rosNodePtr nh = 0, sick_scan_xd::SickScanCommonTcp *common_tcp = 0, ScannerBasicParam *lidar_param = 0)
virtual ~SickScanServices()
bool sendAuthorization()

Sends the SOPAS authorization command “sMN SetAccessMode 3 F4724744”.

bool sendSopasCmdCheckResponse(const std::string &sopas_request, const std::string &expected_response)

Sends a multiScan or picoScan SOPAS command

bool serviceCbColaMsg(sick_scan_srv::ColaMsgSrv::Request &service_request, sick_scan_srv::ColaMsgSrv::Response &service_response)

Callback for service ColaMsg (ColaMsg, send a cola message to lidar).

Parameters:
  • service_request[in] ros service request to lidar

  • service_response[out] service response from lidar

Returns:

true on success, false in case of errors.

inline bool serviceCbColaMsgROS2(std::shared_ptr<sick_scan_srv::ColaMsgSrv::Request> service_request, std::shared_ptr<sick_scan_srv::ColaMsgSrv::Response> service_response)
bool serviceCbECRChangeArr(sick_scan_srv::ECRChangeArrSrv::Request &service_request, sick_scan_srv::ECRChangeArrSrv::Response &service_response)

Callback for service messages (ECRChangeArr, Request status change of monitoring fields on event). Sends a cola telegram “sEN ECRChangeArr {0|1}” and receives the response from the lidar device.

Parameters:
  • service_request[in] ros service request to lidar

  • service_response[out] service response from lidar

Returns:

true on success, false in case of errors.

inline bool serviceCbECRChangeArrROS2(std::shared_ptr<sick_scan_srv::ECRChangeArrSrv::Request> service_request, std::shared_ptr<sick_scan_srv::ECRChangeArrSrv::Response> service_response)
bool serviceCbGetContaminationResult(sick_scan_srv::GetContaminationResultSrv::Request &service_request, sick_scan_srv::GetContaminationResultSrv::Response &service_response)

Callback for service messages (GetContaminationResult, Read contamination indication result). Sends a cola telegram “sRN ContaminationResult” and receives the response from the lidar device.

Parameters:
  • service_request[in] ros service request to lidar

  • service_response[out] service response from lidar

Returns:

true on success, false in case of errors.

inline bool serviceCbGetContaminationResultROS2(std::shared_ptr<sick_scan_srv::GetContaminationResultSrv::Request> service_request, std::shared_ptr<sick_scan_srv::GetContaminationResultSrv::Response> service_response)
bool serviceCbLIDoutputstate(sick_scan_srv::LIDoutputstateSrv::Request &service_request, sick_scan_srv::LIDoutputstateSrv::Response &service_response)

Callback for service messages (LIDoutputstate, Request status change of monitoring fields on event). Sends a cola telegram “sEN LIDoutputstate {0|1}” and receives the response from the lidar device.

Parameters:
  • service_request[in] ros service request to lidar

  • service_response[out] service response from lidar

Returns:

true on success, false in case of errors.

inline bool serviceCbLIDoutputstateROS2(std::shared_ptr<sick_scan_srv::LIDoutputstateSrv::Request> service_request, std::shared_ptr<sick_scan_srv::LIDoutputstateSrv::Response> service_response)
bool serviceCbSCdevicestate(sick_scan_srv::SCdevicestateSrv::Request &service_request, sick_scan_srv::SCdevicestateSrv::Response &service_response)

Callbacks for service messages.

Parameters:
  • service_request[in] ros service request to lidar

  • service_response[out] service response from lidar

Returns:

true on success, false in case of errors.

inline bool serviceCbSCdevicestateROS2(std::shared_ptr<sick_scan_srv::SCdevicestateSrv::Request> service_request, std::shared_ptr<sick_scan_srv::SCdevicestateSrv::Response> service_response)
bool serviceCbSCreboot(sick_scan_srv::SCrebootSrv::Request &service_request, sick_scan_srv::SCrebootSrv::Response &service_response)
inline bool serviceCbSCrebootROS2(std::shared_ptr<sick_scan_srv::SCrebootSrv::Request> service_request, std::shared_ptr<sick_scan_srv::SCrebootSrv::Response> service_response)
bool serviceCbSCsoftreset(sick_scan_srv::SCsoftresetSrv::Request &service_request, sick_scan_srv::SCsoftresetSrv::Response &service_response)
inline bool serviceCbSCsoftresetROS2(std::shared_ptr<sick_scan_srv::SCsoftresetSrv::Request> service_request, std::shared_ptr<sick_scan_srv::SCsoftresetSrv::Response> service_response)
bool serviceCbSickScanExit(sick_scan_srv::SickScanExitSrv::Request &service_request, sick_scan_srv::SickScanExitSrv::Response &service_response)
inline bool serviceCbSickScanExitROS2(std::shared_ptr<sick_scan_srv::SickScanExitSrv::Request> service_request, std::shared_ptr<sick_scan_srv::SickScanExitSrv::Response> service_response)
bool sendSopasAndCheckAnswer(const std::string &sopasCmd, std::vector<unsigned char> &sopasReplyBin, std::string &sopasReplyString)

Sends a sopas command and returns the lidar reply.

Parameters:
  • sopasCmd[in] sopas command to send, f.e. “sEN ECRChangeArr 1”

  • sopasReplyBin[out] response from lidar incl. start/stop byte

  • sopasReplyString[out] sopasReplyBin converted to string

Returns:

true on success, false in case of errors.

Public Static Functions

static float convertHexStringToFloat(const std::string &hex_str, bool hexStrIsBigEndian)

Converts a hex string (hex_str: 4 byte hex value as string, little or big endian) to float. Check f.e. by https://www.h-schmidt.net/FloatConverter/IEEE754.html Examples: convertHexStringToFloat(“C0490FF9”, true) returns -3.14 convertHexStringToFloat(“3FC90FF9”, true) returns +1.57

static std::string convertFloatToHexString(float value, bool hexStrIsBigEndian)

Converts a float value to hex string (hex_str: 4 byte hex value as string, little or big endian). Check f.e. by https://www.h-schmidt.net/FloatConverter/IEEE754.html Examples: convertFloatToHexString(-3.14, true) returns “C0490FDB” convertFloatToHexString(+1.57, true) returns “3FC90FF8”

static float convertHexStringToAngleDeg(const std::string &hex_str, bool hexStrIsBigEndian)

Converts a hex string coded in 1/10000 deg (hex_str: 4 byte hex value as string, little or big endian) to an angle in [deg] (float).

static std::string convertAngleDegToHexString(float angle_deg, bool hexStrIsBigEndian)

Converts an angle in [deg] to hex string coded in 1/10000 deg (hex_str: 4 byte hex value as string, little or big endian).

Protected Functions

bool sendRun()

Sends the SOPAS command “sMN Run”, which applies previous send settings

Protected Attributes

bool m_cola_binary

cola ascii or cola binary messages

sick_scan_xd::SickScanCommonTcp *m_common_tcp

common tcp handler

std::string m_client_authorization_pw
rosServiceServer<sick_scan_srv::ColaMsgSrv> m_srv_server_ColaMsg

service “ColaMsg”, &sick_scan::SickScanServices::serviceCbColaMsg

rosServiceServer<sick_scan_srv::ECRChangeArrSrv> m_srv_server_ECRChangeArr

service “ECRChangeArr”, &sick_scan::SickScanServices::serviceCbECRChangeArr

rosServiceServer<sick_scan_srv::GetContaminationResultSrv> m_srv_server_GetContaminationResult

service “GetContaminationResult”, &sick_scan::SickScanServices::serviceCbGetContaminationResult

rosServiceServer<sick_scan_srv::LIDoutputstateSrv> m_srv_server_LIDoutputstate

service “LIDoutputstate”, &sick_scan::SickScanServices::serviceCbLIDoutputstate

rosServiceServer<sick_scan_srv::SCdevicestateSrv> m_srv_server_SCdevicestate

service “SCdevicestate”, &sick_scan::SickScanServices::serviceCbSCdevicestate

rosServiceServer<sick_scan_srv::SCrebootSrv> m_srv_server_SCreboot

service “SCreboot”, &sick_scan::SickScanServices::serviceCbSCreboot

rosServiceServer<sick_scan_srv::SCsoftresetSrv> m_srv_server_SCsoftreset

service “SCsoftreset”, &sick_scan::SickScanServices::serviceCbSCsoftreset

rosServiceServer<sick_scan_srv::SickScanExitSrv> m_srv_server_SickScanExit

service “SickScanExitSrv”, &sick_scan::SickScanServices::serviceCbSickScanExit