rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 4.0.2
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version humble
Last Updated 2023-12-15
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine:

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node;
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Register lifecycle services and optionally create callbacks for state changes. Executor needsto be equipped with 1 handle per node and per service:

// Executor
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
rclc_executor_init(
  &executor,
  &support.context,
  4,  // 1 for the node + 1 for each lifecycle service
  &allocator));
...

// Register lifecycle services
rclc_lifecycle_add_get_state_service(&lifecycle_node, &executor);
rclc_lifecycle_add_get_available_states_service(&lifecycle_node, &executor);
rclc_lifecycle_add_change_state_service(&lifecycle_node, &executor);

// Register lifecycle service callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);
rclc_lifecycle_register_on_activate(&lifecycle_node, &my_on_activate);
...

Cleaning Up

To clean everything up, do:

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);
...

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

  • Lifecycle services cannot yet be called via ros2 lifecycle CLI, e.g., ros2 lifecycle set /node configure. Instead use the ros2 service CLI, e.g., ros2 service call /node/change_state lifecycle_msgs/ChangeState "{transition: {id: 1, label: configure}}".
CHANGELOG

Changelog for package rclc_lifecycle

4.0.2 (2022-03-22)

  • none

4.0.1 (2022-07-20)

  • improved doxygen-generated API documentation (#301) (#302)

4.0.0 (2022-04-28)

  • updated version for Humble release

3.0.8 (2022-04-14)

  • Fix rclc lifecyle header (#279) (#281)

3.0.7 (2022-02-17)

  • no changes

3.0.6 (2022-01-25)

  • Create service context in main (#224)

3.0.5 (2021-11-23)

  • no change

3.0.4 (2021-11-17)

  • Provide lifecycle services in the rclc lifecycle nodes (#51)

3.0.3 (2021-07-28)

  • Version bump

3.0.2 (2021-07-26)

  • Version bump

3.0.1 (2021-07-17)

  • Added quality declaration statement

2.0.0 (2021-04-23)

  • added codecov support
  • new API of rcl_lifecycle in Rolling required major version bump

1.0.1 (2021-03-29)

  • Windows port
  • Compatibility sleep function (Windows, POSIX-OS)
  • Fixed RCL lifecycle API change for Rolling

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 5.0.1
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version iron
Last Updated 2023-12-14
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine:

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node;
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Register lifecycle services and optionally create callbacks for state changes. Executor needsto be equipped with 1 handle per node and per service:

// Executor
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
rclc_executor_init(
  &executor,
  &support.context,
  4,  // 1 for the node + 1 for each lifecycle service
  &allocator));
...

// Register lifecycle services
rclc_lifecycle_add_get_state_service(&lifecycle_node, &executor);
rclc_lifecycle_add_get_available_states_service(&lifecycle_node, &executor);
rclc_lifecycle_add_change_state_service(&lifecycle_node, &executor);

// Register lifecycle service callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);
rclc_lifecycle_register_on_activate(&lifecycle_node, &my_on_activate);
...

Cleaning Up

To clean everything up, do:

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);
...

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

  • Lifecycle services cannot yet be called via ros2 lifecycle CLI, e.g., ros2 lifecycle set /node configure. Instead use the ros2 service CLI, e.g., ros2 service call /node/change_state lifecycle_msgs/ChangeState "{transition: {id: 1, label: configure}}".
CHANGELOG

Changelog for package rclc_lifecycle

5.0.1 (2023-06-15)

  • no changes

3.0.9 (2023-03-22)

  • Added documentation (#301)

3.0.8 (2022-04-14)

  • Fix rclc lifecyle header (#279) (#281)

3.0.7 (2022-02-17)

  • no changes

3.0.6 (2022-01-25)

  • Create service context in main (#224)

3.0.5 (2021-11-23)

  • no change

3.0.4 (2021-11-17)

  • Provide lifecycle services in the rclc lifecycle nodes (#51)

3.0.3 (2021-07-28)

  • Version bump

3.0.2 (2021-07-26)

  • Version bump

3.0.1 (2021-07-17)

  • Added quality declaration statement

2.0.0 (2021-04-23)

  • added codecov support
  • new API of rcl_lifecycle in Rolling required major version bump

1.0.1 (2021-03-29)

  • Windows port
  • Compatibility sleep function (Windows, POSIX-OS)
  • Fixed RCL lifecycle API change for Rolling

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 6.1.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version rolling
Last Updated 2024-04-05
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine:

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node;
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Register lifecycle services and optionally create callbacks for state changes. Executor needsto be equipped with 1 handle per node and per service:

// Executor
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
rclc_executor_init(
  &executor,
  &support.context,
  4,  // 1 for the node + 1 for each lifecycle service
  &allocator));
...

// Register lifecycle services
rclc_lifecycle_add_get_state_service(&lifecycle_node, &executor);
rclc_lifecycle_add_get_available_states_service(&lifecycle_node, &executor);
rclc_lifecycle_add_change_state_service(&lifecycle_node, &executor);

// Register lifecycle service callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);
rclc_lifecycle_register_on_activate(&lifecycle_node, &my_on_activate);
...

Cleaning Up

To clean everything up, do:

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);
...

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

  • Lifecycle services cannot yet be called via ros2 lifecycle CLI, e.g., ros2 lifecycle set /node configure. Instead use the ros2 service CLI, e.g., ros2 service call /node/change_state lifecycle_msgs/ChangeState "{transition: {id: 1, label: configure}}".
CHANGELOG

Changelog for package rclc_lifecycle

6.1.0 (2023-06-15)

  • no changes

3.0.9 (2023-03-22)

  • Added documentation (#301)

3.0.8 (2022-04-14)

  • Fix rclc lifecyle header (#279) (#281)

3.0.7 (2022-02-17)

  • no changes

3.0.6 (2022-01-25)

  • Create service context in main (#224)

3.0.5 (2021-11-23)

  • no change

3.0.4 (2021-11-17)

  • Provide lifecycle services in the rclc lifecycle nodes (#51)

3.0.3 (2021-07-28)

  • Version bump

3.0.2 (2021-07-26)

  • Version bump

3.0.1 (2021-07-17)

  • Added quality declaration statement

2.0.0 (2021-04-23)

  • added codecov support
  • new API of rcl_lifecycle in Rolling required major version bump

1.0.1 (2021-03-29)

  • Windows port
  • Compatibility sleep function (Windows, POSIX-OS)
  • Fixed RCL lifecycle API change for Rolling

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 6.0.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version master
Last Updated 2023-06-23
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine:

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node;
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Register lifecycle services and optionally create callbacks for state changes. Executor needsto be equipped with 1 handle per node and per service:

// Executor
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
rclc_executor_init(
  &executor,
  &support.context,
  4,  // 1 for the node + 1 for each lifecycle service
  &allocator));
...

// Register lifecycle services
rclc_lifecycle_add_get_state_service(&lifecycle_node, &executor);
rclc_lifecycle_add_get_available_states_service(&lifecycle_node, &executor);
rclc_lifecycle_add_change_state_service(&lifecycle_node, &executor);

// Register lifecycle service callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);
rclc_lifecycle_register_on_activate(&lifecycle_node, &my_on_activate);
...

Cleaning Up

To clean everything up, do:

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);
...

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

  • Lifecycle services cannot yet be called via ros2 lifecycle CLI, e.g., ros2 lifecycle set /node configure. Instead use the ros2 service CLI, e.g., ros2 service call /node/change_state lifecycle_msgs/ChangeState "{transition: {id: 1, label: configure}}".
CHANGELOG

Changelog for package rclc_lifecycle

6.0.0 (2023-06-15)

  • no changes

3.0.9 (2023-03-22)

  • Added documentation (#301)

3.0.8 (2022-04-14)

  • Fix rclc lifecyle header (#279) (#281)

3.0.7 (2022-02-17)

  • no changes

3.0.6 (2022-01-25)

  • Create service context in main (#224)

3.0.5 (2021-11-23)

  • no change

3.0.4 (2021-11-17)

  • Provide lifecycle services in the rclc lifecycle nodes (#51)

3.0.3 (2021-07-28)

  • Version bump

3.0.2 (2021-07-26)

  • Version bump

3.0.1 (2021-07-17)

  • Added quality declaration statement

2.0.0 (2021-04-23)

  • added codecov support
  • new API of rcl_lifecycle in Rolling required major version bump

1.0.1 (2021-03-29)

  • Windows port
  • Compatibility sleep function (Windows, POSIX-OS)
  • Fixed RCL lifecycle API change for Rolling

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle

Package Summary

Tags No category tags.
Version 1.0.1
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version dashing
Last Updated 2021-07-20
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine.

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node = rcl_get_zero_initialized_node();
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =   
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Optionally create hooks for lifecycle state changes.

// declare callback
rcl_ret_t my_on_configure() {
  printf("  >>> lifecycle_node: on_configure() callback called.\n");
  return RCL_RET_OK;
}
...

// register callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);

Running

Change states of the lifecycle node, e.g.

bool publish_transition = true;
rc += rclc_lifecycle_change_state(
  &lifecycle_node,
  lifecycle_msgs__msg__Transition__TRANSITION_CONFIGURE,
  publish_transition);
rc += rclc_lifecycle_change_state(
  &lifecycle_node,
  lifecycle_msgs__msg__Transition__TRANSITION_ACTIVATE,
  publish_transition);
...

Except for error processing transitions, transitions are usually triggered from outside, e.g., by ROS 2 services.

Cleaning Up

To clean everything up, simply do

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

The state machine publishes state changes, however, lifecycle services are not yet exposed via ROS 2 services (tbd).

CHANGELOG

Changelog for package rclc_lifecycle

1.0.1 (2021-07-17)

  • Updated version

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 2.0.6
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version galactic
Last Updated 2023-01-25
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine:

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node;
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Register lifecycle services and optionally create callbacks for state changes. Executor needsto be equipped with 1 handle per node and per service:

// Executor
rclc_executor_t executor = rclc_executor_get_zero_initialized_executor();
rclc_executor_init(
  &executor,
  &support.context,
  4,  // 1 for the node + 1 for each lifecycle service
  &allocator));
...

// Register lifecycle services
rclc_lifecycle_add_get_state_service(&lifecycle_node, &executor);
rclc_lifecycle_add_get_available_states_service(&lifecycle_node, &executor);
rclc_lifecycle_add_change_state_service(&lifecycle_node, &executor);

// Register lifecycle service callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);
rclc_lifecycle_register_on_activate(&lifecycle_node, &my_on_activate);
...

Cleaning Up

To clean everything up, do:

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);
...

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

CHANGELOG

Changelog for package rclc_lifecycle

2.0.6 (2022-01-25)

  • Note regression in lifecycle services (#227)

2.0.5 (2021-11-08)

  • Bumped version

2.0.4 (2021-08-19)

  • Provide lifecycle services in the rclc lifecycle nodes

2.0.3 (2021-07-26)

  • Bumped version

2.0.2 (2021-07-17)

  • Bumped version

2.0.1 (2021-05-28)

  • added quality declaration

2.0.0 (2021-04-23)

  • added codecov support
  • new API of rcl_lifecycle in Rolling required major version bump

1.0.1 (2021-03-29)

  • Windows port
  • Compatibility sleep function (Windows, POSIX-OS)
  • Fixed RCL lifecycle API change for Rolling

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle rclc_parameter

Package Summary

Tags No category tags.
Version 1.1.2
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros2/rclc.git
VCS Type git
VCS Version foxy
Last Updated 2023-06-12
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

rclc lifecycle convenience methods.

Additional Links

No additional links.

Maintainers

  • Jan Staschulat

Authors

  • Arne Nordmann

The rclc_lifecycle package

Overview

The rclc_lifecycle package is a ROS 2 package and provides convenience functions to bundle a ROS Client Library (RCL) node with the ROS 2 Node Lifecycle state machine in the C programming language, similar to the rclcpp Lifecycle Node for C++.

The quality declaration is available in QUALITY_DECLARATION.md.

API

The API of the RCLC Lifecycle Node can be divided in several phases: Initialization, Running and Clean-Up.

Initialization

Creation of a lifecycle node as a bundle of an rcl node and the rcl Node Lifecycle state machine.

#include "rclc_lifecycle/rclc_lifecycle.h"

rcl_allocator_t allocator = rcl_get_default_allocator();
rclc_support_t support;
rcl_ret_t rc;

// create rcl node
rc = rclc_support_init(&support, argc, argv, &allocator);
rcl_node_t my_node = rcl_get_zero_initialized_node();
rc = rclc_node_init_default(&my_node, "lifecycle_node", "rclc", &support);

// rcl state machine
rcl_lifecycle_state_machine_t state_machine_ =   
  rcl_lifecycle_get_zero_initialized_state_machine();
...

// create the lifecycle node
rclc_lifecycle_node_t lifecycle_node;
rcl_ret_t rc = rclc_make_node_a_lifecycle_node(
  &lifecycle_node,
  &my_node,
  &state_machine_,
  &allocator);

Optionally create hooks for lifecycle state changes.

// declare callback
rcl_ret_t my_on_configure() {
  printf("  >>> lifecycle_node: on_configure() callback called.\n");
  return RCL_RET_OK;
}
...

// register callbacks
rclc_lifecycle_register_on_configure(&lifecycle_node, &my_on_configure);

Running

Change states of the lifecycle node, e.g.

bool publish_transition = true;
rc += rclc_lifecycle_change_state(
  &lifecycle_node,
  lifecycle_msgs__msg__Transition__TRANSITION_CONFIGURE,
  publish_transition);
rc += rclc_lifecycle_change_state(
  &lifecycle_node,
  lifecycle_msgs__msg__Transition__TRANSITION_ACTIVATE,
  publish_transition);
...

Except for error processing transitions, transitions are usually triggered from outside, e.g., by ROS 2 services.

Cleaning Up

To clean everything up, simply do

rc += rcl_lifecycle_node_fini(&lifecycle_node, &allocator);

Example

An example, how to use the RCLC Lifecycle Node is given in the file lifecycle_node.c in the rclc_examples package.

Limitations

  • The state machine publishes state changes, however, lifecycle services are not yet exposed via ROS 2 services. This has been added for rolling.
CHANGELOG

Changelog for package rclc_lifecycle

1.1.2 (2023-03-31)

  • Fix rclc lifecyle header (#279) (#280)
  • added documentation (#301) (#304)

1.1.1 (2022-03-16)

  • no changes

1.1.0 (2022-01-25)

  • Note wrt services implemented for rolling (#226)

1.0.2 (2021-07-17)

  • Bumped version (tag with version 1.0.1 already exists)

1.0.1 (2021-07-17)

  • Added quality declaration statement
  • Added windows compatability

1.0.0 (2021-03-04)

  • Updated version

0.1.7 (2021-01-20)

  • Updated version

0.1.6 (2021-01-20)

  • Updated version

0.1.5 (2020-12-11)

  • Updated version

0.1.4 (2020-11-25)

  • Fixed error in bloom release

0.1.3 (2020-11-23)

  • Aligned version number to rclc repository

0.1.0 (2020-11-23)

  • Initial release

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged rclc_lifecycle at Robotics Stack Exchange