Setting timers with different clock sources (wall and simulation) in the same node

asked 2022-06-10 09:09:34 -0500

Hi all, I am simulating a system in ROS2 Galactic and Gazebo(11) and therefore am using simulation time. However, I would also wish to create a timer in wall-clock time to periodically check the real-time factor of the Gazebo simulation (by calling gz stats using Python subprocess and parsing the output).

I understand that when I call create_timer there is the option to specify a clock source. By default, it should point to the node's clock, which is taken from Gazebo. What option would I specify to set a wall-clock clock when creating a timer in rclpy?

I understand there is a create_wall_timer function in rclcpp, is there an equivalent option/functionality in rclpy?

Better yet, is there a neat way of getting the simulation stats from gazebo (specifically the real-time factor) entirely within ROS?

edit retag flag offensive close merge delete