![]() |
rclc_lifecycle package from rclc reporclc rclc_examples rclc_lifecycle |
Package Summary
Tags | No category tags. |
Version | 1.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 | foxy |
Last Updated | 2021-03-26 |
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
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++.
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 for package rclc_lifecycle
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
Source Tutorials
Package Dependencies
Deps | Name | |
---|---|---|
1 | ament_cmake_ros | |
1 | ament_cmake_gtest | |
1 | ament_lint_auto | |
1 | ament_lint_common | |
1 | osrf_testing_tools_cpp | |
1 | rclc | |
1 | rcl_lifecycle | |
1 | lifecycle_msgs |
System Dependencies
Dependant Packages
Name | Repo | Deps |
---|---|---|
rclc_examples | github-ros2-rclc |
Launch files
Messages
Services
Plugins
Recent questions tagged rclc_lifecycle at answers.ros.org
![]() |
rclc_lifecycle package from rclc reporclc rclc_examples rclc_lifecycle |
Package Summary
Tags | No category tags. |
Version | 1.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 | foxy |
Last Updated | 2021-03-26 |
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
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++.
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 for package rclc_lifecycle
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
Source Tutorials
Package Dependencies
Deps | Name | |
---|---|---|
1 | ament_cmake_ros | |
1 | ament_cmake_gtest | |
1 | ament_lint_auto | |
1 | ament_lint_common | |
1 | osrf_testing_tools_cpp | |
1 | rclc | |
1 | rcl_lifecycle | |
1 | lifecycle_msgs |
System Dependencies
Dependant Packages
Name | Repo | Deps |
---|---|---|
rclc_examples | github-ros2-rclc |
Launch files
Messages
Services
Plugins
Recent questions tagged rclc_lifecycle at answers.ros.org
![]() |
rclc_lifecycle package from rclc reporclc 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 | master |
Last Updated | 2021-04-01 |
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
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++.
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 for package rclc_lifecycle
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
Source Tutorials
Package Dependencies
Deps | Name | |
---|---|---|
1 | ament_cmake_ros | |
1 | ament_cmake_gtest | |
1 | ament_lint_auto | |
1 | ament_lint_common | |
1 | osrf_testing_tools_cpp | |
1 | rclc | |
1 | rcl_lifecycle | |
1 | lifecycle_msgs |
System Dependencies
Dependant Packages
Name | Repo | Deps |
---|---|---|
rclc_examples | github-ros2-rclc |