Description

Combines the latest data of an accelerometer + gyroscope (+ magnetometer) handler into one sensor_msgs/msg/Imu.

The sub-handlers are registered with the manager separately (they tick and publish independently); this handler just reads their most recent extracted values. Set the sub-handlers' rate >= this handler's rate so their data is fresh.

#include <ChROSIMUHandler.h>

Inherits chrono::ros::ChROSHandler.

Public Member Functions

 ChROSIMUHandler (double update_rate, const std::string &topic_name, const std::string &frame_id="imu")
 
virtual bool Initialize (ChROSBridge &bridge) override
 Creates the Imu publisher.
 
void SetAccelerometerHandler (std::shared_ptr< ChROSAccelerometerHandler > accel_handler)
 Set the accelerometer sub-handler (required). Its rate should be >= this handler's.
 
void SetGyroscopeHandler (std::shared_ptr< ChROSGyroscopeHandler > gyro_handler)
 Set the gyroscope sub-handler (required). Its rate should be >= this handler's.
 
void SetMagnetometerHandler (std::shared_ptr< ChROSMagnetometerHandler > mag_handler)
 Set the magnetometer sub-handler (required for presence, though its data is not packed).
 

Protected Member Functions

virtual void Tick (double time) override
 Assembles one Imu message from the sub-handlers' latest values and publishes it.
 

Constructor & Destructor Documentation

◆ ChROSIMUHandler()

chrono::ros::ChROSIMUHandler::ChROSIMUHandler ( double  update_rate,
const std::string &  topic_name,
const std::string &  frame_id = "imu" 
)
Parameters
update_ratepublish rate (Hz, sim time); 0 = every step.
topic_nameImu topic to publish on.
frame_idheader frame_id stamped into the message.

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_ros/handlers/sensor/ChROSIMUHandler.h
  • /builds/uwsbel/chrono/src/chrono_ros/handlers/sensor/ChROSIMUHandler.cpp