Robotics StackExchange | Archived questions

How to use simulation time between ROS2 and Ignition gazebo

Hello,

I learned that there is a system plugin called gazeborosinit on ROS2 (when using gazebo)

gazeborosinit plugin publishes the current time of the Gazebo simulation to the /clock topic,
and the ros2 node should have the usesimtime parameter set on it.

but I don't know how to do the same thing when using ros2 and Ignition Gazebo.

Is there a plugin like gazeborosinit on Ignition gazebo or ROS2?


when I run the simulator these is a /clock topic. $ ign gazebo ooo.sdf

so I tried Integrate ROS2 with Ignition

$ ros2 run ros_ign_bridge parameter_bridge /clock@rosgraph_msgs/msg/Clock@ignition.msgs.Clock

and I set usesimtime parameter for true on ros2 node

$ ros2 param set /node_name use_sim_time true

However I can't seem to do it well.


If you have any Information of Integrate the time between ros2 and ignition gazebo, please let me know.

Thank you.

Asked by ksk on 2021-02-19 19:43:08 UTC

Comments

Answers

Is there a plugin like gazebo_ros_init on Ignition gazebo or ROS2?

No, there isn't a plugin. Using the bridge like you did is the correct thing.

However I can't seem to do it well.

What's happening that isn't working for you? Can you echo the /clock topic on the ROS 2 side?

Another thing you can try is launching the bridge on a launch file:

bridge = Node( package='ros_ign_bridge', executable='parameter_bridge', arguments=['/clock@rosgraph_msgs/msg/Clock@ignition.msgs.Clock'], output='screen' )

Asked by chapulina on 2021-02-23 20:47:50 UTC

Comments