Skip to content

Class nebula::drivers::HesaiDecoder

template <typename SensorT>

ClassList > nebula > drivers > HesaiDecoder

  • #include <hesai_decoder.hpp>

Inherits the following classes: nebula::drivers::HesaiScanDecoder

Public Functions

Type Name
HesaiDecoder (const std::shared_ptr< const HesaiSensorConfiguration > & sensor_configuration, const std::shared_ptr< const typename SensorT::angle_corrector_t::correction_data_t > & correction_data)
Constructor.
virtual std::tuple< drivers::NebulaPointCloudPtr, double > getPointcloud () override
Returns the point cloud and timestamp of the last scan.
virtual bool hasScanned () override
Indicates whether one full scan is ready.
virtual int unpack (const std::vector< uint8_t > & packet) override
Parses PandarPacket and add its points to the point cloud.

Public Functions inherited from nebula::drivers::HesaiScanDecoder

See nebula::drivers::HesaiScanDecoder

Type Name
HesaiScanDecoder (HesaiScanDecoder && c) = delete
HesaiScanDecoder (const HesaiScanDecoder & c) = delete
HesaiScanDecoder () = default
virtual std::tuple< drivers::NebulaPointCloudPtr, double > getPointcloud () = 0
Returns the point cloud and timestamp of the last scan.
virtual bool hasScanned () = 0
Indicates whether one full scan is ready.
HesaiScanDecoder & operator= (HesaiScanDecoder && c) = delete
HesaiScanDecoder & operator= (const HesaiScanDecoder & c) = delete
virtual int unpack (const std::vector< uint8_t > & packet) = 0
Parses PandarPacket and add its points to the point cloud.
virtual ~HesaiScanDecoder () = default

Protected Attributes

Type Name
SensorT::angle_corrector_t angle_corrector_
Decodes azimuth/elevation angles given calibration/correction data.
std::array< std::array< int, SensorT::packet_t::N_BLOCKS >, SensorT::packet_t::MAX_RETURNS > block_firing_offset_ns_
For each return mode, the firing offset of each block relative to its packet in nanoseconds.
std::array< int, SensorT::packet_t::N_CHANNELS > channel_firing_offset_ns_
For each channel, its firing offset relative to the block in nanoseconds.
NebulaPointCloudPtr decode_pc_
The point cloud new points get added to.
uint64_t decode_scan_timestamp_ns_ = = 0
The timestamp of the scan currently in progress.
bool has_scanned_ = = false
Whether a full scan has been processed.
uint32_t last_azimuth_ = = 0
rclcpp::Logger logger_
NebulaPointCloudPtr output_pc_
The point cloud that is returned when a scan is complete.
uint64_t output_scan_timestamp_ns_ = = 0
The timestamp of the last completed scan in nanoseconds.
SensorT::packet_t packet_
The last decoded packet.
ScanCutAngles scan_cut_angles_
SensorT sensor_ = {}
The sensor definition, used for return mode and time offset handling.
const std::shared_ptr< const drivers::HesaiSensorConfiguration > sensor_configuration_
Configuration for this decoder.

Protected Functions

Type Name
void convertReturns (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.
float getDistance (const typename SensorT::packet_t::body_t::block_t::unit_t & unit)
Get the distance of the given unit in meters.
uint32_t getPointTimeRelative (uint64_t scan_timestamp_ns, 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.
bool parsePacket (const std::vector< uint8_t > & packet)
Validates and parse PandarPacket. Currently only checks size, not checksums etc.

Public Functions Documentation

function HesaiDecoder

Constructor.

inline explicit nebula::drivers::HesaiDecoder::HesaiDecoder (
    const std::shared_ptr< const HesaiSensorConfiguration > & sensor_configuration,
    const std::shared_ptr< const typename SensorT::angle_corrector_t::correction_data_t > & correction_data
) 

Parameters:

  • sensor_configuration SensorConfiguration for this decoder
  • correction_data Calibration data for this decoder

function getPointcloud

Returns the point cloud and timestamp of the last scan.

inline virtual std::tuple< drivers::NebulaPointCloudPtr, double > nebula::drivers::HesaiDecoder::getPointcloud () override

Returns:

A tuple of point cloud and timestamp in nanoseconds

Implements nebula::drivers::HesaiScanDecoder::getPointcloud


function hasScanned

Indicates whether one full scan is ready.

inline virtual bool nebula::drivers::HesaiDecoder::hasScanned () override

Returns:

Whether a scan is ready

Implements nebula::drivers::HesaiScanDecoder::hasScanned


function unpack

Parses PandarPacket and add its points to the point cloud.

inline virtual int nebula::drivers::HesaiDecoder::unpack (
    const std::vector< uint8_t > & packet
) override

Parameters:

  • packet The incoming PandarPacket

Returns:

The last azimuth processed

Implements nebula::drivers::HesaiScanDecoder::unpack


Protected Attributes Documentation

variable angle_corrector_

SensorT::angle_corrector_t nebula::drivers::HesaiDecoder< SensorT >::angle_corrector_;

variable block_firing_offset_ns_

std::array<std::array<int, SensorT::packet_t::N_BLOCKS>, SensorT::packet_t::MAX_RETURNS> nebula::drivers::HesaiDecoder< SensorT >::block_firing_offset_ns_;

variable channel_firing_offset_ns_

std::array<int, SensorT::packet_t::N_CHANNELS> nebula::drivers::HesaiDecoder< SensorT >::channel_firing_offset_ns_;

variable decode_pc_

NebulaPointCloudPtr nebula::drivers::HesaiDecoder< SensorT >::decode_pc_;

variable decode_scan_timestamp_ns_

uint64_t nebula::drivers::HesaiDecoder< SensorT >::decode_scan_timestamp_ns_;

variable has_scanned_

bool nebula::drivers::HesaiDecoder< SensorT >::has_scanned_;

variable last_azimuth_

uint32_t nebula::drivers::HesaiDecoder< SensorT >::last_azimuth_;

variable logger_

rclcpp::Logger nebula::drivers::HesaiDecoder< SensorT >::logger_;

variable output_pc_

NebulaPointCloudPtr nebula::drivers::HesaiDecoder< SensorT >::output_pc_;

variable output_scan_timestamp_ns_

uint64_t nebula::drivers::HesaiDecoder< SensorT >::output_scan_timestamp_ns_;

variable packet_

SensorT::packet_t nebula::drivers::HesaiDecoder< SensorT >::packet_;

variable scan_cut_angles_

ScanCutAngles nebula::drivers::HesaiDecoder< SensorT >::scan_cut_angles_;

variable sensor_

SensorT nebula::drivers::HesaiDecoder< SensorT >::sensor_;

variable sensor_configuration_

const std::shared_ptr<const drivers::HesaiSensorConfiguration> nebula::drivers::HesaiDecoder< SensorT >::sensor_configuration_;

Protected Functions Documentation

function convertReturns

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.

inline void nebula::drivers::HesaiDecoder::convertReturns (
    size_t start_block_id,
    size_t n_blocks
) 

Parameters:

  • start_block_id The first block in the group of returns
  • n_blocks The number of returns in the group (has to align with the n_returns field in the packet footer)

function getDistance

inline float nebula::drivers::HesaiDecoder::getDistance (
    const typename SensorT::packet_t::body_t::block_t::unit_t & unit
) 

function getPointTimeRelative

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

inline uint32_t nebula::drivers::HesaiDecoder::getPointTimeRelative (
    uint64_t scan_timestamp_ns,
    uint64_t packet_timestamp_ns,
    size_t block_id,
    size_t channel_id
) 

Parameters:

  • scan_timestamp_ns Start timestamp of the current scan in nanoseconds
  • packet_timestamp_ns The timestamp of the current PandarPacket in nanoseconds
  • block_id The block index of the point
  • channel_id The channel index of the point

function parsePacket

Validates and parse PandarPacket. Currently only checks size, not checksums etc.

inline bool nebula::drivers::HesaiDecoder::parsePacket (
    const std::vector< uint8_t > & packet
) 

Parameters:

  • packet The incoming PandarPacket

Returns:

Whether the packet was parsed successfully



The documentation for this class was generated from the following file nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp