Ask Your Question
2

ROS 2 lifecycle node self-transitioning

asked 2020-04-06 15:23:39 -0500

tbh gravatar image

I am experimenting with giving one of my nodes a lifecycle:

From the ROS 2 node lifecycle design document in regards to the management interface of lifecycle nodes:

It is expected that a common pattern will be to have a container class which loads a managed node implementation from a library and through a plugin architecture automatically exposes the required management interface via methods and the container is not subject to the lifecycle management. ... These services may also be provided via attributes and method calls (for local management) in addition to being exposed ROS messages and topics/services (for remote management).

Also from the design document, in the section after the above in regards to transitioning among the lifecycle states:

Most state transitions are expected to be coordinated by an external management tool which will provide the node with its configuration and start it. The external management tool is also expected monitor it and execute recovery behaviors in case of failures. ... And a node could be configured to self manage, however this is discouraged as this will interfere with external logic trying to manage the node via the interface.

There is one transition expected to originate locally, which is the ERROR transition.

So the lifecycle command line utilities and lifecycle rqt plugins would be examples of external management tools referenced. I would also classify the python launch files that control the lifecycle to be external tools (that could fight with the command line/rqt tools since the python launch files will be automatic). But even if it's discouraged, I think my node will need to self-transition. Maybe a container class like the one referenced could do the self transitioning I require, though I'm not sure. So...

Are there any examples of lifecycle nodes self-transitioning with the ERROR transition or examples of container classes that orchestrate lifecycle transitions of loaded node implementations? I can find the lifecycle code and demos for rclcpp_lifecycle, but no nice documented API page.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-04-10 12:01:29 -0500

tbh gravatar image

updated 2020-04-16 09:40:25 -0500

The transition from active to error processing does not exist in the current lifecycle state machine, so as it is, this is currently impossible. This question and this issue (which was marked as a duplicate) is essentially the same as mine. The answer there says to trigger change of state manually with the configure, cleanup, activate, deactivate, and shutdown member functions of lifecycle node, even though that was "discouraged" in the design document. However I think there is use for a transition directly from active to error processing as well as from inactive to error processing.

I have created a series of pull requests implementing this functionality: rcl_interfaces#97, rcl#618, rclcpp#1064, and to show how it is used, demos#436.

It would still be nice to have an example of the container class. I may ask that in another question later on, but for now, my new error transition will meet my needs.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-04-06 15:23:39 -0500

Seen: 44 times

Last updated: Apr 16