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;
const SEND_GOAL_SERVICE_HASH: &'static str = Self::ACTION_HASH;
const GET_RESULT_SERVICE_HASH: &'static str = Self::ACTION_HASH;
// 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)
Provided Associated Constants§
Sourceconst SEND_GOAL_SERVICE_HASH: &'static str = Self::ACTION_HASH
const SEND_GOAL_SERVICE_HASH: &'static str = Self::ACTION_HASH
RIHS hash of the <Action>_SendGoal SERVICE — the value a stock
rmw_zenoh_cpp client puts in the send_goal service keyexpr, distinct
from ACTION_HASH. A nano-ros action server must
advertise it (not the action hash) or a ROS 2 client’s send_goal query
keyexpr won’t match the server’s queryable (issue #0292). Generated
impl RosAction sets the real per-action value on Iron+; the default
keeps the historical (action-hash) behavior for hand-written impls and
Humble (where the placeholder hash makes all channels equal anyway).
Sourceconst GET_RESULT_SERVICE_HASH: &'static str = Self::ACTION_HASH
const GET_RESULT_SERVICE_HASH: &'static str = Self::ACTION_HASH
RIHS hash of the <Action>_GetResult SERVICE (issue #0292; see
SEND_GOAL_SERVICE_HASH).
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".