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

Source

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

Source

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

Source

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.

Source

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

Source

pub fn count_publishers(&mut self, topic_name: &str) -> Result<usize, NodeError>

The graph’s publisher count on topic_name (not this node’s).

Source

pub fn count_subscriptions( &mut self, topic_name: &str, ) -> Result<usize, NodeError>

The graph’s subscription count on topic_name.

Source

pub fn count_clients(&mut self, service_name: &str) -> Result<usize, NodeError>

The graph’s client count on service_name.

Source

pub fn count_services(&mut self, service_name: &str) -> Result<usize, NodeError>

The graph’s server count on service_name.

Source

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

Source

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

Source

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

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn cancel_timer(&self, timer: EntityId<'_>) -> NodeResult<()>

Cancel the declared timer timer from tick: rclcpp’s TimerBase::cancel(). See CallbackCtx::cancel_timer.

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 DeclarativeNode::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: &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.

Source

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.

Source

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.

Source

pub fn service_is_ready_for_name(&self, name: &str) -> NodeResult<bool>

Self::service_is_ready through the entity synthesized from name.

Source

pub fn action_server_is_ready_for_name(&self, name: &str) -> NodeResult<bool>

Self::action_server_is_ready through the 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<GoalUuid>

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

Send a typed action-client goal through the entity synthesized from name.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<'a> UnsafeUnpin 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.