Skip to main content

TickCtx

Struct TickCtx 

Source
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>

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for TickCtx<'a>

§

impl<'a> !RefUnwindSafe for TickCtx<'a>

§

impl<'a> !Send for TickCtx<'a>

§

impl<'a> !Sync for TickCtx<'a>

§

impl<'a> Unpin for TickCtx<'a>

§

impl<'a> UnsafeUnpin for TickCtx<'a>

§

impl<'a> !UnwindSafe for TickCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.