Function rcl_lifecycle_state_machine_init

Function Documentation

rcl_ret_t rcl_lifecycle_state_machine_init(rcl_lifecycle_state_machine_t *state_machine, rcl_node_t *node_handle, const rosidl_message_type_support_t *ts_pub_notify, const rosidl_service_type_support_t *ts_srv_change_state, const rosidl_service_type_support_t *ts_srv_get_state, const rosidl_service_type_support_t *ts_srv_get_available_states, const rosidl_service_type_support_t *ts_srv_get_available_transitions, const rosidl_service_type_support_t *ts_srv_get_transition_graph, const rcl_lifecycle_state_machine_options_t *state_machine_options)

Initialize state machine.

This function initialize the state machine: one publisher to publish transitions messages and a set of services to get information about states and transitions. If default_state is true then a new default state machine is initialized.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • state_machine[inout] struct to be initialized

  • node_handle[in] a valid (not finalized) handle to the node used to create the publisher and the services

  • ts_pub_notify[in] pointer to transition publisher, it used to publish the transitions

  • ts_srv_change_state[in] pointer to the service that allows to trigger changes on the state

  • ts_srv_get_state[in] pointer to the service that allows to get the current state

  • ts_srv_get_available_states[in] pointer to the service that allows to get the available states

  • ts_srv_get_available_transitions[in] pointer to the service that allows to get the available transitions

  • ts_srv_get_transition_graph[in] pointer to the service that allows to get transitions from the graph

  • state_machine_options[in] collection of config options for initializing the state machine

Returns:

RCL_RET_OK if the state machine was initialized successfully, or

Returns:

RCL_RET_INVALID_ARGUMENT if input params is NULL, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.