Skip to content

Commit 5039517

Browse files
added important info about working with ros2_control (#588)
Signed-off-by: Zachary Yamaoka <[email protected]> Signed-off-by: Alejandro Hernández Cordero <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]>
1 parent c2972bc commit 5039517

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

harmonic/ros2_launch_gazebo.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,41 @@ In the above launch files you may notice that the `create_own_container` argumen
142142

143143
More info about `ros_gz_bridge` can be viewed [here](ros2_integration).
144144
More info about composition can be viewed [here](ros2_overview.md#composition).
145+
146+
## Further Considerations for ROS2 Control
147+
148+
If you're planning to use `ros2_control` with Gazebo, please take a look at the [example launch files](https://github.com/ros-controls/gz_ros2_control/tree/rolling/gz_ros2_control_demos/launch) in the `gz_ros2_control` repository
149+
150+
It is essential to publish the `/clock` topic for the `controller_manager` to function correctly:
151+
152+
gz_bridge = Node(
153+
package="ros_gz_bridge",
154+
executable="parameter_bridge",
155+
arguments=['/clock@rosgraph_msgs/msg/Clock[gz.msgs.Clock'],
156+
parameters=[{
157+
"qos_overrides./tf_static.publisher.durability": "transient_local"
158+
}],
159+
output="screen",
160+
)
161+
162+
163+
If you **do not** publish the `/clock` topic, the `controller_manager` will issue warnings or errors such as:
164+
165+
[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.
166+
167+
Timing Issues
168+
-------------
169+
170+
By default, the `controller_manager` launched by `gz_ros2_control` has ``use_sim_time=true``. If for any reason this is set to ``false``, it will fall back to the system clock.
171+
172+
This results in logs like:
173+
174+
[gazebo-1] [INFO] [1744209678.974210234] [gz_ros_control]: Loading controller_manager
175+
[gazebo-1] [INFO] [1744209679.000651931] [controller_manager]: Using Steady (Monotonic) clock for triggering controller manager cycles.
176+
177+
Eventually leading to a fatal error:
178+
179+
[gazebo-1] terminate called after throwing an instance of 'std::runtime_error'
180+
[gazebo-1] what(): can't compare times with different time sources
181+
182+
Ensure `use_sim_time` is correctly set to `true` when working with simulation time to avoid such mismatches.

0 commit comments

Comments
 (0)