I tried with sending 10 messages, but unfortunately, it did not help. I was pretty sure about it, because I checked the topic and absolutely there was no zero Twist messages in that.
I also logged the PATH enironment variable and there was /opt/ros/foxy/bin so ros2 is on the path.
I also changed “ros2” to “ros3” to let the command 100% fail, but nothing happened. So maybe that stop_robot is not ran or its output/error is hiding somewhere.
When I run the stop_robot in an on_process_start event handler, it works. So there is a possibility, that I can not execute commands on shutdown.
Can anyone guide me to the right direction?
So any proposal is more than welcome which helps me stopping the robot when the node is exiting.
I re-phrase the requirements:
I’d like to publish a message into a topic when a node is stopped by CTRL+C.
It does not matter if you do it with a launch file or a python node or whatever.
Thank you in advance
Péter