Function rcl_action_cancel_response_init

Function Documentation

rcl_ret_t rcl_action_cancel_response_init(rcl_action_cancel_response_t *cancel_response, const size_t num_goals_canceling, const rcl_allocator_t allocator)

Initialize a rcl_action_cancel_response_t.

After calling this function on a rcl_action_cancel_response_t, it can be populated and used to process cancel requests with an action server using rcl_action_process_cancel_request().

Example usage:

#include <rcl/rcl.h>
#include <rcl_action/rcl_action.h>

rcl_action_cancel_response_t cancel_response =
  rcl_action_get_zero_initialized_cancel_response();
size_t num_goals_canceling = 10;
ret = rcl_action_cancel_response_init(
  &cancel_response,
  num_goals_canceling,
  rcl_get_default_allocator());
// ... error handling, and when done processing response, finalize
ret = rcl_action_cancel_response_fini(&cancel_response, rcl_get_default_allocator());
// ... error handling

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • cancel_response[out] a preallocated, zero-initialized, cancel response message to be initialized.

  • num_goals_canceling[in] the number of goals that are canceling to add to the response Must be greater than zero

  • allocator[in] a valid allocator

Returns:

RCL_RET_OK if cancel response was initialized successfully, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_ALREADY_INIT if the cancel response has already been initialized, or

Returns:

RCL_RET_BAD_ALLOC if allocating memory failed, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.