ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As the node was started as root it was not possible for it to catch ctrl+c
I could use rosnode kill to kill the node but in my case I wanted the node to die after ctrl+c
ed my Launchfile.
So I had two options:
Find a way to run `Pigpio with a non-root user
Find a way to kill the node started as root with the ctrl+c
of the launchfile
I didn't find any way to use Pigpio without root, so I went for the second option.
I created a second node in the same package that was publishing a topic (with an empty msg) and added it to the launchfile (without sudo for this one). In the node started as Root I added a subscriber for this topic. And if I am not receiving anything for 1 second I just exit the node, thus release the access to GPIO.
2 | No.2 Revision |
As the node was started as root it was not possible for it to catch ctrl+c
I could use rosnode kill to kill the node but in my case I wanted the node to die after ctrl+c
ed my Launchfile.
So I had two options:
Find a way to run `Pigpio with a non-root user
Find a way to kill the node started as root with the ctrl+c
of the launchfile
I didn't find any way to use Pigpio without root, so I went for the second option.
I created a second node in the same package that was publishing a topic (with an empty msg) and added it to the launchfile (without sudo for this one).
In the node started as Root I added a subscriber for this topic. And if I am not receiving anything for 1 second I just exit the node, thus release releasing the access to GPIO.
3 | No.3 Revision |
As the node was started as root it was not possible for it to catch ctrl+c
I could use rosnode kill to kill the node but in my case I wanted the node to die after ctrl+c
ed my Launchfile.
So I had two options:
Find a way to run `Pigpio with a non-root user
Find a way to kill the node started as root with the ctrl+c
of the launchfile
I didn't find any way to use Pigpio without root, so I went for the second option.
I created a second node in the same package that was publishing a topic (with an empty msg) and added it to the launchfile (without sudo for this one). In the node started as Root I added a subscriber for this topic. And if I am not receiving anything for 1 second I just exit the node, thus releasing the access to GPIO.