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 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 DeclaredNode::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: &GoalId,
status: GoalStatus,
result: &R,
) -> NodeResult<()>
pub fn complete_goal_for_name<R: RosMessage, const N: usize>( &mut self, name: &str, goal_id: &GoalId, status: GoalStatus, result: &R, ) -> NodeResult<()>
Complete an action goal on the action entity synthesized from name.
This pairs with
DeclaredNode::create_action_server_for_name and
DeclaredNode::create_action_server_for_name_with_callbacks.
Sourcepub fn for_each_active_goal_for_name(
&self,
name: &str,
visit: &mut dyn FnMut(&GoalId, GoalStatus),
)
pub fn for_each_active_goal_for_name( &self, name: &str, visit: &mut dyn FnMut(&GoalId, GoalStatus), )
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: &GoalId,
feedback: &F,
) -> NodeResult<()>
pub fn publish_feedback_for_name<F: RosMessage, const N: usize>( &mut self, name: &str, goal_id: &GoalId, feedback: &F, ) -> NodeResult<()>
Publish feedback on the action 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<GoalId>
pub fn send_goal_raw_for_name( &mut self, name: &str, goal_cdr: &[u8], ) -> NodeResult<GoalId>
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<GoalId>
pub fn send_goal_for_name<G: RosMessage, const N: usize>( &mut self, name: &str, goal: &G, ) -> NodeResult<GoalId>
Send a typed action-client goal through the entity synthesized
from name.