how to write TF broadcasts in a bag (with the rosbag API)
This is a follow up on some discussion going on here: http://answers.ros.org/question/2826/simulating-sensor-data-problem-with-rosbag-and Since the discussion has drifted away from the original topic I am posting a new question...
I am writing a simulation that simulates a moving vehicle and outputs ground truth position (as an Odometry message on topic "ground_truth" and as a TF: ground_truth -> base_link), and simulated sensor data with a controllable amount of noise. I want to use it to test my localization algorithms (EKF).
The simulator can run both in real time and in bag mode. In real time mode, it publishes the messages on topics, and everything is fine. In bag mode, it runs as fast as possible and writes the messages directly into a bag file, using the rosbag C++ API.
The only thing that is missing is how to write TF messages in the rosbag. I tried writing them to the bag on topic /tf but I got the following problems:
1) Writing tf/StamedTransform (same as what I broadcast in real time mode) I get the following error at compilation: ‘const class tf::StampedTransform’ has no member named ‘__getDataType’
2) Writing geometry_msgs::TransformStamped I convert using tf::transformStampedTFToMsg. No compilation errors. But in rviz, after setting the Fixed Frame to /ground_truth, I get the following warning: "no tf data. Fixed Frame [/ground_truth] does not exist." And the drop down menu to choose the fixed frame is empty.
So I do I proceed to store TF messages / transforms into the bag?