Skip to main content

ActionServerHandle

Struct ActionServerHandle 

Source
pub struct ActionServerHandle<A: RosAction> { /* private fields */ }
Expand description

Handle to an action server registered in the executor’s arena.

Returned by Executor::register_action_server(). Provides methods to interact with the server (publish feedback, complete goals) while the executor automatically handles goal acceptance, cancel requests, and result serving during spin_once().

Implementations§

Source§

impl<A: RosAction> ActionServerHandle<A>

Source

pub fn handle_id(&self) -> HandleId

Get the HandleId for this action server.

Used with Trigger::One or HandleSet for trigger configuration.

Source

pub fn publish_feedback( &self, executor: &mut Executor<'_>, goal_id: &GoalId, feedback: &A::Feedback, ) -> Result<(), NodeError>

Publish feedback for an active goal.

Serialises the feedback message and sends it to all clients monitoring this goal. Returns an error if the handle slot has been removed from the executor.

Source

pub fn succeed( &self, executor: &mut Executor<'_>, goal_id: &GoalId, result: A::Result, ) -> Result<(), NodeError>

Complete a goal with a terminal status and result payload.

The goal is moved from the active set to the completed-results slab. Clients waiting on a result will receive the response. status should be one of Succeeded, Aborted, or Canceled.

§Errors

NodeError::BufferTooSmall when the handle slot has been removed from the executor, or when the serialized result exceeds the server’s RESULT_BUF and so cannot be retained for a later get_result (issue 0796 — this used to return () and swallow both). Terminate goal_id as SUCCEEDED — phase-379 W5.

The three terminal verbs (succeed / abort / canceled) name the ACTION SPEC’s terminal states, which is also what rclcpp_action’s ServerGoalHandle spells them: succeed(result), abort(result), canceled(result) — and, since phase-417 W4.b, what C (rclc_action_canceled) and C++ (ActionServer<A>::canceled) spell them too. They take the goal ID rather than hanging off a handle because a goal here lives in a fixed-capacity arena and is named by its UUID — see the divergence row for why neither client library’s ownership model is available without an allocator.

complete_goal remains the general form for a status computed at runtime.

Source

pub fn abort( &self, executor: &mut Executor<'_>, goal_id: &GoalId, result: A::Result, ) -> Result<(), NodeError>

Terminate goal_id as ABORTED. See Self::succeed.

Source

pub fn canceled( &self, executor: &mut Executor<'_>, goal_id: &GoalId, result: A::Result, ) -> Result<(), NodeError>

Terminate goal_id as CANCELED. See Self::succeed.

phase-417 W4.b — this was cancel, and the argument for that spelling lived on the cancel alias phase-482 W6 retired. It loses to the drop-in claim: C spells it rclc_action_canceled, rclcpp_action spells it ServerGoalHandle::canceled, and Rust was the only one of the three disagreeing — over a naming preference with no platform reason behind it (RFC-0089: a rename is cheap, a surface our own languages disagree about is not).

Source

pub fn complete_goal( &self, executor: &mut Executor<'_>, goal_id: &GoalId, status: GoalStatus, result: A::Result, ) -> Result<(), NodeError>

Source

pub fn set_goal_status( &self, executor: &mut Executor<'_>, goal_id: &GoalId, status: GoalStatus, )

Update a goal’s status without completing it.

Use this to transition a goal to Executing or Canceling while it is still active. To finish a goal, use complete_goal.

Source

pub fn active_goal_count(&self, executor: &Executor<'_>) -> usize

Get the number of currently active goals.

Returns 0 if the action server handle has been removed from the executor.

Source

pub fn goal_exists(&self, executor: &Executor<'_>, goal_id: &GoalId) -> bool

Is goal_id a goal this server still knows about? — phase-417 W4.b.

rcl’s rcl_action_server_goal_exists, and the Rust half of the ledger row c:action_server_goal_exists. TRUE while the goal is active AND while its completed result is still retained, which is a strictly wider window than goal_status reports — see ActionServerCore::goal_exists.

Returns false if the handle slot has been removed from the executor, which is the same answer a caller wants there: nothing on this server knows the goal any more.

Source

pub fn expire_goals(&self, executor: &mut Executor<'_>) -> usize

Eagerly reclaim every completed result whose get_result reply has already been sent — phase-417 W4.b, ledger row c:action_expire_goals.

Returns the number of entries reclaimed. rcl’s rcl_action_expire_goals is the same capability under a CLOCK: it reclaims goals whose result_timeout has elapsed and reports which. Ours has no clock — the no_std core takes no time source (RFC-0036) — so the trigger is the caller, and reclamation is otherwise on demand inside complete_goal. Calling this is OPTIONAL; a server that never does still runs forever.

Source

pub fn for_each_active_goal( &self, executor: &Executor<'_>, f: impl FnMut(&ActiveGoal<A>), )

Iterate over all currently active goals.

Calls f for each goal that has been accepted but not yet completed. Useful for monitoring progress or canceling stale goals.

Trait Implementations§

Source§

impl<A: RosAction> Clone for ActionServerHandle<A>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: RosAction> Copy for ActionServerHandle<A>

Auto Trait Implementations§

§

impl<A> Freeze for ActionServerHandle<A>

§

impl<A> RefUnwindSafe for ActionServerHandle<A>
where A: RefUnwindSafe,

§

impl<A> Send for ActionServerHandle<A>
where A: Send,

§

impl<A> Sync for ActionServerHandle<A>
where A: Sync,

§

impl<A> Unpin for ActionServerHandle<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for ActionServerHandle<A>

§

impl<A> UnwindSafe for ActionServerHandle<A>
where A: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.