|
Nav2 Navigation Stack - rolling
main
ROS 2 Navigation Stack
|
Publishes simulated clock to /clock using wall time. Uses wall timers so that it works correctly even when owned by a node with use_sim_time=true. Supports speed_factor to run sim time faster or slower than real time. More...
#include <nav2_loopback_sim/include/nav2_loopback_sim/clock_publisher.hpp>
Public Member Functions | |
| ClockPublisher (nav2::LifecycleNode::WeakPtr node, double speed_factor=1.0) | |
| Construct a ClockPublisher. More... | |
| void | start () |
| Start publishing /clock. | |
| void | stop () |
| Stop publishing /clock. | |
| void | setSpeedFactor (double speed_factor) |
| Update the simulation speed factor. More... | |
Protected Member Functions | |
| void | timerCallback () |
| Wall-timer callback that advances sim time and publishes /clock. | |
| void | resetTimer () |
| (Re)create the wall timer based on current speed_factor | |
Static Protected Attributes | |
| static constexpr double | kResolution = 0.01 |
| static constexpr double | kMinWallPeriod = 0.001 |
Publishes simulated clock to /clock using wall time. Uses wall timers so that it works correctly even when owned by a node with use_sim_time=true. Supports speed_factor to run sim time faster or slower than real time.
Definition at line 35 of file clock_publisher.hpp.
| nav2_loopback_sim::ClockPublisher::ClockPublisher | ( | nav2::LifecycleNode::WeakPtr | node, |
| double | speed_factor = 1.0 |
||
| ) |
Construct a ClockPublisher.
| node | Weak pointer to the owning lifecycle node |
| speed_factor | Sim-time speed relative to wall time |
Definition at line 25 of file clock_publisher.cpp.
| void nav2_loopback_sim::ClockPublisher::setSpeedFactor | ( | double | speed_factor | ) |
Update the simulation speed factor.
| speed_factor | New speed multiplier (must be positive) |
Definition at line 61 of file clock_publisher.cpp.
References resetTimer().
