Struct r2r::TimeSource
source · 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 copy 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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