Skip to main content

RosAction

Trait RosAction 

Source
pub trait RosAction: Sized {
    type Goal: RosMessage;
    type Result: RosMessage + Default;
    type Feedback: RosMessage;
    type SendGoalRequest: RosMessage;
    type SendGoalResponse: RosMessage;
    type GetResultRequest: RosMessage;
    type GetResultResponse: RosMessage;
    type FeedbackMessage: RosMessage;

    const ACTION_NAME: &'static str;
    const ACTION_HASH: &'static str;

    // Provided method
    fn register_protocol_types() -> Result<(), ()> { ... }
}
Expand description

Trait for ROS 2 action types

This trait defines the associated types and metadata for a ROS 2 action. Actions consist of three user-facing message types plus five action-protocol envelope types used on the wire (Phase 212.K.7.1.d/b):

User-facing:

  • Goal: Sent by client to initiate the action
  • Result: Returned by server when action completes
  • Feedback: Sent by server during execution to report progress

Wire envelopes (auto-emitted by nros generate rust):

  • SendGoalRequest / SendGoalResponse: <Action>_SendGoal service shape
  • GetResultRequest / GetResultResponse: <Action>_GetResult service shape
  • FeedbackMessage: <Action>_FeedbackMessage topic shape

Required Associated Constants§

Source

const ACTION_NAME: &'static str

Action type name (e.g., “example_interfaces::action::dds_::Fibonacci_”)

Source

const ACTION_HASH: &'static str

Type hash for discovery (RIHS format)

Required Associated Types§

Source

type Goal: RosMessage

Goal message sent by client to initiate the action

Source

type Result: RosMessage + Default

Result message returned by server upon completion

Source

type Feedback: RosMessage

Feedback message sent by server during execution

Source

type SendGoalRequest: RosMessage

<Action>_SendGoal_Request service envelope (wire-level send-goal request)

Source

type SendGoalResponse: RosMessage

<Action>_SendGoal_Response service envelope (wire-level send-goal reply)

Source

type GetResultRequest: RosMessage

<Action>_GetResult_Request service envelope (wire-level get-result request)

Source

type GetResultResponse: RosMessage

<Action>_GetResult_Response service envelope (wire-level get-result reply)

Source

type FeedbackMessage: RosMessage

<Action>_FeedbackMessage topic envelope (wire-level feedback message)

Provided Methods§

Source

fn register_protocol_types() -> Result<(), ()>

Register the fixed ROS 2 action-protocol message types this action needs at runtime beyond its own 8 envelopes — the action_msgs types the cancel/status plumbing serializes (CancelGoal_{Request,Response}, GoalStatusArray). The 8 RosAction-associated envelopes are registered generically by the executor (register_type::<A::Goal>() …); these three are NOT associated types (they live in action_msgs, which nros-core cannot name), so the generated impl RosAction overrides this to register them with the active RMW backend.

Default: no-op (Ok(())) — keeps every existing impl RosAction valid (RFC-0044 / phase-244 E3, non-breaking). Returns Err(()) on a backend registration failure; the caller maps it onto its own error type (nros-core cannot name nros-node::NodeError).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§