Skip to content

Timed Behaviors do not adhere to Sim Time #3303

@bobbleballs

Description

@bobbleballs

Bug report

  • Operating System:
    Ubuntu 22.04

  • ROS2 Version:
    Humble

  • Version or commit hash:
    0d86469

  • DDS implementation:

    • Cyclone-DDS

Steps to reproduce issue

I have an issue where I am running a simulation at greater than real time speed. My simulation platform (Flatland2D) is publishing sim time on /clock and use_sim_time is set on the Nav2 launch procedure. My issue is that my behaviour tree contains some waits, and backups however these behaviours occur at real time not sim time.

Expected behavior

Timed behaviours will work to sim time not real time. e.g. in a simulation running at 2x speed with a wait of 10 seconds I would expect this to take 5 Seconds.

Actual behavior

Waits take the real length of time.

Additional information

I've had a look at nav2_behaviors/plugins/wait and back_up and it looks like wait uses a steady_time from chrono which calls now(). I don't know much about chrono but I'm guessing this gets an accurate system time?
nav2_behaviors/include/timed_behaviors.hpp also uses rclcpp::Clock steady_clock_{RCL_STEADY_TIME}; which I presume does something similar?

For the behaviours to adhere to use_sim_time these behaviours should be using RCL_ROS_TIME I think? Would this have any negative effects. I'm not sure if steady_time was used for a reason? Ideally I am trying to make the behaviour of the navigation stack at high sim rates as accurate as real time so this is a blocker to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions