ros2_documentation icon indicating copy to clipboard operation
ros2_documentation copied to clipboard

Add a tutorial on Lifecycle nodes

Open Yadunund opened this issue 11 months ago • 16 comments

Extend the Intermediate tutorials with a chapter on implementing Lifecycle nodes and designing APIs using NodeInterfaces such that the APIs work with both regular Nodes and LifecycleNodes.

  • [ ] Add a tutorial on implementing lifecycle nodes, their various on_* methods, transitioning states via cli commands & launch actions.
  • [x] Add a tutorial designing APIs using NodeInterfaces: https://github.com/ros2/ros2_documentation/pull/4992

Yadunund avatar Jan 06 '25 18:01 Yadunund

Just for clarity here, you are asking for an example node that implements both the standard node interface and the lifecycle node interface.

Roughly this means that the standard node interface performs the primary state's / transitions when it is instantiated as a standard node? If this is the case, it might be helpful to have a paster template that people can re-use as a starting point.

Do you have a good example of NodeInterfaces being used with a lifecycle node out in the wild? Even tests might be helpful here.

kscottz avatar Jan 07 '25 22:01 kscottz

I was alluding to following the pattern described by @methylDragon in his lightning talk.

This would encourage more users to use LifecycleNodes while keeping other APIs compatible with both Node and LifecycleNode.

Yadunund avatar Jan 09 '25 18:01 Yadunund

Perfect. Thanks. I can work with this! I may even be able to find a new contributor to do it.

kscottz avatar Jan 09 '25 19:01 kscottz

This issue has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-news-for-the-week-of-january-13th-2024/41608/1

ros-discourse avatar Jan 17 '25 20:01 ros-discourse

This issue has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-news-for-the-week-of-january-20th-2025/41719/1

ros-discourse avatar Jan 24 '25 19:01 ros-discourse

I may even be able to find a new contributor to do it.

Is there a way I can be of assistance? Im not an expert by any means but i would like to get my hands dirty with this one.

NickTziaros avatar Jan 25 '25 10:01 NickTziaros

@NickTziaros by all means! Give it a shot.

Make sure to take a look at the docs readme and the contributing guide. Make sure to put your editor into whitespace mode as the linter is really particular.

kscottz avatar Jan 27 '25 22:01 kscottz

Thanks for the help @NickTziaros.

kscottz avatar Feb 11 '25 17:02 kscottz

So we're still missing a tutorial on implementing lifecycle nodes, their various on_* methods, transitioning states via cli commands & launch actions. @NickTziaros's addition can be extended to include these topics. Should we keep this ticket open or open a separate one?

Yadunund avatar Feb 12 '25 01:02 Yadunund

@Yadunund good eye, let's reopen this.

fujitatomoya avatar Feb 12 '25 03:02 fujitatomoya

I've updated the description accordingly 👍🏼

Yadunund avatar Feb 12 '25 06:02 Yadunund

Good catch @Yadunund. Sorry about that.

On the other hand we really need to work towards smaller, faster pull requests and this fits that pattern.

kscottz avatar Feb 12 '25 17:02 kscottz

So we're still missing a tutorial on implementing lifecycle nodes, their various on_* methods, transitioning states via cli commands & launch actions

I might as well make this one too :D

NickTziaros avatar Feb 15 '25 22:02 NickTziaros

I made a PR #5038, adding

+Output:
+ 

above

[INFO] [Simple_Node]: Node name: Simple_Node 
[INFO] [Simple_LifeCycle_Node]: Node name: Simple_LifeCycle_Node

for consistency. Somehow I missed it the first time.

NickTziaros avatar Feb 16 '25 17:02 NickTziaros

I noticed that there is already a quite thorough tutorial on Lifecycle nodes code in the Demo section under Managing nodes with managed lifecycles. Wouldn't it be redundant if we added another? Additionaly, the link rosindex is broken.

NickTziaros avatar Mar 12 '25 13:03 NickTziaros

@NickTziaros I think we're fine with a little redundancy but we should cross reference the two.

With respect to ROS Index we've been doing some work to improve index search and remove redundant package listings. I think this is the package that we should have there.

kscottz avatar Mar 12 '25 22:03 kscottz