Skip to main content

ActionMsg

Trait ActionMsg 

Source
pub trait ActionMsg:
    'static
    + Send
    + Sync {
    type Goal: ActionGoal;
    type Result: ActionResult;
    type Feedback: TypeSupport + GetUUID;
    type GoalContent: TypeSupport;
    type ResultContent: TypeSupport + TryClone;
    type FeedbackContent: TypeSupport;

    // Required methods
    fn type_name() -> &'static str;
    fn new_goal_request(
        goal: Self::GoalContent,
        uuid: [u8; 16],
    ) -> <Self::Goal as ActionGoal>::Request;
    fn new_result_response(
        status: u8,
        result: Self::ResultContent,
    ) -> <Self::Result as ActionResult>::Response;
    fn new_feedback_message(
        feedback: Self::FeedbackContent,
        uuid: [u8; 16],
    ) -> Self::Feedback;

    // Provided methods
    fn type_support() -> *const c_void { ... }
    fn type_hash() -> Result<String, Error> { ... }
}
Expand description

Trait for ROS2 action message types.

Actions are more complex than services and include goals, results, and feedback messages.

Required Associated Types§

Source

type Goal: ActionGoal

The goal service type.

Source

type Result: ActionResult

The result service type.

Source

type Feedback: TypeSupport + GetUUID

The feedback message type.

Source

type GoalContent: TypeSupport

The goal content type (the actual goal data).

Source

type ResultContent: TypeSupport + TryClone

The result content type (the actual result data).

Source

type FeedbackContent: TypeSupport

The feedback content type (the actual feedback data).

Required Methods§

Source

fn type_name() -> &'static str

Returns the type name in DDS format.

Example: "example_interfaces::srv::dds_::AddTwoInts_"

This is used for Zenoh key expressions and type matching.

Source

fn new_goal_request( goal: Self::GoalContent, uuid: [u8; 16], ) -> <Self::Goal as ActionGoal>::Request

Create a new goal request with the given goal and UUID.

Source

fn new_result_response( status: u8, result: Self::ResultContent, ) -> <Self::Result as ActionResult>::Response

Create a new result response with the given status and result.

Source

fn new_feedback_message( feedback: Self::FeedbackContent, uuid: [u8; 16], ) -> Self::Feedback

Create a new feedback message with the given feedback and UUID.

Provided Methods§

Source

fn type_support() -> *const c_void

Returns an opaque pointer to the action type support structure.

Source

fn type_hash() -> Result<String, Error>

Returns the RIHS01 type hash for this message type.

§Implementation
  • For RCL: Returns empty string (hash is handled by rosidl typesupport)
  • For Zenoh: Computes hash from TypeDescription

The hash format is: RIHS01_<64_character_hex_sha256>

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§