Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autostarting lifecycle nodes and example launch file demo #430

Merged
merged 23 commits into from
Feb 19, 2025

Conversation

SteveMacenski
Copy link
Contributor

@SteveMacenski SteveMacenski commented Dec 20, 2024

This resolves #418 which implements autostarting lifecycle nodes. This is complete and ready for a review

You'll notice a couple of key changes worth explaining:

  1. There is a new is_lifecycle_node attribute of the node and lifecycle nodes which is needed to remove a circular dependency on the LifecycleNode within the LifecycleTransition class which only is type checking. I replace this type check with checking if a non-None object (1) has the attribute at all and (2) has a lifecycle attribute with appropriate logging between the difference of a non-lifecycle node being attempted vs a non-node. This has been tested as well to function using the demos.

  2. You will also notice that I refactored lifecycle node to have a separate util LifecycleEventManager, who handles the event emitting, handling, and topic listening for lifecycle nodes. This way, this can be used in lifecycle-components as well! No changes were made here except removing the self.__current_state variable which was completely unused. The LifecycleEventManager is only created if the node requests autostart at Launch time and otherwise has no overhead nor exposes the interfaces/event handler/emitter if its a non-lifecycle node.

  3. The component nodes don't add a / before the node names with the namespaces. This messes with the node event matcher. I add in a leading / so that the action.node_name == node_name which has the / forcably applied in the node event matcher

  4. I tested LifecycleNode, ComposableNodeContainer, LoadCompoableNodes for all cases: autostart=True autostart=False, and autostart field not supplied. You can also run any experiments you like using the 2 extra launch files I provide in the examples directory which shows all the features at work/

@SteveMacenski
Copy link
Contributor Author

@mjcarroll can I get a review on this now that we're back from the holidays? :-)

@doisyg
Copy link

doisyg commented Jan 6, 2025

That would be amazing to have this part of the standard launch!
(and I can already think about a next step: choose if you want to start in Unconfigured, Inactive or Active)

@SteveMacenski
Copy link
Contributor Author

@mjcarroll can I request a review? ❤️

@wjwwood wjwwood self-assigned this Jan 16, 2025
@wjwwood wjwwood self-requested a review January 16, 2025 18:30
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions, but looking pretty good. Thanks for the contribution!

@wjwwood wjwwood removed their assignment Jan 16, 2025
@SteveMacenski SteveMacenski requested a review from wjwwood January 17, 2025 03:25
@SteveMacenski
Copy link
Contributor Author

SteveMacenski commented Jan 17, 2025

@wjwwood I addressed all of your comments and made a fix by your review requests

@wjwwood
Copy link
Member

wjwwood commented Jan 28, 2025

I sent a few responses, resolved a few others. Sorry it took so long to reply, I'll try to be quicker on the next iteration. Thanks again!

@SteveMacenski
Copy link
Contributor Author

SteveMacenski commented Jan 30, 2025

I appreciate it, I know this isn't the most active project in the ROS core ecosystem, so I appreciate the attention here :-)

I think I've completed all of the tasks that need to be addressed

@wjwwood
Copy link
Member

wjwwood commented Feb 4, 2025

Sorry, one more iteration on the matchers.

@SteveMacenski
Copy link
Contributor Author

See updated comment :-)

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks really close

I continued our conversation on the other thread, and pointed out a potential issue with how autostart is being typed and documented. Other than that, it's mostly cleanup requests after your most recent set of changes.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, after re-reviewing the new class you recently added I found some more things that should be looked into.

@SteveMacenski SteveMacenski requested a review from wjwwood February 7, 2025 23:46
@SteveMacenski
Copy link
Contributor Author

SteveMacenski commented Feb 7, 2025

@wjwwood all of your comments have been addressed, I believe fully now.

I see I must have missed a DCO sign off on my commits, but I really don't want to mess with the git commit history bc I know that'll cause you more trouble re-reviewing not knowing what exactly I just changed.

As the CEO of my own company, I trust that I can just say I give myself permissions to do this. I can also fix DCO after you review and approve if you like. I just don't want to make your life hard.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Had a few non-blocking questions, but I think this is good to go with passing CI.

@wjwwood
Copy link
Member

wjwwood commented Feb 11, 2025

Rpr looks like it is failing due to a few small linter issues. After you fix that I'll run full CI with Windows and everything on ci.ros2.org unless someone else beats me to it.

Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
@SteveMacenski
Copy link
Contributor Author

Should be good to go. I also resolved the DCO sign off

@wjwwood
Copy link
Member

wjwwood commented Feb 12, 2025

Looks like there's a test failure on the Rpr job, can you have a look and see if it's related/reproducible?

Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
@SteveMacenski
Copy link
Contributor Author

I don't think it relates to this - I just pushed a couple of new commits to fix your last 2 items - so we'll see :- )

@SteveMacenski
Copy link
Contributor Author

SteveMacenski commented Feb 12, 2025

All passing now.

Any chance for a backport to Jazzy? This would be a really nice feature that could make some folks I'm talking to move to Jazzy if it were available

@wjwwood
Copy link
Member

wjwwood commented Feb 18, 2025

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@wjwwood
Copy link
Member

wjwwood commented Feb 19, 2025

CI looks good, so I'm going to merge this now. Thanks again for the contribution!

Any chance for a backport to Jazzy? This would be a really nice feature that could make some folks I'm talking to move to Jazzy if it were available

I think it should be fine to do so. The only changes to the API seem to be backwards compatible. Generally we don't backport features due to the risk of regression, but we can make exceptions when the risk is low. I'll ask for a second opinion on that though. I can at least open the pr for the backport and let another maintainer review/merge it as my second opinion.

@wjwwood wjwwood merged commit 3569f0d into ros2:rolling Feb 19, 2025
3 checks passed
@wjwwood
Copy link
Member

wjwwood commented Feb 19, 2025

@Mergifyio backport jazzy

Copy link

mergify bot commented Feb 19, 2025

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 19, 2025
* autostarting lifecycle nodes and example

Signed-off-by: Steve Macenski <[email protected]>

* fix linting

Signed-off-by: Steve Macenski <[email protected]>

* fix linting

Signed-off-by: Steve Macenski <[email protected]>

* removing an unused variable

Signed-off-by: Steve Macenski <[email protected]>

* initializing a member client as none like sub

Signed-off-by: Steve Macenski <[email protected]>

* completing auto-start feature for composition nodes

Signed-off-by: Steve Macenski <[email protected]>

* linting

Signed-off-by: Steve Macenski <[email protected]>

* final linting fix

Signed-off-by: Steve Macenski <[email protected]>

* Resolving issue with StateTransition messages

Signed-off-by: Steve Macenski <[email protected]>

* removing Node's autostart

Signed-off-by: Steve Macenski <[email protected]>

* Fixing lifecyclenode type

Signed-off-by: Steve Macenski <[email protected]>

* update docstring

Signed-off-by: Steve Macenski <[email protected]>

* adding in composable lifecycle node

Signed-off-by: Steve Macenski <[email protected]>

* Adding docstring

Signed-off-by: Steve Macenski <[email protected]>

* require autostart non-None

Signed-off-by: Steve Macenski <[email protected]>

* remove unused imports

Signed-off-by: Steve Macenski <[email protected]>

* review comments continued

Signed-off-by: Steve Macenski <[email protected]>

* is lifecycle node and autostart to lifecycle-only classes

Signed-off-by: Steve Macenski <[email protected]>

* final bits

Signed-off-by: Steve Macenski <[email protected]>

* whoops, remove the Avatar-inspired printout

Signed-off-by: Steve Macenski <[email protected]>

* finish linting

Signed-off-by: Steve Macenski <[email protected]>

* review fix

Signed-off-by: Steve Macenski <[email protected]>

* remove old import

Signed-off-by: Steve Macenski <[email protected]>

---------

Signed-off-by: Steve Macenski <[email protected]>
(cherry picked from commit 3569f0d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create option for automatic bringup of lifecycle nodes in launch_ros API
3 participants