I am using rosbag api to record rgb, depth and imu data coming off a robot. For an offline Visual Odometry experiment, I am in need of synchronizing RGB data with the imu data at the correct timesteps. This is because the IMU in our robot updated much faster than the RGB camera thus we have over 1000 entries for IMU data whereas we have only 136 images recorded within the same duration.
These are the information on the rosbag collected
- Number of topics - 3 /rgb_image, /depth, imu
- Time - 20s
I plan on iterating over each timestep and extracting the IMU data that is closest to the chosen picture's timestep. The end goal is to create a new rosbag with the synchronized data.
My question is how do I iterate over each image in the correct time order from the rosbag file using Python?