ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Your node needs root permission to run because it needs to access hardware and you haven't given your user the correct permissions to access that hardware.
The GPIO pins on the Raspberry Pi are apparently typically accessed using a memory-map device node called /dev/gpiomem
. The permissions of this node should be set up to allow access to any user in the gpio
group. You can confirm the permissions be executing ls /dev/gpiomem
. Make sure the group permissions allow reading and writing, and that the group is gpio
(the owner will probably be root
.
Then you need to make sure your user is a member of the gpio
group:
$ sudo adduser [your user name] gpio
Log out and log back in again for the group change to take effect.
An alternative to all of the above, if you are willing to write your node in Python, is to use the pigpio
library. It uses a daemon that runs as root and provides a gateway to the GPIO so that users of the module do not have to.