ros2cs icon indicating copy to clipboard operation
ros2cs copied to clipboard

Support use_sim_time (equivalent) in ros2cs

Open adamdbrw opened this issue 4 years ago • 0 comments

The implementation should be rather straightforward.

In ros2, point of interest is time_source.cpp. It involves adding a "/clock" subscription that runs in it's own executor and using it as a time source if the parameter is set (with rcl_set_ros_time_override). This is preceded by resetting clocks and calling rcl_enable_ros_time_override. Since we interface with rcl, we need to replicate the behavior around calling these.

The work is as follows:

  1. Expose API to set use_sim_time (on Ros2cs level)
  2. Make this setting control whether we add a subscriber to "/clock" topic which in callback calls the *ros_time_override api. We would do this internally within Ros2cs. The subscription is best effort, keep last 1.

The current api for getting time should then just work (give system or "/clock" time depending on the parameter).

adamdbrw avatar Feb 01 '22 11:02 adamdbrw