pub struct TimeSource { /* private fields */ }Expand description
Provides time from /clock topic to attached ROS clocks
By default only clock used by ROS timers is attached and time from /clock topic is disabled.
The time from /clock topic can be activated by either of these:
- calling
TimeSource::enable_sim_time - having registered parameter handler and launching the node with parameter
use_sim_time:=true
Similar to rclcpp/time_source.hpp
Implementations§
Source§impl TimeSource
impl TimeSource
Sourcepub fn attach_ros_clock(&self, clock: Weak<Mutex<Clock>>) -> Result<()>
pub fn attach_ros_clock(&self, clock: Weak<Mutex<Clock>>) -> Result<()>
Attach clock of type RosTime to the TimeSource
If the simulated time is enabled the TimeSource will distribute simulated time
to all attached clocks.
Sourcepub fn enable_sim_time(&self, node: &mut Node) -> Result<()>
pub fn enable_sim_time(&self, node: &mut Node) -> Result<()>
Enables usage of simulated time
Simulated time is provided on topic "/clock" in the message rosgraph_msgs::msg::Clock.
See example: sim_time_publisher.rs
Sourcepub fn disable_sim_time(&self)
pub fn disable_sim_time(&self)
Disables usage of simulated time
This will schedule removal of internal subscriber to the "/clock" topic on the next
receipt of rosgraph_msgs::msg::Clock message.
Trait Implementations§
Source§impl Clone for TimeSource
impl Clone for TimeSource
Source§fn clone(&self) -> TimeSource
fn clone(&self) -> TimeSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TimeSource
impl RefUnwindSafe for TimeSource
impl Send for TimeSource
impl Sync for TimeSource
impl Unpin for TimeSource
impl UnwindSafe for TimeSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more