Template Class LidarDriver

Class Documentation

template<typename T_PointCloud>
class LidarDriver

This is the RoboSense LiDAR driver interface class.

Public Functions

inline LidarDriver()

Constructor, instanciate the driver pointer.

inline void regPointCloudCallback(const std::function<std::shared_ptr<T_PointCloud>(void)> &cb_get_cloud, const std::function<void(std::shared_ptr<T_PointCloud>)> &cb_put_cloud)

Register the lidar point cloud callback function to driver. When point cloud is ready, this function will be called.

Parameters:

callback – The callback function

inline void regImuDataCallback(const std::function<std::shared_ptr<ImuData>(void)> &cb_get_imu_data, const std::function<void(const std::shared_ptr<ImuData>&)> &cb_put_imu_data)

Register the imu data callback function to driver. When imu data is ready, this function will be called.

Parameters:

callback – The callback function

inline void regPacketCallback(const std::function<void(const Packet&)> &cb_put_pkt)

Register the lidar difop packet message callback function to driver. When lidar difop packet message is ready, this function will be called.

Parameters:

callback – The callback function

inline void regExceptionCallback(const std::function<void(const Error&)> &cb_excep)

Register the exception message callback function to driver. When error occurs, this function will be called.

Parameters:

callback – The callback function

inline bool init(const RSDriverParam &param)

The initialization function, used to set up parameters and instance objects, used when get packets from online lidar or pcap.

Parameters:

param – The custom struct RSDriverParam

Returns:

If successful, return true; else return false

inline bool start()

Start the thread to receive and decode packets.

Returns:

If successful, return true; else return false

inline void decodePacket(const Packet &pkt)

Decode lidar msop/difop messages.

Parameters:

pkt_msg – The lidar msop/difop packet

inline bool getTemperature(float &temp)

Get the current lidar temperature.

Parameters:

temp – The variable to store lidar temperature

Returns:

if get temperature successfully, return true; else return false

inline bool getDeviceInfo(DeviceInfo &info)

Get device info.

Parameters:

info – The variable to store device info

Returns:

if get device info successfully, return true; else return false

inline bool getDeviceStatus(DeviceStatus &status)

Get device status.

Parameters:

info – The variable to store device status

Returns:

if get device info successfully, return true; else return false

inline void stop()

Stop all threads.