Ask Your Question

Revision history [back]

Yes, the distinction is purely for convenience and compatibility with other nodes. If someone wants to use an existing IMU driver, that driver will almost certainly output a sensor_msgs/Imu message. Similarly, if they want to use an existing robot controller, that node will likely produce a nav_msgs/Odometry message. As an odometry message is simply a geometry_msgs/PoseWithCovarianceStamped combined with a geometry_msgs/TwistWithCovarianceStamped, it made sense to support those as well. The fact that we have the same settings for each sensor (e.g., odom0_config has the same form as twist0_config), even if that sensor doesn't measure every variable, is really just to eliminate confusion.

Internally, an odometry message is simply split into its constituent pose and twist messages, and then passed to the same preprocessing functions as the pose and twist messages would be if they had come from an external source. IMU messages get the same treatment, though there is a small amount of additional preprocessing that occurs with them, and they also contain acceleration data, which has its own preprocessing method.

Your supposition is largely true: you can place data in more or less any message you want, though I'd be careful with IMU data. Ordinarily, all pose data gets transformed into the value of your world_frame parameter (map or odom), and all velocity data gets transformed into the frame specified by the base_link_frame parameter. The transformed measurements are then fused with the state estimate. IMUs get special treatment. When a user mounts an IMU onto the robot, they typically specify the IMU's position as a transform w.r.t. the base_link frame (e.g., a static transform from base_link to imu). For IMU data, we need to use that transform to transform the orientation data, which means we are not going to transform it into the world_frame, but rather into base_link.

In any case, if you have data from an IMU, I would suggest feeding it to the filter as an IMU message. If you have pose or twist data, you can use whatever message type suits you.