pub trait ActionClient<G, F, R>{
// 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
| Feature | Service | Action | Mission |
|---|---|---|---|
| Direction | req → res | goal → feedback* → result | long-lived duplex |
| Streaming | ✗ | ✓ (best-effort) | ✓ (reliable) |
| Cancel | ✗ | ✓ | ✓ (Pause/Cancel) |
| Reconnect | ✗ | ✗ | ✓ (Reconcile) |
| State-machine | none | simple (6 states) | complex (8 states) |
Required Methods§
fn action_name(&self) -> &str
fn schema(&self) -> &ActionSchema
Sourcefn send_goal(&mut self, goal: G) -> Result<(ActionGoalId, GoalAck), RtError>
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.
Sourcefn poll_feedback(&mut self, goal_id: ActionGoalId) -> Option<ActionFeedback<F>>
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.
Sourcefn poll_result(&mut self, goal_id: ActionGoalId) -> Option<ActionResult<R>>
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.
Sourcefn cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
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.
Sourcefn goal_status(&self, goal_id: ActionGoalId) -> Option<GoalStatus>
fn goal_status(&self, goal_id: ActionGoalId) -> Option<GoalStatus>
Query the current status of a goal without consuming any feedback or result.
fn close(&mut self) -> Result<(), RtError>
Provided Methods§
Sourcefn tick_timeouts(&mut self, _now: Timestamp) -> usize
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.
Sourcefn goal_health(&self, _goal_id: ActionGoalId) -> Option<ActionSessionHealth>
fn goal_health(&self, _goal_id: ActionGoalId) -> Option<ActionSessionHealth>
Return health state of a specific goal.
Sourcefn active_goal_health(&self) -> Vec<ActionSessionHealth>
fn active_goal_health(&self) -> Vec<ActionSessionHealth>
Return health states for all known goals.