Cartographer Check failed: time >= imu_tracker->time()
I am working in roscpp and publishing odometry data to a cartographer-ros node. Two classes are responsible for publishing this data. For safety reasons, it is sometimes necessary to call the destructor on the primary class and post still data (an odometry pose that uses the same values to let ros know the robot is standing still) from the other class.
When I switch initially it works correctly, however when I switch back to the primary class (and stop posting from the secondary class) I get this error message:
F0403 09:40:53.584676 2898 pose_extrapolator.cc:229] Check failed: time >= imu_tracker->time() (636898956535400370 vs. 636898956535779478)
*** Check failure stack trace: ***
@ 0x7f8efa52c8 cartographer::mapping::PoseExtrapolator::ExtrapolateRotation()
@ 0x7f8efa55dc cartographer::mapping::PoseExtrapolator::AddOdometryData()
@ 0x7f8f08e468 cartographer_ros::Node::HandleOdometryMessage()
I am having a hard time locating the cause of this. It appears to me that either the odom topic or imu topic are running into problems regarding their timestamps, but I have checked the rostopic echo output and the timestamps appear to be in the correct order.
This reads like an xy-problem:
Is your goal to publish different messages based on some (external) event? If so, if you can describe your current approach better, and your requirements, we might be able to suggest an alternative.
My overall goal is to continuously post odometry/imu data to cartographer. My immediate issue is the transition between the classes causes the error above.
I may call the destructor on class A, this is the class that posts the messages to cartographer while the robot is operating normally. However, cartographer needs to have data sent to it at all times to work properly. So I start posting from class B by copying each message that is sent to cartographer and continuously posting the most recent message upon destruction of class A. When class A is reconstructed, I want to stop posting messages from the class B and return to posting live data from class A. The transition from class A to class B works well, but the transition from class B back to class A causes this error.
Unfortunately, I can't move the live data posting to class ...(more)
A more ROS/component based approach could be something like this: a node B that subscribes to the topics that carry the msgs that you want to "fake" and then use a mux that switches between the real topics and the ones from node B. Switching the mux is part of your (higher-level) coordination system.
Edit: it's still not completely clear why "the most recent message" must be sent to Cartographer when the robot "isn't operating normally". That I believe is the xy-problem here. But let's not go into that now.
If Cartographer is complaining then wouldn't it make sense to debug that? If the messages you are sending from your class
A
and classB
are identical (save the timestamps most likely), then either you're violating some (implicit) assumption in Cartographer, or there is an actual bug in Cartographer. Both cases would seem to ...(more)