Go to the documentation of this file.
64 #ifndef SICK_SCAN_COMMON_H_
65 #define SICK_SCAN_COMMON_H_
93 #define READ_TIMEOUT_MILLISEC_STARTUP 120000 // 120 sec read timeout during startup (sensor may be starting up, which can take up to 120 sec.) // TODO: move timeout to config
94 #define READ_TIMEOUT_MILLISEC_DEFAULT 5000 // 5 sec read timeout in operational mode (measurement mode) // TODO: move timeout to config
95 #define READ_TIMEOUT_MILLISEC_KILL_NODE 150000 // 150 sec pointcloud timeout, ros node will be killed if no point cloud published within the last 150 sec. // TODO: move timeout to config
228 #define PARAM_MIN_ANG "min_ang"
229 #define PARAM_MAX_ANG "max_ang"
230 #define PARAM_RES_ANG "res_ang"
259 virtual int convertSendSOPASCommand(
const std::string& sopas_ascii_request, std::vector<unsigned char>* reply,
bool wait_for_reply =
true);
265 int sendSopasAorBgetAnswer(
const std::string& request, std::vector<unsigned char> *reply,
bool useBinaryCmd);
278 bool config_sw_pll_only_publish,
double config_time_offset, SickGenericParser*
parser_,
int& numEchos,
ros_sensor_msgs::LaserScan& msg, NAV350mNPOSData& navdata);
315 #if defined USE_DYNAMIC_RECONFIGURE && __ROS_VERSION == 2
316 rcl_interfaces::msg::SetParametersResult update_config_cb(
const std::vector<rclcpp::Parameter> ¶meters);
371 int readFieldSetSelectionMethod(
int& field_set_selection_method, std::vector<unsigned char>& sopasReply,
bool useBinaryCmd =
true);
374 int writeActiveFieldSet(
int active_field_set, std::vector<unsigned char>& sopasReply,
bool useBinaryCmd =
true);
377 int readActiveFieldSet(
int& active_field_set, std::vector<unsigned char>& sopasReply,
bool useBinaryCmd =
true);
401 virtual int stop_scanner(
bool force_immediate_shutdown =
false);
411 virtual int sendSOPASCommand(
const char *request, std::vector<unsigned char> *reply,
int cmdLen,
bool wait_for_reply =
true) = 0;
413 virtual int readWithTimeout(
size_t timeout_ms,
char *buffer,
int buffer_size,
int *bytes_read,
const std::vector<std::string>& datagram_keywords) = 0;
425 bool isBinaryProtocol,
int *numberOfRemainingFifoEntries,
const std::vector<std::string>& datagram_keywords) = 0;
432 std::string
replyToString(
const std::vector<unsigned char> &reply);
459 #ifdef USE_DIAGNOSTIC_UPDATER
460 std::shared_ptr<diagnostic_updater::Updater> diagnostics_;
487 #if __ROS_VERSION > 0
491 #if __ROS_VERSION == 1
494 #elif __ROS_VERSION == 2
495 rclcpp::Subscription<sick_scan_msg::NAVOdomVelocity>::SharedPtr nav_odom_velocity_subscriber_;
496 void messageCbNavOdomVelocityROS2(
const std::shared_ptr<sick_scan_msg::NAVOdomVelocity> msg) {
messageCbNavOdomVelocity(*msg); }
497 rclcpp::Subscription<ros_nav_msgs::Odometry>::SharedPtr ros_odom_subscriber_;
498 void messageCbRosOdomROS2(
const std::shared_ptr<ros_nav_msgs::Odometry> msg) { messageCbRosOdom(*msg); }
502 #if defined USE_DIAGNOSTIC_UPDATER
503 #if __ROS_VERSION == 1
505 #elif __ROS_VERSION == 2
506 DiagnosedPublishAdapter<rosPublisher<ros_sensor_msgs::LaserScan>> *
diagnosticPub_;
516 #if defined USE_DYNAMIC_RECONFIGURE && __ROS_VERSION == 1
537 bool setNewIpAddress(
const std::string& ipNewIPAddr,
bool useBinaryCmd);
566 if (!parameter.empty())
575 void parse(
const std::string& parameter);
ScanLayerFilterCfg(const std::string ¶meter="")
int init_cmdTables(rosNodePtr nh)
init command tables and define startup sequence
rosPublisher< sick_scan_msg::LFErecMsg > lferec_pub_
bool testsetApplicationMode()
@ CMD_SET_NAV_POSE_DATA_FORMAT
bool publish_lidinputstate_
@ CMD_SET_LID_INPUTSTATE_ACTIVE
@ CMD_SET_NAV_LANDMARK_DATA_FORMAT
int setAligmentMode(int _AligmentMode)
@ CMD_APPLICATION_MODE_FIELD_OFF
@ CMD_SET_ENCODER_MODE_FI
@ CMD_SET_PARTIAL_SCAN_CFG
@ CMD_SET_TRANSMIT_OBJECTS_ON
bool isCompatibleDevice(const std::string identStr) const
check the identification string
SickScanMarker * cloud_marker_
@ CMD_SET_NAV_ERASE_LAYOUT
@ CMD_SET_SCANDATACONFIGNAV
@ CMD_SET_NAV_OPERATIONAL_MODE_3
@ CMD_SET_NAV_OPERATIONAL_MODE_4
std::vector< std::string > sopasCmdVec
@ CMD_SET_ENCODER_MODE_SI
@ CMD_SET_TRANSMIT_RAWTARGETS_ON
int writeFieldSetSelectionMethod(int field_set_selection_method, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
@ CMD_SET_LID_OUTPUTSTATE_ACTIVE
@ CMD_SET_NAV_SCAN_DATA_FORMAT
void swap_endian(unsigned char *ptr, int numBytes)
Universal swapping function.
SickScanCommon(rosNodePtr nh, SickGenericParser *parser)
Construction of SickScanCommon.
virtual int readWithTimeout(size_t timeout_ms, char *buffer, int buffer_size, int *bytes_read, const std::vector< std::string > &datagram_keywords)=0
@ CMD_SET_LMDSCANDATASCALEFACTOR
ExitCode checkColaTypeAndSwitchToConfigured(bool useBinaryCmd)
@ CMD_SET_LFPMEDIANFILTER
std::vector< std::string > sopasReplyVec
int setParticleFilter(bool _active, int _particleThreshold)
std::vector< std::string > generateExpectedAnswerString(const std::vector< unsigned char > &requestStr)
Generate expected answer strings from the command string.
::sensor_msgs::PointCloud2_< std::allocator< void > > PointCloud2
bool testsetAligmentMode()
@ CMD_GET_PARTIAL_SCAN_CFG
@ CMD_SET_INCREMENTSOURCE_ENC
void update_config(sick_scan_xd::SickScanConfig &new_config, uint32_t level=0)
updating configuration
int loopOnce(rosNodePtr nh)
parsing datagram and publishing ros messages
@ CMD_DEVICE_IDENT_LEGACY
ros_sensor_msgs::PointCloud2 cloud_polar_
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
@ CMD_SET_ACCESS_MODE_3_SAFETY_SCANNER
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),...
int checkForBinaryAnswer(const std::vector< unsigned char > *reply)
Check block for correct framing and starting sequence of a binary message.
rosPublisher< sick_scan_msg::NAVLandmarkData > nav_landmark_data_pub_
@ CMD_GET_SAFTY_FIELD_CFG
AngleCompensator * angleCompensator
int writeActiveFieldSet(int active_field_set, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
std::vector< std::string > sopasReplyStrVec
std::vector< std::string > sopasCmdMaskVec
int sendSopasAorBgetAnswer(const std::string &request, std::vector< unsigned char > *reply, bool useBinaryCmd)
std::mutex sopasSendMutex
@ CMD_SET_TRACKING_MODE_0
@ CMD_SET_NAV_STORE_LAYOUT
void parse(const std::string ¶meter)
@ CMD_SET_NTP_INTERFACE_ETH
int sendSopasAndCheckAnswer(std::string request, std::vector< unsigned char > *reply, int cmdId)
send command and check answer
@ CMD_SET_TRACKING_MODE_1
rosPublisher< ros_sensor_msgs::PointCloud2 > cloud_pub_
bool testsetParticleFilter()
int m_read_timeout_millisec_startup
::nav_msgs::Odometry_< std::allocator< void > > Odometry
@ CMD_SET_TO_COLA_A_PROTOCOL
@ CMD_SET_ENCODER_MODE_NO
virtual bool rebootScanner()
Send a SOPAS command to the scanner that should cause a soft reset.
void setSensorIsRadar(bool _isRadar)
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)
::sensor_msgs::LaserScan_< std::allocator< void > > LaserScan
@ CMD_SET_TO_COLA_B_PROTOCOL
@ CMD_SEN_SCANDATACONFIGNAV
ScannerBasicParam * getCurrentParamPtr()
bool setNTPServerAndStart(const std::string &ipNewIPAddr, bool useBinaryCmd)
virtual int init(rosNodePtr nh)
init routine of scanner
rosPublisher< sick_scan_msg::LIDoutputstateMsg > lidoutputstate_pub_
@ CMD_SET_NAV_OPERATIONAL_MODE_2
std::vector< int > sopasCmdChain
SickScanConfig * getConfigPtr()
A TopicDiagnostic combined with a ros::Publisher.
std::string nav_tf_child_frame_id_
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.
@ CMD_SET_NTP_SERVER_IP_ADDR
int ActivateStandBy(void)
std::string cmdSetAccessMode3(void)
Returns "sMN SetAccessMode 3 F4724744" resp. "\x02sMN SetAccessMode 3 6FD62C05\x03\0" for safety scan...
void setProtocolType(SopasProtocol cola_dialect_id)
set protocol type as enum
virtual int init_scanner(rosNodePtr nh)
initialize scanner
rosPublisher< ros_visualization_msgs::MarkerArray > nav_reflector_pub_
rosPublisher< sick_scan_msg::LIDinputstateMsg > lidinputstate_pub_
static bool dumpDatagramForDebugging(unsigned char *buffer, int bufLen, bool isBinary=true)
ScannerBasicParam * getCurrentParamPtr()
Gets Pointer to parameter object.
int readFieldSetSelectionMethod(int &field_set_selection_method, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
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_a...
int setApplicationMode(bool _active, int _mode)
bool testSettingIpAddress()
@ CMD_READ_ACTIVE_APPLICATIONS
virtual int init_device()=0
rosPublisher< ros_sensor_msgs::Imu > imuScan_pub_
virtual ~SickScanCommon()
Destructor of SickScanCommon.
int get2ndSopasResponse(std::vector< uint8_t > &sopas_response, const std::string &sopas_keyword)
int getReadTimeOutInMs()
get timeout in milliseconds
std::vector< std::string > sopasCmdErrMsg
@ CMD_SET_GLARE_DETECTION_SENS
bool testsetActivateStandBy()
double get_expected_frequency() const
@ CMD_SET_TRANSMIT_OBJECTS_OFF
int readParseSafetyFields(bool useBinaryCmd)
int getProtocolType(void)
get protocol type as enum
@ CMD_SET_PARTIAL_SCANDATA_CFG
@ CMD_LOAD_APPLICATION_DEFAULT
int setMeanFilter(bool _active, int _numberOfScans)
int readActiveFieldSet(int &active_field_set, std::vector< unsigned char > &sopasReply, bool useBinaryCmd=true)
int sendNAV350mNPOSGetData(void)
std::string sopasReplyToString(const std::vector< unsigned char > &reply)
Converts reply from sendSOPASCommand to string.
void messageCbNavOdomVelocity(const sick_scan_msg::NAVOdomVelocity &msg)
void setReadTimeOutInMs(int timeOutInMs)
set timeout in milliseconds
std::vector< std::string > generateUnexpectedAnswerString(const std::string &requestStr)
ros_sensor_msgs::PointCloud2 cloud_
SopasProtocol m_protocolId
@ CMD_SET_ENCODER_MODE_DL
rosPublisher< sick_scan_msg::Encoder > Encoder_pub
@ CMD_SET_NAV_OPERATIONAL_MODE_0
@ CMD_SET_NAV_OPERATIONAL_MODE_1
@ CMD_SET_PARTICLE_FILTER
@ CMD_APPLICATION_MODE_RANGING_ON
std::string replyToString(const std::vector< unsigned char > &reply)
Converts reply from sendSOPASCommand to string.
bool changeIPandreboot(const std::string &IpAdress)
Send a SOPAS command to the scanner that logs in the authorized client, changes the ip address and th...
bool setNewIpAddress(const std::string &ipNewIPAddr, bool useBinaryCmd)
double expectedFrequency_
rosPublisher< ros_sensor_msgs::LaserScan > pub_
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.
sick_scan_xd::SickCloudTransform m_add_transform_xyz_rpy
@ CMD_SET_ENCODER_MODE_DP
rosPublisher< ros_std_msgs::String > datagram_pub_
std::vector< int > scan_layer_activated
@ CMD_ACTIVATE_NTP_CLIENT
virtual int stop_scanner(bool force_immediate_shutdown=false)
Stops sending scan data.
@ CMD_APPLICATION_MODE_FIELD_ON
std::vector< std::vector< unsigned char > > sopasReplyBinVec
int convertAscii2BinaryCmd(const char *requestAscii, std::vector< unsigned char > *requestBinary)
Convert ASCII-message to Binary-message.
virtual int close_device()=0
std::string deviceIdentStr
@ CMD_SET_NAV_ADD_LANDMARK
@ CMD_GET_SCANDATACONFIGNAV
void setLengthAndCRCinBinarySopasRequest(std::vector< uint8_t > *requestBinary)
int m_read_timeout_millisec_default
bool publish_nav_pose_data_
@ CMD_GET_ANGLE_COMPENSATION_PARAM
bool sendSopasRunSetAccessMode(bool useBinaryCmd)
bool checkForProtocolChangeAndMaybeReconnect(bool &useBinaryCmdNow)
checks the current protocol type and gives information about necessary change
@ CMD_SET_TRANSMIT_RAWTARGETS_OFF
int readLIDinputstate(SickScanFieldMonSingleton *fieldMon, bool useBinaryCmd)
SickGenericParser * parser_
rosPublisher< sick_scan_msg::NAVPoseData > nav_pose_data_pub_
std::string cloud_topic_val
bool publish_nav_landmark_data_
unsigned long convertBigEndianCharArrayToUnsignedLong(const unsigned char *vecArr)
Convert little endian to big endian (should be replaced by swap-routine)
@ CMD_SET_SCAN_LAYER_FILTER
uint64_t getNanosecTimestampLastTcpMessageReceived(void)
::sick_scan_xd::NAVOdomVelocity_< std::allocator< void > > NAVOdomVelocity
bool getSensorIsRadar(void)
@ CMD_SET_OUTPUT_RANGES_NAV3
bool switchColaProtocol(bool useBinaryCmd)
std::string scan_layer_filter
bool publish_lidoutputstate_
std::string nav_tf_parent_frame_id_
@ CMD_GET_PARTIAL_SCANDATA_CFG
ScanLayerFilterCfg m_scan_layer_filter_cfg
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10