ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You need a tf broadcaster, check this tutorial is very easy to understand: tf broadcaster
The IMU message publish "orientation" which is a geometry_msgs/Quaternion so, in the node where you do the tf broadcast just add a subscriber to this IMU message, get the orientation, transform it using tf::quaternionMsgToTF(geometry_msgs::Quaternion, tf::Quaternion) and pass it straight to the transform.setRotation(tf::Quaternion)
Take into account you have to choose well your frame_id's, if you have already a tf with the urdf file which joins laser and imu, then you should transform from, for example, "world" to "imu_link".
Resuming you need a node with a subscriber to the IMU message and a tf broadcaster. In this node you have to transform the imu message orientation to a tf::Quaternion and then do the rotation and publish it.