rcl_action
master
C API providing common functionality for ROS actions.
|
#include "rcl_action/visibility_control.h"
#include "action_msgs/msg/goal_info.h"
#include "action_msgs/msg/goal_status.h"
#include "action_msgs/msg/goal_status_array.h"
#include "action_msgs/srv/cancel_goal.h"
#include "rcl/allocator.h"
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rosidl_generator_c/action_type_support_struct.h"
Go to the source code of this file.
Classes | |
struct | rcl_action_goal_status_array_t |
struct | rcl_action_cancel_response_t |
Macros | |
#define | RCL_RET_ACTION_NAME_INVALID 2000 |
Action name does not pass validation return code. More... | |
#define | RCL_RET_ACTION_GOAL_ACCEPTED 2100 |
Action goal accepted return code. More... | |
#define | RCL_RET_ACTION_GOAL_REJECTED 2101 |
Action goal rejected return code. More... | |
#define | RCL_RET_ACTION_CLIENT_INVALID 2102 |
Action client is invalid return code. More... | |
#define | RCL_RET_ACTION_CLIENT_TAKE_FAILED 2103 |
Action client failed to take response return code. More... | |
#define | RCL_RET_ACTION_SERVER_INVALID 2200 |
Action server is invalid return code. More... | |
#define | RCL_RET_ACTION_SERVER_TAKE_FAILED 2201 |
Action server failed to take request return code. More... | |
#define | RCL_RET_ACTION_GOAL_HANDLE_INVALID 2300 |
Action goal handle invalid return code. More... | |
#define | RCL_RET_ACTION_GOAL_EVENT_INVALID 2301 |
Action invalid event return code. More... | |
#define | UUID_SIZE 16 |
#define | uuidcmp(uuid0, uuid1) (0 == memcmp(uuid0, uuid1, UUID_SIZE)) |
#define | zerouuid (uint8_t[UUID_SIZE]) {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
#define | uuidcmpzero(uuid) uuidcmp(uuid, (zerouuid)) |
#define | GOAL_STATE_UNKNOWN action_msgs__msg__GoalStatus__STATUS_UNKNOWN |
#define | GOAL_STATE_ACCEPTED action_msgs__msg__GoalStatus__STATUS_ACCEPTED |
#define | GOAL_STATE_EXECUTING action_msgs__msg__GoalStatus__STATUS_EXECUTING |
#define | GOAL_STATE_CANCELING action_msgs__msg__GoalStatus__STATUS_CANCELING |
#define | GOAL_STATE_SUCCEEDED action_msgs__msg__GoalStatus__STATUS_SUCCEEDED |
#define | GOAL_STATE_CANCELED action_msgs__msg__GoalStatus__STATUS_CANCELED |
#define | GOAL_STATE_ABORTED action_msgs__msg__GoalStatus__STATUS_ABORTED |
#define | GOAL_STATE_NUM_STATES 7 |
Typedefs | |
typedef struct rcl_action_server_t | rcl_action_server_t |
typedef action_msgs__msg__GoalInfo | rcl_action_goal_info_t |
typedef action_msgs__msg__GoalStatus | rcl_action_goal_status_t |
typedef struct rcl_action_goal_status_array_t | rcl_action_goal_status_array_t |
typedef action_msgs__srv__CancelGoal_Request | rcl_action_cancel_request_t |
typedef struct rcl_action_cancel_response_t | rcl_action_cancel_response_t |
typedef int8_t | rcl_action_goal_state_t |
Goal states. More... | |
typedef enum rcl_action_goal_event_t | rcl_action_goal_event_t |
Goal state transition events. More... | |
Enumerations | |
enum | rcl_action_goal_event_t { GOAL_EVENT_EXECUTE = 0, GOAL_EVENT_CANCEL_GOAL, GOAL_EVENT_SUCCEED, GOAL_EVENT_ABORT, GOAL_EVENT_CANCELED, GOAL_EVENT_NUM_EVENTS } |
Goal state transition events. More... | |
Variables | |
const char * | goal_state_descriptions [] |
User friendly error messages for invalid trasntions. More... | |
const char * | goal_event_descriptions [] |
#define RCL_RET_ACTION_NAME_INVALID 2000 |
Action name does not pass validation return code.
#define RCL_RET_ACTION_GOAL_ACCEPTED 2100 |
Action goal accepted return code.
#define RCL_RET_ACTION_GOAL_REJECTED 2101 |
Action goal rejected return code.
#define RCL_RET_ACTION_CLIENT_INVALID 2102 |
Action client is invalid return code.
#define RCL_RET_ACTION_CLIENT_TAKE_FAILED 2103 |
Action client failed to take response return code.
#define RCL_RET_ACTION_SERVER_INVALID 2200 |
Action server is invalid return code.
#define RCL_RET_ACTION_SERVER_TAKE_FAILED 2201 |
Action server failed to take request return code.
#define RCL_RET_ACTION_GOAL_HANDLE_INVALID 2300 |
Action goal handle invalid return code.
#define RCL_RET_ACTION_GOAL_EVENT_INVALID 2301 |
Action invalid event return code.
#define UUID_SIZE 16 |
#define uuidcmp | ( | uuid0, | |
uuid1 | |||
) | (0 == memcmp(uuid0, uuid1, UUID_SIZE)) |
#define zerouuid (uint8_t[UUID_SIZE]) {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} |
#define GOAL_STATE_UNKNOWN action_msgs__msg__GoalStatus__STATUS_UNKNOWN |
#define GOAL_STATE_ACCEPTED action_msgs__msg__GoalStatus__STATUS_ACCEPTED |
#define GOAL_STATE_EXECUTING action_msgs__msg__GoalStatus__STATUS_EXECUTING |
#define GOAL_STATE_CANCELING action_msgs__msg__GoalStatus__STATUS_CANCELING |
#define GOAL_STATE_SUCCEEDED action_msgs__msg__GoalStatus__STATUS_SUCCEEDED |
#define GOAL_STATE_CANCELED action_msgs__msg__GoalStatus__STATUS_CANCELED |
#define GOAL_STATE_ABORTED action_msgs__msg__GoalStatus__STATUS_ABORTED |
#define GOAL_STATE_NUM_STATES 7 |
typedef struct rcl_action_server_t rcl_action_server_t |
typedef action_msgs__msg__GoalInfo rcl_action_goal_info_t |
typedef action_msgs__msg__GoalStatus rcl_action_goal_status_t |
typedef struct rcl_action_goal_status_array_t rcl_action_goal_status_array_t |
typedef action_msgs__srv__CancelGoal_Request rcl_action_cancel_request_t |
typedef struct rcl_action_cancel_response_t rcl_action_cancel_response_t |
typedef int8_t rcl_action_goal_state_t |
Goal states.
typedef enum rcl_action_goal_event_t rcl_action_goal_event_t |
Goal state transition events.
RCL_ACTION_PUBLIC rcl_action_goal_info_t rcl_action_get_zero_initialized_goal_info | ( | void | ) |
Return a rcl_action_goal_info_t with members set to zero values.
RCL_ACTION_PUBLIC rcl_action_goal_status_array_t rcl_action_get_zero_initialized_goal_status_array | ( | void | ) |
Return a rcl_action_goal_status_array_t with members set to NULL
.
Should be called to get a null rcl_action_goal_status_array_t before passing to rcl_action_server_get_goal_status_array().
RCL_ACTION_PUBLIC rcl_action_cancel_request_t rcl_action_get_zero_initialized_cancel_request | ( | void | ) |
Return a rcl_action_cancel_request_t with members set to NULL
.
Should be called to get a null rcl_action_cancel_request_t before passing to
rcl_action_cancel_request_init().
RCL_ACTION_PUBLIC rcl_action_cancel_response_t rcl_action_get_zero_initialized_cancel_response | ( | void | ) |
Return a rcl_action_cancel_response_t with members set to NULL
.
Should be called to get a null rcl_action_cancel_response_t before passing to rcl_action_cancel_response_init().
RCL_ACTION_PUBLIC rcl_ret_t rcl_action_goal_status_array_init | ( | rcl_action_goal_status_array_t * | status_array, |
const size_t | num_status, | ||
const rcl_allocator_t | allocator | ||
) |
Initialize a rcl_action_goal_status_array_t.
After calling this function on a rcl_action_goal_status_array_t, it can be populated and used to get and send status array messages with an action server using rcl_action_get_goal_status_array() and rcl_action_publish_status() respectively.
Example usage:
Attribute | Adherence |
---|---|
Allocates Memory | Yes |
Thread-Safe | No |
Uses Atomics | No |
Lock-Free | Yes |
[out] | status_array | a preallocated, zero-initialized, goal status array message to be initialized. |
[in] | num_status | the number of status messages to allocate space for. Must be greater than zero |
[in] | allocator | a valid allocator |
RCL_RET_OK
if cancel response was initialized successfully, or RCL_RET_INVALID_ARGUMENT
if any arguments are invalid, or RCL_RET_ALREADY_INIT
if the status array has already been initialized, or RCL_RET_BAD_ALLOC
if allocating memory failed, or RCL_RET_ERROR
if an unspecified error occurs. RCL_ACTION_PUBLIC rcl_ret_t rcl_action_goal_status_array_fini | ( | rcl_action_goal_status_array_t * | status_array | ) |
Finalize a rcl_action_goal_status_array_t.
After calling, the goal status array message will no longer be valid.
Attribute | Adherence |
---|---|
Allocates Memory | Yes |
Thread-Safe | No |
Uses Atomics | No |
Lock-Free | Yes |
[in,out] | status_array | the goal status array message to be deinitialized |
RCL_RET_OK
if the goal status array was deinitialized successfully, or RCL_RET_INVALID_ARGUMENT
if any arguments are invalid, or RCL_RET_ERROR
if an unspecified error occurs. RCL_ACTION_PUBLIC 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:
Attribute | Adherence |
---|---|
Allocates Memory | Yes |
Thread-Safe | No |
Uses Atomics | No |
Lock-Free | Yes |
[out] | cancel_response | a preallocated, zero-initialized, cancel response message to be initialized. |
[in] | num_goals_canceling | the number of goals that are canceling to add to the response Must be greater than zero |
[in] | allocator | a valid allocator |
RCL_RET_OK
if cancel response was initialized successfully, or RCL_RET_INVALID_ARGUMENT
if any arguments are invalid, or RCL_RET_ALREADY_INIT
if the cancel response has already been initialized, or RCL_RET_BAD_ALLOC
if allocating memory failed, or RCL_RET_ERROR
if an unspecified error occurs. RCL_ACTION_PUBLIC rcl_ret_t rcl_action_cancel_response_fini | ( | rcl_action_cancel_response_t * | cancel_response | ) |
Finalize a rcl_action_cancel_response_t.
After calling, the cancel response message will no longer be valid.
Attribute | Adherence |
---|---|
Allocates Memory | Yes |
Thread-Safe | No |
Uses Atomics | No |
Lock-Free | Yes |
[in,out] | cancel_response | the cancel response message to be deinitialized |
RCL_RET_OK
if the cancel response was deinitialized successfully, or RCL_RET_INVALID_ARGUMENT
if any arguments are invalid, or RCL_RET_ERROR
if an unspecified error occurs. const char* goal_state_descriptions[] |
User friendly error messages for invalid trasntions.
const char* goal_event_descriptions[] |