Template Class RobosenseDecoder

Inheritance Relationships

Base Type

Class Documentation

template<typename SensorT>
class RobosenseDecoder : public nebula::drivers::RobosenseScanDecoder

Public Functions

inline explicit RobosenseDecoder(const std::shared_ptr<const RobosenseSensorConfiguration> &sensor_configuration, const std::shared_ptr<const RobosenseCalibrationConfiguration> &calibration_configuration)

Constructor.

Parameters:
  • sensor_configuration – SensorConfiguration for this decoder

  • calibration_configuration – Calibration for this decoder calibration_configuration is set)

inline virtual int unpack(const std::vector<uint8_t> &msop_packet) override

Parses RobosensePacket and add its points to the point cloud.

Parameters:

msop_packet – The incoming MsopPacket

Returns:

The last azimuth processed

inline virtual bool has_scanned() override

Indicates whether one full scan is ready.

Returns:

Whether a scan is ready

inline virtual std::tuple<drivers::NebulaPointCloudPtr, double> get_pointcloud() override

Returns the point cloud and timestamp of the last scan.

Returns:

A tuple of point cloud and timestamp in nanoseconds

Protected Functions

inline bool parse_packet(const std::vector<uint8_t> &msop_packet)

Validates and parses MsopPacket. Currently only checks size, not checksums etc.

Parameters:

msop_packet – The incoming MsopPacket

Returns:

Whether the packet was parsed successfully

inline void convert_returns(size_t start_block_id, size_t n_blocks)

Converts a group of returns (i.e. 1 for single return, 2 for dual return, etc.) to points and appends them to the point cloud.

Parameters:
  • start_block_id – The first block in the group of returns

  • n_blocks – The number of returns in the group

inline bool check_scan_completed(int current_phase)

Checks whether the last processed block was the last block of a scan.

Parameters:

current_phase – The azimuth of the last processed block

Returns:

Whether the scan has completed

inline float get_distance(const typename SensorT::packet_t::body_t::block_t::unit_t &unit)

Get the distance of the given unit in meters.

Parameters:

unit – The unit to get the distance from

Returns:

The distance in meters

inline uint32_t get_point_time_relative(uint64_t packet_timestamp_ns, size_t block_id, size_t channel_id)

Get timestamp of point in nanoseconds, relative to scan timestamp. Includes firing time offset correction for channel and block.

Parameters:
  • packet_timestamp_ns – The timestamp of the current MsopPacket in nanoseconds

  • block_id – The block index of the point

  • channel_id – The channel index of the point

Protected Attributes

const std::shared_ptr<const drivers::RobosenseSensorConfiguration> sensor_configuration_

Configuration for this decoder.

SensorT sensor_ = {}

The sensor definition, used for return mode and time offset handling.

SensorT::angle_corrector_t angle_corrector_

Decodes azimuth/elevation angles given calibration/correction data.

NebulaPointCloudPtr decode_pc_

The point cloud new points get added to.

NebulaPointCloudPtr output_pc_

The point cloud that is returned when a scan is complete.

SensorT::packet_t packet_

The last decoded packet.

int last_phase_

The last azimuth processed.

uint64_t output_scan_timestamp_ns_

The timestamp of the last completed scan in nanoseconds.

uint64_t decode_scan_timestamp_ns_

The timestamp of the scan currently in progress.

bool has_scanned_

Whether a full scan has been processed.

rclcpp::Logger logger_