Ask Your Question

Robot localization timestamp crash

asked 2020-01-24 12:10:11 -0500

Eduard gravatar image

I'm trying to use the ekf_localization_node in ROS2, but it is crashing because of "different time sources" when subtracting timestamps. I'm using the node-clock timestamp for the messages (inside the node: this->now()). The only solution that worked, was to use the simulated time. Is there a possibility to use the "real"-time or do I always have to use the sim-time?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-24 18:08:36 -0500

Can you be more specific in how this is running?

It is true that they must be from the same source. So if the timestamp from the messages is from the real-world, RL needs to be running on a real-world clock too. They cannot be mixed and matched. IMO that was one really smart feature they added in ROS2 and lets me know if I've messed something up with clocks without having to guess.

edit flag offensive delete link more


I tried to run one instance of the ekf_localization_node, one node for publishing odometry data and one node for imu data.

At first I launched the ekf_localization_node with the parameter 'use_sim_time: false'. The odometry node is publishing odom-messages with a timestamp created like this: this->now(). After launching the odometry node I received a few odometry/filtered-messages from the ekf_localization_node, but then it crashes after a few milliseconds: can't subtract times with different time sources.

Eduard gravatar image Eduard  ( 2020-01-25 10:56:19 -0500 )edit

And are the timestamps from the messages in simulation time or in real time?

I think the error is relatively straight forward -- your system must have all the components running on the same clock.

stevemacenski gravatar image stevemacenski  ( 2020-01-25 18:19:34 -0500 )edit

The timestamps are in real time. That's why I don't understand the error message... All components should be using the system clock.

Eduard gravatar image Eduard  ( 2020-01-26 12:27:38 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-01-24 12:10:11 -0500

Seen: 419 times

Last updated: Jan 24 '20