Skip to content

Add sleep_for and sleep_until for rcl_clock_t as per "Clock and Time" design #898

Closed

Description

@emersonknapp

Feature request

Feature description

The design article Clock and Time specifies that the ROS clock API is to have sleep_for and sleep_until methods. These are not yet present (that I know of).

Related to ros2/rosbag2#99

For context - it seems that this feature would be the best option to use for controlling rosbag2 playback time, instead of using std::this_thread::sleep_until in the message playback loop, so that it is more possible to handle time source control such as pausing and alteration of playback speed - as well as listening to an external time source like Gazebo.

Implementation considerations

Likely the existing timer code gives us most of the tools we need to implement this, it uses time sources correctly.

Activity

  1. fujitatomoya commented on Mar 10, 2021

    @fujitatomoya
    Collaborator

    this sounds reasonable to me, though it does seem to be really common use case. i wonder there's been similar discussion before... 🤔

  2. jacobperron commented on Mar 12, 2021

    @jacobperron
    Member

    Related ticket: ros2/rclcpp#465

    Also a long discussion in ros2/rclcpp#1248. TL;DR, I think the consensus is that we should have a "sleep_until" function that operates on a ROS time object, though the discussion was focused on rclcpp. I don't know how much development overhead is involved in abstracting this feature to rcl; I guess it may be a bit trickier without the convenience of some C++ features.

  3. added
    enhancement
    on Mar 12, 2021
  4. emersonknapp commented on Mar 12, 2021

    @emersonknapp
    CollaboratorAuthor

    I really only need it in C++ right now for this project, but I'm generally inclined to want rclpy (et. al) to have features, too.

  5. added
    help wanted
    on Apr 1, 2021
  6. paulsammut commented on Jul 29, 2021

    @paulsammut

    I just want to be able to sleep for x number of time :(

  7. sloretz commented on Nov 30, 2021

    @sloretz
    Contributor

    Sleeping is thread specific, and threads are language specific, so I think it makes sense to implement sleep methods in the language specific client libraries instead of rcl.

    This has been implemented in rclcpp - see the related ticket ros2/rclcpp#1730

  8. clalancette commented on Jun 21, 2022

    @clalancette
    Contributor

    This was implemented in both rclcpp and rclpy, and it seems like we are not going to do anything further in rcl itself. So closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions