Skip to content

Conversation

@tschuette22
Copy link

As this came back up for me I'm opening a pull request. It is based on #132, but without obsolete parts.

This PR enhances the driver by adding the option to publish the heading as a sensor_msgs/Imu message in ROS 2.

Changes

Introduced a new parameter:

publishIMU (bool, default: false) – enables or disables publishing of IMU messages.

Added functionality to publish an Imu message on heading/imu containing heading data when publishIMU is set to true.

Maintains existing behavior when the parameter is not enabled (no breaking changes).

Motivation

Certain applications require heading information to be available in the standard sensor_msgs/Imu format (e.g. robot_localization), allowing for easier integration with downstream components that already subscribe to IMU topics. This change provides that option without affecting users who only need the original GPS data.

Testing

  • Verified that IMU messages are correctly published when publishIMU=true.
  • Checked compatibility with downstream nodes consuming sensor_msgs/Imu.

Notes

The IMU message currently includes heading information derived from the NMEA data. Other IMU fields (e.g., linear acceleration, angular velocity) remain unset, just like the covariance matrix.

additional testing with further devices is very welcome!

@bpesun
Copy link

bpesun commented Aug 27, 2025

Thanks for your code.When calculating the quaternion for the newly generated IMU orientation, why not directly copy the quaternion from the heading, but instead recalculate a new value (q_imu = quaternion_from_euler(0, 0, -math.radians(data['heading']) + math.pi/2))? Thank you.

@rolker
Copy link

rolker commented Oct 20, 2025

When calculating the quaternion for the newly generated IMU orientation, why not directly copy the quaternion from the heading, but instead recalculate a new value (q_imu = quaternion_from_euler(0, 0, -math.radians(data['heading']) + math.pi/2))? Thank you.

It seems like the author is calculating a quaternion that complies to REP 103. The heading output is reporting a human friendly clockwise rotation from north rather than a counter-clockwise rotation from east.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants