GpuLidarSensor Class Reference

GpuLidar Sensor Class. More...

#include <GpuLidarSensor.hh>

Public Member Functions

 GpuLidarSensor ()
 constructor
 
virtual ~GpuLidarSensor ()
 destructor
 
virtual gz::common::ConnectionPtr ConnectNewLidarFrame (std::function< void(const float *_scan, unsigned int _width, unsigned int _heighti, unsigned int _channels, const std::string &)> _subscriber) override
 Connect function pointer to internal GpuRays callback.
 
virtual bool CreateLidar () override
 Create Lidar sensor.
 
gz::rendering::GpuRaysPtr GpuRays () const
 Get Gpu Rays object used in the sensor.
 
virtual bool HasConnections () const override
 Check if there are any subscribers.
 
gz::math::Angle HFOV () const
 Get the horizontal field of view of the laser sensor.
 
virtual bool Init () override
 Initialize values in the sensor.
 
bool IsHorizontal () const
 Gets if sensor is horizontal.
 
virtual bool Load (const sdf::Sensor &_sdf) override
 Load the sensor based on data from an sdf::Sensor object.
 
virtual bool Load (sdf::ElementPtr _sdf) override
 Load sensor sata from SDF.
 
double RayCountRatio () const
 Return the ratio of horizontal ray count to vertical ray count.
 
void RemoveGpuRays (gz::rendering::ScenePtr _scene)
 Remove sensor from scene.
 
void SetScene (gz::rendering::ScenePtr _scene) override
 Makes possible to change sensor scene.
 
virtual bool Update (const std::chrono::steady_clock::duration &_now) override
 Force the sensor to generate data.
 
gz::math::Angle VFOV () const
 Get the vertical field-of-view.
 
- Public Member Functions inherited from Lidar
 Lidar ()
 constructor
 
virtual ~Lidar ()
 destructor
 
gz::math::Angle AngleMax () const
 Get the maximum angle.
 
gz::math::Angle AngleMin () const
 Get the minimum angle.
 
double AngleResolution () const
 Get radians between each range.
 
void ApplyNoise ()
 Apply noise to the laser buffer, if noise has been configured. This should be called before PublishLidarScan if you want the scan data to contain noise.
 
int Fiducial (const unsigned int _index) const
 Get detected fiducial value for a ray. Warning: If you are accessing all the ray data in a loop it's possible that the Ray will update in the middle of your access loop. This means some data will come from one scan, and some from another scan. You can solve this problem by using SetActive(false) <your accessor loop> SetActive(true).
 
double HorzFOV () const
 Get the horizontal field of view of the laser sensor.
 
virtual bool IsActive () const
 
bool IsHorizontal () const
 Gets if sensor is horizontal.
 
virtual bool PublishLidarScan (const std::chrono::steady_clock::duration &_now)
 Publish LaserScan message.
 
double Range (const int _index) const
 Get detected range for a ray. Warning: If you are accessing all the ray data in a loop it's possible that the Ray will update in the middle of your access loop. This means some data will come from one scan, and some from another scan. You can solve this problem by using SetActive(false) <your accessor loop> SetActive(true).
 
unsigned int RangeCount () const
 Get the range count.
 
double RangeCountRatio () const
 Return the ratio of horizontal range count to vertical range count.
 
double RangeMax () const
 Get the maximum range.
 
double RangeMin () const
 Get the minimum range.
 
double RangeResolution () const
 Get the range resolution If RangeResolution is 1, the number of simulated rays is equal to the number of returned range readings. If it's less than 1, fewer simulated rays than actual returned range readings are used, the results are interpolated from two nearest neighbors, and vice versa.
 
void Ranges (std::vector< double > &_ranges) const
 Get all the ranges.
 
unsigned int RayCount () const
 Get the ray count.
 
double RayCountRatio () const
 Return the ratio of horizontal ray count to vertical ray count.
 
double Retro (const int _index) const
 Get detected retro (intensity) value for a ray. Warning: If you are accessing all the ray data in a loop it's possible that the Ray will update in the middle of your access loop. This means some data will come from one scan, and some from another scan. You can solve this problem by using SetActive(false) <your accessor loop> SetActive(true).
 
void SetAngleMax (const double _angle)
 Set the scan maximum angle.
 
void SetAngleMin (const double _angle)
 Set the scan minimum angle.
 
void SetParent (const std::string &_parent) override
 Initialize values in the sensor.
 
void SetVerticalAngleMax (const double _angle)
 Set the vertical scan line top angle.
 
void SetVerticalAngleMin (const double _angle)
 Set the vertical scan bottom angle.
 
double VertFOV () const
 Get the vertical field-of-view.
 
gz::math::Angle VerticalAngleMax () const
 Get the vertical scan line top angle.
 
gz::math::Angle VerticalAngleMin () const
 Get the vertical scan bottom angle.
 
double VerticalAngleResolution () const
 Get the vertical angle in radians between each range.
 
unsigned int VerticalRangeCount () const
 Get the vertical scan line count.
 
unsigned int VerticalRayCount () const
 Get the vertical scan line count.
 
uint32_t VisibilityMask () const
 Get the visibility mask.
 
- Public Member Functions inherited from RenderingSensor
virtual ~RenderingSensor ()
 destructor
 
bool ManualSceneUpdate () const
 Get whether the scene graph is updated manually. Defaults to false.
 
void Render ()
 Render update. This performs the actual render operation.
 
rendering::ScenePtr Scene () const
 Get the rendering scene.
 
void SetManualSceneUpdate (bool _manual)
 Set whether to update the scene graph manually. If set to true, it is expected that rendering::Scene::PreRender is called manually before calling Render()
 
virtual void SetScene (rendering::ScenePtr _scene)
 Set the rendering scene.
 
- Public Member Functions inherited from Sensor
virtual ~Sensor ()
 destructor
 
void AddSequence (gz::msgs::Header *_msg, const std::string &_seqKey="default")
 Add a sequence number to a gz::msgs::Header. This function can be called by a sensor that wants to add a sequence number to a sensor message in order to have improved accountability for generated sensor data.
 
bool EnableMetrics () const
 Get flag state for enabling performance metrics publication.
 
std::string FrameId () const
 FrameId.
 
bool HasPendingTrigger () const
 Whether the sensor has a pending trigger.
 
SensorId Id () const
 Get the sensor's ID.
 
bool IsActive () const
 Get whether the sensor is enabled or not.
 
bool IsTriggered () const
 Whether the sensor trigger mode is enabled.
 
std::string Name () const
 Get name.
 
std::chrono::steady_clock::duration NextDataUpdateTime () const
 Return the next time the sensor will generate data.
 
std::string Parent () const
 Get parent link of the sensor.
 
gz::math::Pose3d Pose () const
 Get the current pose.
 
void PublishMetrics (const std::chrono::duration< double > &_now)
 Publishes information about the performance of the sensor. This method is called by Update().
 
sdf::ElementPtr SDF () const
 Get the SDF used to load this sensor.
 
void SetActive (bool _active)
 Enable or disable the sensor. Disabled sensors will not generate or publish data unless Update is called with the '_force' argument set to true.
 
void SetEnableMetrics (bool _enableMetrics)
 Set flag to enable publishing performance metrics.
 
void SetFrameId (const std::string &_frameId)
 Set Frame ID of the sensor.
 
void SetNextDataUpdateTime (const std::chrono::steady_clock::duration &_time)
 Manually set the next time the sensor will generate data Useful for accomodating jumps backwards in time as well as specifying updates for non-uniformly updating sensors.
 
void SetPose (const gz::math::Pose3d &_pose)
 Update the pose of the sensor.
 
bool SetTopic (const std::string &_topic)
 Set topic where sensor data is published.
 
bool SetTriggered (bool _triggered, const std::string &_triggerTopic="")
 Enable or disable triggered mode. In this mode,.
 
void SetUpdateRate (const double _hz)
 Set the update rate of the sensor. An update rate of zero means that the sensor is updated every cycle. It's zero by default.
 
std::string Topic () const
 Get topic where sensor data is published.
 
bool Update (const std::chrono::steady_clock::duration &_now, const bool _force)
 Update the sensor.
 
double UpdateRate () const
 Get the update rate of the sensor.
 

Additional Inherited Members

- Public Attributes inherited from Lidar
bool initialized = false
 true if Load() has been called and was successful
 
float * laserBuffer = nullptr
 Raw buffer of laser data.
 
std::mutex lidarMutex
 Just a mutex for thread safety.
 
- Protected Member Functions inherited from Lidar
virtual void Fini ()
 Finalize the ray.
 
- Protected Member Functions inherited from RenderingSensor
 RenderingSensor ()
 constructor
 
void AddSensor (rendering::SensorPtr _sensor)
 Add a rendering::Sensor. Its render updates will be handled by this base class.
 
- Protected Member Functions inherited from Sensor
 Sensor ()
 constructor
 

Detailed Description

GpuLidar Sensor Class.

This class creates laser scans using the GPU. It's measures the range from the origin of the center to points on the visual geometry in the scene.

It offers both a gz-transport interface and a direct C++ API to access the image data. The API works by setting a callback to be called with image data.

Constructor & Destructor Documentation

🔗GpuLidarSensor()

constructor

🔗~GpuLidarSensor()

virtual ~GpuLidarSensor ( )
virtual

destructor

Member Function Documentation

🔗ConnectNewLidarFrame()

virtual gz::common::ConnectionPtr ConnectNewLidarFrame ( std::function< void(const float *_scan, unsigned int _width, unsigned int _heighti, unsigned int _channels, const std::string &)>  _subscriber)
overridevirtual

Connect function pointer to internal GpuRays callback.

Returns
gz::common::Connection pointer

Reimplemented from Lidar.

🔗CreateLidar()

virtual bool CreateLidar ( )
overridevirtual

Create Lidar sensor.

Reimplemented from Lidar.

🔗GpuRays()

gz::rendering::GpuRaysPtr GpuRays ( ) const

Get Gpu Rays object used in the sensor.

Returns
Pointer to gz::rendering::GpuRays

🔗HasConnections()

virtual bool HasConnections ( ) const
overridevirtual

Check if there are any subscribers.

Returns
True if there are subscribers, false otherwise

Reimplemented from Lidar.

🔗HFOV()

gz::math::Angle HFOV ( ) const

Get the horizontal field of view of the laser sensor.

Returns
The horizontal field of view of the laser sensor.

🔗Init()

virtual bool Init ( )
overridevirtual

Initialize values in the sensor.

Returns
True on success

Reimplemented from Lidar.

🔗IsHorizontal()

bool IsHorizontal ( ) const

Gets if sensor is horizontal.

Returns
True if horizontal, false if not

🔗Load() [1/2]

virtual bool Load ( const sdf::Sensor &  _sdf)
overridevirtual

Load the sensor based on data from an sdf::Sensor object.

Parameters
[in]_sdfSDF Sensor parameters.
Returns
true if loading was successful

Reimplemented from Lidar.

🔗Load() [2/2]

virtual bool Load ( sdf::ElementPtr  _sdf)
overridevirtual

Load sensor sata from SDF.

Parameters
[in]_sdfSDF used
Returns
True on success

Reimplemented from Lidar.

🔗RayCountRatio()

double RayCountRatio ( ) const

Return the ratio of horizontal ray count to vertical ray count.

A ray count is the number of simulated rays. Whereas a range count is the total number of data points returned. When range count != ray count, then values are interpolated between rays.

🔗RemoveGpuRays()

void RemoveGpuRays ( gz::rendering::ScenePtr  _scene)

Remove sensor from scene.

Parameters
[in]_sceneused with the sensor

🔗SetScene()

void SetScene ( gz::rendering::ScenePtr  _scene)
override

Makes possible to change sensor scene.

Parameters
[in]_sceneused with the sensor

🔗Update()

virtual bool Update ( const std::chrono::steady_clock::duration &  _now)
overridevirtual

Force the sensor to generate data.

Parameters
[in]_nowThe current time
Returns
true if the update was successfull

Reimplemented from Lidar.

🔗VFOV()

gz::math::Angle VFOV ( ) const

Get the vertical field-of-view.

Returns
Vertical field of view.

The documentation for this class was generated from the following file: