Ask Your Question

"what(): can't subtract times with different time sources [2 != 1]" error when spawning diff_drive_controller on ros2_control

asked 2021-09-29 04:52:22 -0500

byeongkyu gravatar image

updated 2021-09-29 05:10:39 -0500

gvdhoorn gravatar image

I'm using ros2_control to control my robot. After exectue controller_manager, when I spawned "diff_drive_controller" I have this error.

[ros2_control_node-1] [INFO] [1632907663.808010997] [controller_manager]: update rate is 50 Hz
[ros2_control_node-1] [INFO] [1632907695.226861708] [controller_manager]: Loading controller 'diff_drive_controller'
[ros2_control_node-1] [INFO] [1632907695.255700365] [controller_manager]: Configuring controller 'diff_drive_controller'
[ros2_control_node-1] terminate called after throwing an instance of 'std::runtime_error'
[ros2_control_node-1]   what():  can't subtract times with different time sources [2 != 1]

another terminal shown as

$ ros2 control load_controller --set-state start diff_drive_controller
Sucessfully loaded controller diff_drive_controller into state active

I tried add parameter use_sim_time: True to controller_manager, diff_drive_controller.. but result is same.. How can I solve this error?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-10-06 02:50:59 -0500

byeongkyu gravatar image

It was solved by updating ros2_control packages.

edit flag offensive delete link more


This should not actually be solved by solely updating the packages. This can still be an issue, depending which time-source is used in a commanding package.

destogl gravatar image destogl  ( 2021-11-29 08:35:44 -0500 )edit

Building ros2_control and (for simulation) gazebo_ros2_control from source solved the issue for me too (diff_drive_controller can be installed via apt)... Crash didn't occur no matter whether controller_manager spawner node was launched with use_sim_time:=True or False. Looks like some kind of incompatibility between packages in current Galactic sync.

afrixs gravatar image afrixs  ( 2021-12-08 01:19:06 -0500 )edit

answered 2021-11-29 02:46:07 -0500

Bence Magyar gravatar image

More on this though: we have been working towards resolving this and there's a new batch of safety measures we are planning to add to all velocity-based controllers to ensure the command can time out at some point. Different time sources are making this tricky

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2021-09-29 04:52:22 -0500

Seen: 161 times

Last updated: Nov 29 '21