ros2 / ros2/launch

Stateful event callbacks?

Open
#809 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Feature request

(This is more of a series of question, but ros-answers seems to be down currently)

Problem

Most of our nodes are required, and on shutdown, I'd like to detect any unsuccessful exit codes and display a popup with a link to support for our software (essentially a kind of crashpad background service). I'm wondering if this is possible using OnProcessExit event handlers within roslaunch.

I've tried a few adding OnProcesExit event handlers to our top-level launch construct but, since the callback is stateless, this displays a popup for every failed process. These popups are also blocking, which then causes SIGINT escalation, leading to more popups for the nodes that were blocked on shutting down.

Feature description
  • Adding the ability to use stateful callbacks OR
  • Adding the ability for a callback to publish to a topic, so a node can handle the state.
Implementation considerations
  • I've considered creating a custom node which launches outside of our main launchfile to keep state, but this relies on being able to publish the OnProcessExit information within the event handler callback. This also feels like a lot of un-necessary boilerplate on the node side.

  • I'm wondering if it's already possible to implement stateful callbacks by defining a class in the launchfile and using a method as the callback, but I'm unsure where this class would be instantiated and what its lifecycle would be tied to

  • Alternatively, I'm wondering if it's possible to achieve the above by using a reentrant function as the callback for collecting the state, and a separate event handler (OnShutdown?) to terminate the function and use the results?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OnProcessExit event handler behavior described in the issue, then examine how callback state and lifecycle would work when defined in a launchfile. Compare the stateful-callback and topic-publication options, and consider the interaction with OnShutdown; done should provide a way to aggregate process failures without repeated blocking popups.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.