pub struct StandaloneNode<const MAX_PUBS: usize = 8, const MAX_SUBS: usize = 8> { /* private fields */ }Expand description
ROS 2 Node for embedded systems
The node manages publishers and subscribers with static allocation.
MAX_PUBS and MAX_SUBS define the maximum number of publishers
and subscribers that can be created.
§Type Parameters
MAX_PUBS: Maximum number of publishersMAX_SUBS: Maximum number of subscribers
Implementations§
Source§impl<const MAX_PUBS: usize, const MAX_SUBS: usize> Node<MAX_PUBS, MAX_SUBS>
impl<const MAX_PUBS: usize, const MAX_SUBS: usize> Node<MAX_PUBS, MAX_SUBS>
Sourcepub fn new(config: NodeConfig<'_>) -> Result<Self, NodeError>
pub fn new(config: NodeConfig<'_>) -> Result<Self, NodeError>
Create a new node with the given configuration
Sourcepub fn fully_qualified_name(&self) -> Result<String<128>, NodeError>
pub fn fully_qualified_name(&self) -> Result<String<128>, NodeError>
Get the fully qualified node name.
Phase 192.1 — fallible: namespace (≤64) + / + name (≤64) can reach 129
bytes, one over the String<128> capacity, so a maxed name+namespace
would otherwise silently truncate the FQN.
Sourcepub fn create_publisher<M: RosMessage>(
&mut self,
options: PublisherOptions<'_>,
) -> Result<PublisherHandle<M>, NodeError>
pub fn create_publisher<M: RosMessage>( &mut self, options: PublisherOptions<'_>, ) -> Result<PublisherHandle<M>, NodeError>
Create a publisher with the given options
Sourcepub fn create_subscriber<M: RosMessage>(
&mut self,
options: SubscriberOptions<'_>,
) -> Result<SubscriberHandle<M>, NodeError>
pub fn create_subscriber<M: RosMessage>( &mut self, options: SubscriberOptions<'_>, ) -> Result<SubscriberHandle<M>, NodeError>
Create a subscriber with the given options
Sourcepub fn publisher_topic_info(
&self,
handle: PublisherHandle<()>,
) -> Option<TopicInfo<'_>>
pub fn publisher_topic_info( &self, handle: PublisherHandle<()>, ) -> Option<TopicInfo<'_>>
Get topic info for a publisher
Sourcepub fn subscriber_topic_info(
&self,
handle: SubscriberHandle<()>,
) -> Option<TopicInfo<'_>>
pub fn subscriber_topic_info( &self, handle: SubscriberHandle<()>, ) -> Option<TopicInfo<'_>>
Get topic info for a subscriber
Sourcepub fn serialize_message<M: RosMessage>(
&mut self,
_handle: &PublisherHandle<M>,
msg: &M,
) -> Result<&[u8], NodeError>
pub fn serialize_message<M: RosMessage>( &mut self, _handle: &PublisherHandle<M>, msg: &M, ) -> Result<&[u8], NodeError>
Serialize a message for publishing
Returns the serialized bytes. The caller is responsible for sending the bytes via the transport layer.
Sourcepub fn deserialize_message<M: RosMessage>(
&self,
_handle: &SubscriberHandle<M>,
data: &[u8],
) -> Result<M, NodeError>
pub fn deserialize_message<M: RosMessage>( &self, _handle: &SubscriberHandle<M>, data: &[u8], ) -> Result<M, NodeError>
Deserialize a received message
The caller provides the raw bytes received from the transport layer.
Sourcepub fn publisher_count(&self) -> usize
pub fn publisher_count(&self) -> usize
Get the number of active publishers
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get the number of active subscribers