Skip to main content

ActionClient

Trait ActionClient 

Source
pub trait ActionClient<G, F, R>
where G: Send + 'static, F: Send + 'static, R: Send + 'static,
{ // Required methods fn action_name(&self) -> &str; fn schema(&self) -> &ActionSchema; fn send_goal(&mut self, goal: G) -> Result<(ActionGoalId, GoalAck), RtError>; fn poll_feedback( &mut self, goal_id: ActionGoalId, ) -> Option<ActionFeedback<F>>; fn poll_result(&mut self, goal_id: ActionGoalId) -> Option<ActionResult<R>>; fn cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>; fn goal_status(&self, goal_id: ActionGoalId) -> Option<GoalStatus>; fn close(&mut self) -> Result<(), RtError>; // Provided methods fn tick_timeouts(&mut self, _now: Timestamp) -> usize { ... } fn goal_health(&self, _goal_id: ActionGoalId) -> Option<ActionSessionHealth> { ... } fn active_goal_health(&self) -> Vec<ActionSessionHealth> { ... } }
Expand description

Client-side handle: sends goals, polls feedback, and retrieves the final result.

§Comparison with Service and Mission

FeatureServiceActionMission
Directionreq → resgoal → feedback* → resultlong-lived duplex
Streaming✓ (best-effort)✓ (reliable)
Cancel✓ (Pause/Cancel)
Reconnect✓ (Reconcile)
State-machinenonesimple (6 states)complex (8 states)

Required Methods§

Source

fn action_name(&self) -> &str

Source

fn schema(&self) -> &ActionSchema

Source

fn send_goal(&mut self, goal: G) -> Result<(ActionGoalId, GoalAck), RtError>

Send a goal and immediately receive the server’s accept/reject acknowledgement.

The returned ActionGoalId is used for subsequent poll_feedback, poll_result, and cancel calls. If the server rejects the goal (GoalAck::accepted == false), the ID remains valid but no feedback or result will ever be produced for it.

Source

fn poll_feedback(&mut self, goal_id: ActionGoalId) -> Option<ActionFeedback<F>>

Non-blocking poll: dequeue the next feedback item for the given goal, or None if empty.

Source

fn poll_result(&mut self, goal_id: ActionGoalId) -> Option<ActionResult<R>>

Non-blocking poll: take the final result for the given goal, or None if not ready.

Once Some is returned the goal’s lifecycle is over; the ID need not be tracked further.

Source

fn cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>

Request cancellation of a goal.

Cancellation is a request, not a command; the server may refuse (e.g. the goal has entered a critical phase). On success, poll_result will eventually return GoalStatus::Canceled.

Source

fn goal_status(&self, goal_id: ActionGoalId) -> Option<GoalStatus>

Query the current status of a goal without consuming any feedback or result.

Source

fn close(&mut self) -> Result<(), RtError>

Provided Methods§

Source

fn tick_timeouts(&mut self, _now: Timestamp) -> usize

Evaluate heartbeat timeouts for executing goals.

Returns the number of goals that were transitioned into timeout failure.

Source

fn goal_health(&self, _goal_id: ActionGoalId) -> Option<ActionSessionHealth>

Return health state of a specific goal.

Source

fn active_goal_health(&self) -> Vec<ActionSessionHealth>

Return health states for all known goals.

Implementors§

Source§

impl<G, F, R> ActionClient<G, F, R> for BasicActionClient<G, F, R>
where G: Send + 'static, F: Send + 'static, R: Send + 'static,