Rclcpp: [rclcpp_lifecycle] introduce new service for valid transitions to call

Created on 5 Sep 2018  路  10Comments  路  Source: ros2/rclcpp

All 10 comments

Beside the three PRs updating ros2lifecycle (list -> nodes and a new list showing the available transitions from the current state) and this looks :top:

CI:

Build Status
Build Status
Build Status

@Myzhar Do you mind having a look at this and let me know if this meets your expectations? I believe you have quite some experiences with the lifecycle implementation by now (given that you have been vocal about it on github and discourse).

The set of patches (branch lifecycle_refactor) implements a new service to get all available transitions for the current state as well as a service to introspect the state machine completely.

I will look at it with very pleasure and will let you know

@Karsten1987 I need a few suggestion on how to update my workspace with the patches introduced with the lifecycle_refactor branch

so essentially you want to checkout the branches, right?

So in your workspace you can run the following command to do so:

vcs custom --git --args checkout lifecycle_refactor

If not, you should be able to go into each referenced repository and change the git branch manually.
These are:

  • demos
  • rclcpp
  • rcl
  • rcl_interfaces
  • ros2lifecycle

Ok, from Waffle I found the list of repositories that have been patched:

  • ros2/ros2cli
  • ros2/rcl_interfaces
  • ros2/demos
  • ros2/rcl
  • ros2/rclcpp

I launched a git checkout manually (I'm sure that a better method exists) for all of them and I was able to compile.

[Update: I received your previous comment while I was writing mine]

I modified the code of my node to follow the new returns type and the other modifications and I finally noticed that the command:
$ ros2 lifecycle set /zed/zed_node shutdown
works :+1:

This is also a very useful command:

$ ros2 lifecycle list /zed/zed_node 
- cleanup [2]
    Start: inactive
    Goal: cleaningup
- activate [3]
    Start: inactive
    Goal: activating
- shutdown [51]
    Start: inactive
    Goal: shuttingdown

I tried also to understand what kind of other modifications you have introduced, to see if I can get enhancements at code level, but it's not easy.

We do have the code review, so don't worry too much about that. It was more like to ask whether that gives you a solution to the issue you posted on discourse.
But then I'll take it, that it indeed works for you as well.

What I have not understood is if now it is possible to change state internally calling a transition.
I mainly think about going to "error processing" from, for example, a running thread... this is a possible situation reading the design documents, but not yet available until now (as far as I know).

To be more clear I explain my use case:
I'm writing the ROS2 driver for the Stereolabs ZED and ZED mini.
I configure everything and I open the camera in "on_configuring".
I start the grab thread in "on_activating".
But I have not a "lifecycle way" to handle a disconnection. I'd like to deactivate and cleanup to bring the node in a valid state waiting for a new configuration and activation.

This is how I understood the way of working with the Lifecycle node... if I'm right.

So from what I understand is that you want to shutdown the camera either when deactivate or cleanup is called? In both cases you have a callback for this.
Everything which is happening in other threads has to be manually managed. The callbacks are solely a trigger for it if you want.
You can trigger this callbacks programmatically on your lifecycle node by calling deactivate() or cleanup() on it.

Nevertheless, I am going to merge this then as it seems to fulfill the requirements described in your discourse post.

Was this page helpful?
0 / 5 - 0 ratings