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 actionResult: Returned by server when action completesFeedback: Sent by server during execution to report progress
Wire envelopes (auto-emitted by nros generate rust):
SendGoalRequest/SendGoalResponse:<Action>_SendGoalservice shapeGetResultRequest/GetResultResponse:<Action>_GetResultservice shapeFeedbackMessage:<Action>_FeedbackMessagetopic shape
Required Associated Constants§
Sourceconst ACTION_NAME: &'static str
const ACTION_NAME: &'static str
Action type name (e.g., “example_interfaces::action::dds_::Fibonacci_”)
Sourceconst ACTION_HASH: &'static str
const ACTION_HASH: &'static str
Type hash for discovery (RIHS format)
Required Associated Types§
Sourcetype Goal: RosMessage
type Goal: RosMessage
Goal message sent by client to initiate the action
Sourcetype Result: RosMessage + Default
type Result: RosMessage + Default
Result message returned by server upon completion
Sourcetype Feedback: RosMessage
type Feedback: RosMessage
Feedback message sent by server during execution
Sourcetype SendGoalRequest: RosMessage
type SendGoalRequest: RosMessage
<Action>_SendGoal_Request service envelope (wire-level send-goal request)
Sourcetype SendGoalResponse: RosMessage
type SendGoalResponse: RosMessage
<Action>_SendGoal_Response service envelope (wire-level send-goal reply)
Sourcetype GetResultRequest: RosMessage
type GetResultRequest: RosMessage
<Action>_GetResult_Request service envelope (wire-level get-result request)
Sourcetype GetResultResponse: RosMessage
type GetResultResponse: RosMessage
<Action>_GetResult_Response service envelope (wire-level get-result reply)
Sourcetype FeedbackMessage: RosMessage
type FeedbackMessage: RosMessage
<Action>_FeedbackMessage topic envelope (wire-level feedback message)
Provided Methods§
Sourcefn register_protocol_types() -> Result<(), ()>
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.