I'm trying to access the GPIO pins of a Raspberry Pi 2 using the robot operating systen ROS. I know, there are many tutorials on this topic. But my problem is as follows:
- The recommended Linux distribution for ROS is Ubuntu. Since there are other Ubuntu machines in the ROS network, I'd like to avoid compiling ROS for a different OS.
- In Ubuntu the
/sys/class/gpio
sysfs is not enabled by default. I'd need to recompile the kernel with a custom configuration. - If I can't use
/sys/class/gpio
, it looks like I need to use/dev/mem
(e.g. with the RPi.GPIO package). - But
/dev/mem
is only accessible to root. - And I can't run a ROS node as root, since it's missing
rospy
and the whole ROS setup.
So, what's the "easiest" way to get GPIO access within a ROS node?