Skip to content

Set use_sim_time through CM NodeOptions #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2025
Merged

Set use_sim_time through CM NodeOptions #533

merged 3 commits into from
Mar 31, 2025

Conversation

saikishor
Copy link
Member

No description provided.

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gz_ros2_control was broken since ros-controls/ros2_control#2046
I have to see why the downstream build jobs there haven't failed.

@christophfroehlich
Copy link
Contributor

@Mergifyio backport jazzy

Copy link
Contributor

mergify bot commented Mar 28, 2025

backport jazzy

✅ Backports have been created

@ahcorde ahcorde merged commit 0e38d95 into rolling Mar 31, 2025
5 checks passed
@ahcorde ahcorde deleted the saikishor-patch-1 branch March 31, 2025 13:09
mergify bot pushed a commit that referenced this pull request Mar 31, 2025
Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit 0e38d95)
ahcorde pushed a commit that referenced this pull request Mar 31, 2025
Co-authored-by: Christoph Fröhlich <[email protected]>
(cherry picked from commit 0e38d95)

Co-authored-by: Sai Kishor Kothakota <[email protected]>
@zacharyyamaoka
Copy link

Hi ROS2 Control team,

I am currently trying to use gz_ros2_control on Jazzy.

Previously I was getting this error:

[gazebo-1] [WARN] [1744209681.014324598] [gz_ros_control]:  Desired controller update period (0.002 s) is slower than the gazebo simulation period (0.0005 s).
[gazebo-1] terminate called after throwing an instance of 'std::runtime_error'
[gazebo-1]   what():  can't compare times with different time sources
[gazebo-1] Stack trace (most recent call last) in thread 904995:
[gazebo-1] #14   Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 
[gazebo-1] #13   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb0c4729c3b, in 
[gazebo-1] #12   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb0c469caa3, in 
[gazebo-1] #11   Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7fb0bececdb3, in 
[gazebo-1] #10   Object "/opt/ros/jazzy/opt/gz_sim_vendor/lib/libgz-sim8.so.8", at 0x7fb0bdd4ed45, in 
[gazebo-1] #9    Object "/home/bam/control_ws/install/gz_ros2_control/lib/libgz_ros2_control-system.so", at 0x7fb07fd717c5, in gz_ros2_control::GazeboSimROS2ControlPlugin::PostUpdate(gz::sim::v8::UpdateInfo const&, gz::sim::v8::EntityComponentManager const&)
[gazebo-1] #8    Object "/home/bam/control_ws/install/controller_manager/lib/libcontroller_manager.so", at 0x7fb07f886561, in controller_manager::ControllerManager::update(rclcpp::Time const&, rclcpp::Duration const&)
[gazebo-1] #7    Object "/opt/ros/jazzy/lib/librclcpp.so", at 0x7fb07eae2a90, in 
[gazebo-1] #6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7fb0becbb390, in __cxa_throw
[gazebo-1] #5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7fb0beca5a54, in std::terminate()
[gazebo-1] #4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7fb0becbb0d9, in 
[gazebo-1] #3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7fb0beca5ff4, in 
[gazebo-1] #2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb0c46288fe, in abort
[gazebo-1] #1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb0c464527d, in gsignal
[gazebo-1] #0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fb0c469eb2c, in pthread_kill
[gazebo-1] Aborted (Signal sent by tkill() 904738 1000)
[gazebo-1] 0mLoaded plugin [EntityTree] from path 

Which I found was caused by use_sim_time not being set properly:

[gazebo-1] [INFO] [1744209678.974210234] [gz_ros_control]: Loading controller_manager
[gazebo-1] [INFO] [1744209679.000651931] [controller_manager]: Using Steady (Monotonic) clock for triggering controller manager cycles.

This change seems to have fixed that issue, but now I am getting these errors:

[gazebo-1] [WARN] [1744219953.983130822] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available
[gazebo-1] [WARN] [1744219954.983370543] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available
[gazebo-1] [WARN] [1744219955.984920823] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available
[gazebo-1] [WARN] [1744219956.986762555] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available
[gazebo-1] [WARN] [1744219957.988553717] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available
[gazebo-1] [WARN] [1744219958.988554350] [controller_manager]: No clock received, using time argument instead! Check your node's clock configuration (use_sim_time parameter) and if a valid clock source is available

I will be investigating further... (i am new to gazebo) so not sure the effect. but just letting you guys know I am looking at this right now!

best,

Zach :)

@zacharyyamaoka
Copy link

Ok it seems the issue is related to: #137

using the bridge to get gazebo to publish to the /clock is likely the fix

@zacharyyamaoka
Copy link

Yay! ok all seems to be working now :)

I think the documentation should be updated if bridge is needed for it to work...

Reading through this: https://gazebosim.org/docs/latest/ros2_launch_gazebo/ I got the impression it should just work without using bridge....

@christophfroehlich
Copy link
Contributor

@zacharyyamaoka do you mind contributing a PR by adding this here? The ros2_launch_gazebo doc is not managed by us (but you also can hand in a PR there!)

@zacharyyamaoka
Copy link

@zacharyyamaoka do you mind contributing a PR by adding this here? The ros2_launch_gazebo doc is not managed by us (but you also can hand in a PR there!)

Yes I will give it a go!

Made a PR here: #549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants