rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle

Package Summary

Tags No category tags.
Version 0.1.7
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-01-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++.

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

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 answers.ros.org

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle

Package Summary

Tags No category tags.
Version 0.1.7
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-01-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++.

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

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 answers.ros.org

No version for distro noetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.

rclc_lifecycle package from rclc repo

rclc rclc_examples rclc_lifecycle

Package Summary

Tags No category tags.
Version 0.1.7
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-01-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++.

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

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 answers.ros.org

No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.