Robotics StackExchange | Archived questions

[SOLVED] [ROS2 humble linux] Wait until a node has been destroyed in launch_testing

Hello. This is what I am trying to do:

  1. Create a lifecycle-managed C++ node using launch_testing
  2. Perform a test on the node
  3. Stop the node
  4. Wait until the node has been destroyed
  5. Exit the test

My question is: how would you approach problem 4.?


Here is what I came up with:

This is working somehow but it is ugly as hell. Why should I manually raise SIGINT just to destroy a node?

I have tried to use theTRANSITION_DESTROY but run into this bug.

Asked by LastStarDust on 2023-03-31 05:30:53 UTC

Comments

Answers

I solved the problem by adding this action to the launch description:

destroy_node = RegisterEventHandler(
    OnStateTransition(
        target_lifecycle_node=node,
        start_state="shuttingdown",
        goal_state="finalized",
        entities=[
            EmitEvent(event=ShutdownProcess(process_matcher=matches_action(node))),
        ],
    )
)

Asked by LastStarDust on 2023-03-31 08:22:16 UTC

Comments