PiGpio no permission to work

My node contain pigpio.h library.
Catkin_make finished correctly.
When i launch my node with Roslaunch, a message appear in console at line “gpioInitialise();” :
|Sorry, you don’t have permission to run this program. |
|Try running as root, e.g. precede the command with sudo. |
But nevertheless, program continue, without managing i/o.

When i use pigpio library without ROS, operation is correct.
Where and how should i declare the lpigpio in CmakeLists.txt (or other file) ?

For a user to use GPIO the most common way is for that user to be added to the ‘gpio’ permissions group.

Are you using user ‘ubuntu’ on our kernel or some other user you created?

Log in as they user your script executes as and type the command groups

See if the user you run as is in group gpio.

For RPI.gpio and I suspect the GPIO you are using and if you must run gpio as a user look into these commands:

If the group did not exist you can try these commands:
sudo groupadd gpio
sudo usermod -aG gpio

normally I prefer and have used many many time RPI.gpio for GPIO so I am not familiear if the library you are using has some other permissions issue to be dealing with.

Perhaps there is something more subtle so I will now back out and others add their thoughts.

Good luck

1 Like

Thank U Mark for your answer,
i work with your standard kernel and ubuntu is my ID.
It is declared in gpio group, but not working yet.

I work with pigpio library because it’s the only who work correctly with interrupts.

Ok, too bad that was not the issue.
In order to help others please add back into this thread what you discover so that others may use pigpio from C++ if they too require interrupts. That would help others as well as allow us to tell others when the question comes up in the future.
May the Pi Be With You!

Hi @Thierry,

We use the pigpio.h library for the Magni Sonar Board. You can find the code here: https://github.com/UbiquityRobotics/pi_sonar

You need to run it with root level permissions for it to work correctly, because of how it uses interrupts. We get this to work using the setuid feature of linux. This allows specific executables to be run as root without sudo, so beware of the possible security implications of this.


1 Like

Thank You Rohan for your reply,
I found another solution.
I used pigpiod_if2 library and daemon pigpiod, in this case no admin right are necessary and that’s run very good.
Big thanks for your help, team is power.

Well I’ll be. My mistake, I had forgotten the low level the Sonar module used. Thanks Rohan