Killing ros2 processes
How should ros2 processes be killed? Can it be done safely from python?
It seems like some ros2 packages have just issue of not closing even after sending shutdown signal, for example moveit stays alive even after sending SIGINT signal or shutdown ros python api.
The https://github.com/RobotecAI/rai/commit/1e46ed7751346a5270e0bf24e5d4e69fb5679399 version escalates signal from SIGINT up to KILL for the process that called ros2 launch, but it doesnt ensure that child processes will close
the newer solution -> https://github.com/RobotecAI/rai/pull/581, uses LaunchService which gives more control over the execution via ros2 python api but the problem stays the same.
If we need to 100% ensure that the nodes are closed, we probably would need to send pkill signals to every process
tried to apply approach from https://github.com/RobotecAI/rai/pull/445 to monitor processes, shutting down everything when any process is down, then starting all of them once again - That would be great for long running benchmarks, when something crashes, benchmark will continue after starting all processes again. Unfortunately i didn`t manage to force ros2 processes to behave properly so i leave it for now. maybe I'll come back to it when I have more time.
For now if something crashes mid running, the results are saved after every scenario so they wont be lost, but reruning rest of the scenarios will require doing it manually.