Function rcl_take_dynamic_message

Function Documentation

rcl_ret_t rcl_take_dynamic_message(const rcl_subscription_t *subscription, rosidl_dynamic_typesupport_dynamic_data_t *dynamic_message, rmw_message_info_t *message_info, rmw_subscription_allocation_t *allocation)

Take a dynamic type message from a topic using a rcl subscription.

In contrast to rcl_take(), this function takes a dynamic type message with dynamic data taken directly from the middleware. It is the job of the caller to ensure that the type associated with the subscription matches, and that the subscription uses the dynamic type rosidl_message_type_support_t.

Apart from the differences above, this function behaves like rcl_take().

Attribute

Adherence

Allocates Memory

No

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • subscription[in] the handle to the subscription from which to take

  • dynamic_message[inout] pointer to a (pre-allocated) dynamic type message.

  • message_info[out] rmw struct which contains meta-data for the message

  • allocation[in] structure pointer used for memory preallocation (may be NULL)

Returns:

RCL_RET_OK if the message was taken, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_SUBSCRIPTION_INVALID if the subscription is invalid, or

Returns:

RCL_RET_BAD_ALLOC if allocating memory failed, or

Returns:

RCL_RET_SUBSCRIPTION_TAKE_FAILED if take failed but no error occurred in the middleware, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.