Skip to content

Stateful event callbacks? #809

@TSNoble

Description

@TSNoble

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions