ROS 2 lifecycle node self-transitioning
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!