42 #ifndef SICK_SCAN_COMMON_H_ 43 #define SICK_SCAN_COMMON_H_ 51 #include <boost/asio.hpp> 54 #include <sensor_msgs/LaserScan.h> 55 #include <sensor_msgs/PointCloud.h> 56 #include <sensor_msgs/PointCloud2.h> 57 #include <std_msgs/String.h> 69 #include <dynamic_reconfigure/server.h> 70 #include <sick_scan/SickScanConfig.h> 77 #include "sick_scan/Encoder.h" 176 #define PARAM_MIN_ANG "min_ang" 177 #define PARAM_MAX_ANG "max_ang" 178 #define PARAM_RES_ANG "res_ang" 231 void update_config(sick_scan::SickScanConfig &new_config, uint32_t level = 0);
298 virtual int sendSOPASCommand(
const char *request, std::vector<unsigned char> *reply,
int cmdLen = -1) = 0;
307 virtual int get_datagram(
ros::Time &recvTimeStamp,
unsigned char *receiveBuffer,
int bufferSize,
int *actual_length,
308 bool isBinaryProtocol,
int *numberOfRemainingFifoEntries) = 0;
315 std::string
replyToString(
const std::vector<unsigned char> &reply);
383 bool setNewIpAddress(boost::asio::ip::address_v4 ipNewIPAddr,
bool useBinaryCmd);
bool changeIPandreboot(boost::asio::ip::address_v4 IpAdress)
Send a SOPAS command to the scanner that logs in the authorized client, changes the ip adress and the...
void setReadTimeOutInMs(int timeOutInMs)
set timeout in milliseconds
std::vector< std::string > sopasCmdErrMsg
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 loopOnce()
parsing datagram and publishing ros messages
virtual int init_scanner()
initialize scanner
std::vector< std::string > sopasCmdMaskVec
std::vector< std::string > sopasReplyStrVec
std::vector< std::string > sopasCmdVec
int getReadTimeOutInMs()
get timeout in milliseconds
double expectedFrequency_
void update_config(sick_scan::SickScanConfig &new_config, uint32_t level=0)
updating configuration
ros::Publisher lferec_pub_
ros::Publisher lidoutputstate_pub_
bool dumpDatagramForDebugging(unsigned char *buffer, int bufLen)
int ActivateStandBy(void)
SickScanCommon(SickGenericParser *parser)
Construction of SickScanCommon.
int convertAscii2BinaryCmd(const char *requestAscii, std::vector< unsigned char > *requestBinary)
Convert ASCII-message to Binary-message.
virtual int init_device()=0
bool publish_lidoutputstate_
SickScanConfig * getConfigPtr()
bool testSettingIpAddress()
bool setNewIpAddress(boost::asio::ip::address_v4 ipNewIPAddr, bool useBinaryCmd)
bool testsetActivateStandBy()
dynamic_reconfigure::Server< sick_scan::SickScanConfig > dynamic_reconfigure_server_
void swap_endian(unsigned char *ptr, int numBytes)
Universal swapping function.
diagnostic_updater::Updater diagnostics_
ros::Publisher Encoder_pub
std::vector< std::string > sopasReplyVec
bool checkForProtocolChangeAndMaybeReconnect(bool &useBinaryCmdNow)
checks the current protocol type and gives information about necessary change
virtual bool rebootScanner()
Send a SOPAS command to the scanner that should cause a soft reset.
int getProtocolType(void)
get protocol type as enum
SopasProtocol m_protocolId
bool testsetAligmentMode()
void setProtocolType(SopasProtocol cola_dialect_id)
set protocol type as enum
std::vector< int > sopasCmdChain
ros::Publisher imuScan_pub_
std::string replyToString(const std::vector< unsigned char > &reply)
Converts reply from sendSOPASCommand to string.
bool setNTPServerAndStart(boost::asio::ip::address_v4 ipNewIPAddr, bool useBinaryCmd)
std::string generateExpectedAnswerString(const std::vector< unsigned char > requestStr)
Generate expected answer string from the command string.
std::string sopasReplyToString(const std::vector< unsigned char > &reply)
Converts reply from sendSOPASCommand to string.
bool testsetApplicationMode()
SickGenericParser * parser_
ros::Publisher datagram_pub_
int checkForBinaryAnswer(const std::vector< unsigned char > *reply)
Check block for correct framing and starting sequence of a binary message.
void setSensorIsRadar(bool _isRadar)
virtual ~SickScanCommon()
Destructor of SickScanCommon.
virtual int close_device()=0
SickScanMarker * cloud_marker_
int sendSopasAndCheckAnswer(std::string request, std::vector< unsigned char > *reply, int cmdId)
send command and check answer
bool testsetParticleFilter()
unsigned long convertBigEndianCharArrayToUnsignedLong(const unsigned char *vecArr)
Convert little endian to big endian (should be replaced by swap-routine)
virtual int init()
init routine of scanner
int setParticleFilter(bool _active, int _particleThreshold)
double get_expected_frequency() const
virtual int stop_scanner()
Stops sending scan data.
virtual int get_datagram(ros::Time &recvTimeStamp, unsigned char *receiveBuffer, int bufferSize, int *actual_length, bool isBinaryProtocol, int *numberOfRemainingFifoEntries)=0
Read a datagram from the device.
int setMeanFilter(bool _active, int _numberOfScans)
bool getSensorIsRadar(void)
bool isCompatibleDevice(const std::string identStr) const
check the identification string
std::mutex sopasSendMutex
diagnostic_updater::DiagnosedPublisher< sensor_msgs::LaserScan > * diagnosticPub_
sensor_msgs::PointCloud2 cloud_
ros::Publisher cloud_pub_
int setApplicationMode(bool _active, int _mode)
std::vector< std::vector< unsigned char > > sopasReplyBinVec
AngleCompensator * angleCompensator
int setAligmentMode(int _AligmentMode)
int init_cmdTables()
init command tables and define startup sequence
virtual int sendSOPASCommand(const char *request, std::vector< unsigned char > *reply, int cmdLen=-1)=0
Send a SOPAS command to the device and print out the response to the console.