pub struct TickCtx<'a> { /* private fields */ }Expand description
Context handed to ExecutableNode::tick (W.5.6 + M-F.4): the per-spin
hook that runs between callback dispatch, where the executor is free.
Exposes the immediate publish path (like CallbackCtx) plus executor-backed
action-server ops (complete goal / publish feedback) AND executor-backed
client-side ops (service call / action-client send_goal). Callbacks
can’t perform any of these since they don’t hold the executor.
Implementations§
Source§impl<'a> TickCtx<'a>
impl<'a> TickCtx<'a>
Sourcepub fn new(
publishers: &'a dyn PublisherResolver,
actions: &'a mut dyn ActionExecutor,
clients: &'a mut dyn ClientDispatch,
) -> Self
pub fn new( publishers: &'a dyn PublisherResolver, actions: &'a mut dyn ActionExecutor, clients: &'a mut dyn ClientDispatch, ) -> Self
Build a tick context (called by the generated runtime each spin).
Sourcepub fn set_graph(&mut self, graph: &'a mut dyn GraphQuery)
pub fn set_graph(&mut self, graph: &'a mut dyn GraphQuery)
Thread the graph queries in: the tick driver’s own GraphQuery,
which reaches the executor for the length of each call.
Sourcepub fn get_node_names(
&mut self,
visit: &mut dyn FnMut(&str, &str) -> bool,
) -> Result<(), NodeError>
pub fn get_node_names( &mut self, visit: &mut dyn FnMut(&str, &str) -> bool, ) -> Result<(), NodeError>
Every node on the graph: visit(name, namespace), stop on false.
What has been DISCOVERED, never blocking: empty means “not seen
yet”.
Sourcepub fn get_node_names_with_enclaves(
&mut self,
visit: &mut dyn FnMut(&str, &str, Option<&str>) -> bool,
) -> Result<(), NodeError>
pub fn get_node_names_with_enclaves( &mut self, visit: &mut dyn FnMut(&str, &str, Option<&str>) -> bool, ) -> Result<(), NodeError>
Every node with its enclave: visit(name, namespace, enclave).
Sourcepub fn get_topic_names_and_types(
&mut self,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_topic_names_and_types( &mut self, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
Every topic with its types: visit(topic, types) once per topic.
Sourcepub fn get_service_names_and_types(
&mut self,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_service_names_and_types( &mut self, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
Every service with its types: visit(service, types).
Sourcepub fn count_publishers(&mut self, topic_name: &str) -> Result<usize, NodeError>
pub fn count_publishers(&mut self, topic_name: &str) -> Result<usize, NodeError>
The graph’s publisher count on topic_name (not this node’s).
Sourcepub fn count_subscriptions(
&mut self,
topic_name: &str,
) -> Result<usize, NodeError>
pub fn count_subscriptions( &mut self, topic_name: &str, ) -> Result<usize, NodeError>
The graph’s subscription count on topic_name.
Sourcepub fn count_clients(&mut self, service_name: &str) -> Result<usize, NodeError>
pub fn count_clients(&mut self, service_name: &str) -> Result<usize, NodeError>
The graph’s client count on service_name.
Sourcepub fn count_services(&mut self, service_name: &str) -> Result<usize, NodeError>
pub fn count_services(&mut self, service_name: &str) -> Result<usize, NodeError>
The graph’s server count on service_name.
Sourcepub fn get_publisher_names_and_types_by_node(
&mut self,
node_name: &str,
node_namespace: &str,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_publisher_names_and_types_by_node( &mut self, node_name: &str, node_namespace: &str, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
The topics a node publishes: visit(topic, types).
Sourcepub fn get_subscription_names_and_types_by_node(
&mut self,
node_name: &str,
node_namespace: &str,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_subscription_names_and_types_by_node( &mut self, node_name: &str, node_namespace: &str, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
The topics a node subscribes to: visit(topic, types).
Sourcepub fn get_service_names_and_types_by_node(
&mut self,
node_name: &str,
node_namespace: &str,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_service_names_and_types_by_node( &mut self, node_name: &str, node_namespace: &str, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
The services a node serves: visit(service, types).
Sourcepub fn get_client_names_and_types_by_node(
&mut self,
node_name: &str,
node_namespace: &str,
visit: &mut dyn FnMut(&str, &[&str]) -> bool,
) -> Result<(), NodeError>
pub fn get_client_names_and_types_by_node( &mut self, node_name: &str, node_namespace: &str, visit: &mut dyn FnMut(&str, &[&str]) -> bool, ) -> Result<(), NodeError>
The services a node is a client of: visit(service, types).
Sourcepub fn get_publishers_info_by_topic(
&mut self,
topic_name: &str,
visit: &mut dyn FnMut(&GraphEndpointInfo<'_>) -> bool,
) -> Result<(), NodeError>
pub fn get_publishers_info_by_topic( &mut self, topic_name: &str, visit: &mut dyn FnMut(&GraphEndpointInfo<'_>) -> bool, ) -> Result<(), NodeError>
The publishers on topic_name, one visit each.
Sourcepub fn get_subscriptions_info_by_topic(
&mut self,
topic_name: &str,
visit: &mut dyn FnMut(&GraphEndpointInfo<'_>) -> bool,
) -> Result<(), NodeError>
pub fn get_subscriptions_info_by_topic( &mut self, topic_name: &str, visit: &mut dyn FnMut(&GraphEndpointInfo<'_>) -> bool, ) -> Result<(), NodeError>
The subscriptions on topic_name, one visit each.
Sourcepub fn reset_timer(&self, timer: EntityId<'_>) -> NodeResult<()>
pub fn reset_timer(&self, timer: EntityId<'_>) -> NodeResult<()>
Reset the declared timer timer from tick: rclcpp’s
TimerBase::reset(). See CallbackCtx::reset_timer; from a tick the
request is applied as soon as tick returns.
Sourcepub fn cancel_timer(&self, timer: EntityId<'_>) -> NodeResult<()>
pub fn cancel_timer(&self, timer: EntityId<'_>) -> NodeResult<()>
Cancel the declared timer timer from tick: rclcpp’s
TimerBase::cancel(). See CallbackCtx::cancel_timer.
Sourcepub fn publish_to_topic<M: RosMessage, const N: usize>(
&self,
topic: &str,
msg: &M,
) -> NodeResult<()>
pub fn publish_to_topic<M: RosMessage, const N: usize>( &self, topic: &str, msg: &M, ) -> NodeResult<()>
Serialize msg and publish through the entity synthesized from topic.
This pairs with DeclarativeNode::create_publisher_for_topic for
executable tick hooks.
Sourcepub fn complete_goal_for_name<R: RosMessage, const N: usize>(
&mut self,
name: &str,
goal_id: &GoalUuid,
status: GoalStatusCode,
result: &R,
) -> NodeResult<()>
pub fn complete_goal_for_name<R: RosMessage, const N: usize>( &mut self, name: &str, goal_id: &GoalUuid, status: GoalStatusCode, result: &R, ) -> NodeResult<()>
Complete an action goal on the action entity synthesized from name.
This pairs with
DeclarativeNode::create_action_server_for_name and
DeclarativeNode::create_action_server_for_name_with_callbacks.
Sourcepub fn for_each_active_goal_for_name(
&self,
name: &str,
visit: &mut dyn FnMut(&GoalUuid, GoalStatusCode),
)
pub fn for_each_active_goal_for_name( &self, name: &str, visit: &mut dyn FnMut(&GoalUuid, GoalStatusCode), )
Visit active goals on the action entity synthesized from name.
Sourcepub fn publish_feedback_for_name<F: RosMessage, const N: usize>(
&mut self,
name: &str,
goal_id: &GoalUuid,
feedback: &F,
) -> NodeResult<()>
pub fn publish_feedback_for_name<F: RosMessage, const N: usize>( &mut self, name: &str, goal_id: &GoalUuid, feedback: &F, ) -> NodeResult<()>
Publish feedback on the action entity synthesized from name.
Sourcepub fn service_is_ready_for_name(&self, name: &str) -> NodeResult<bool>
pub fn service_is_ready_for_name(&self, name: &str) -> NodeResult<bool>
Self::service_is_ready through the entity synthesized from name.
Sourcepub fn action_server_is_ready_for_name(&self, name: &str) -> NodeResult<bool>
pub fn action_server_is_ready_for_name(&self, name: &str) -> NodeResult<bool>
Self::action_server_is_ready through the entity synthesized from name.
Sourcepub fn call_raw_for_name(
&mut self,
name: &str,
request_cdr: &[u8],
response_buf: &mut [u8],
) -> NodeResult<usize>
pub fn call_raw_for_name( &mut self, name: &str, request_cdr: &[u8], response_buf: &mut [u8], ) -> NodeResult<usize>
Issue a raw service-client request through the entity synthesized
from name.
Sourcepub fn call_for_name<Req: RosMessage, Resp: RosMessage, const REQ_N: usize, const RESP_N: usize>(
&mut self,
name: &str,
request: &Req,
) -> NodeResult<Resp>
pub fn call_for_name<Req: RosMessage, Resp: RosMessage, const REQ_N: usize, const RESP_N: usize>( &mut self, name: &str, request: &Req, ) -> NodeResult<Resp>
Issue a typed service-client request through the entity synthesized
from name.
Sourcepub fn send_goal_raw_for_name(
&mut self,
name: &str,
goal_cdr: &[u8],
) -> NodeResult<GoalUuid>
pub fn send_goal_raw_for_name( &mut self, name: &str, goal_cdr: &[u8], ) -> NodeResult<GoalUuid>
Send a raw-CDR action-client goal through the entity synthesized
from name.
Sourcepub fn send_goal_for_name<G: RosMessage, const N: usize>(
&mut self,
name: &str,
goal: &G,
) -> NodeResult<GoalUuid>
pub fn send_goal_for_name<G: RosMessage, const N: usize>( &mut self, name: &str, goal: &G, ) -> NodeResult<GoalUuid>
Send a typed action-client goal through the entity synthesized
from name.