Struct ros2_client::Context
source · pub struct Context { /* private fields */ }
Expand description
Context communicates with other
participants information in ROS2 network. It keeps track of
NodeEntitiesInfo
s. Also acts as a wrapper for a RustDDS instance.
Context is shut down by dropping it, and all of its RosNodes.
There should be no need for ok()
or shutdown()
methods.
Implementations§
source§impl Context
impl Context
sourcepub fn new() -> CreateResult<Context>
pub fn new() -> CreateResult<Context>
Create a new Context with default settings.
sourcepub fn with_options(opt: ContextOptions) -> CreateResult<Context>
pub fn with_options(opt: ContextOptions) -> CreateResult<Context>
Create a new Context.
sourcepub fn from_domain_participant(
domain_participant: DomainParticipant
) -> CreateResult<Context>
pub fn from_domain_participant( domain_participant: DomainParticipant ) -> CreateResult<Context>
Create a new Context from an existing DomainParticipant
.
sourcepub fn new_node(
&self,
node_name: NodeName,
options: NodeOptions
) -> CreateResult<Node>
pub fn new_node( &self, node_name: NodeName, options: NodeOptions ) -> CreateResult<Node>
Create a new ROS2 Node
sourcepub fn discovered_topics(&self) -> Vec<DiscoveredTopicData>
pub fn discovered_topics(&self) -> Vec<DiscoveredTopicData>
Which topics have been discovered?
sourcepub fn participant_entities_info(&self) -> ParticipantEntitiesInfo
pub fn participant_entities_info(&self) -> ParticipantEntitiesInfo
Gets the ParticipantEntitiesInfo describing the current state of this Context. This is what we send to ROS Discovery.
sourcepub fn get_parameter_events_topic(&self) -> Topic
pub fn get_parameter_events_topic(&self) -> Topic
Get a (handle to) the ROSOut logging Topic.
sourcepub fn get_rosout_topic(&self) -> Topic
pub fn get_rosout_topic(&self) -> Topic
Get a (handle to) the ROSOut logging Topic.
Note: The recommended way to write log messages to ROSOut is via the
crate::rosout
macro.
sourcepub fn domain_participant(&self) -> DomainParticipant
pub fn domain_participant(&self) -> DomainParticipant
Get the contained DDS DomainParticipant
.
The return value is owned, but it is just a cloned smart pointer.