Need sudo right in RosLaunch [closed]

asked 2019-12-03 06:26:52 -0600

Thierry gravatar image

Hello, I try to launch a node which contain a pigpio library command (init, read, write, handler ...) But roslaunch resend me :


|Sorry, you don’t have permission to run this program. |

|Try running as root, e.g. precede the command with sudo. |


It's pigpio access who need sudo right to initialise and so on. Have you an idea, how to get around that need ??

Thx, Thierry

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by mgruhler
close date 2019-12-03 08:13:26.190314


There are many questions about this, e.g. #q216441, #q229435, #q232819, to name a few. Please check those and search around this site a little bit. Feel free to reopen if none of those answers help, but please explain which answers you found, which did not apply to you and which didn't work.

Thank you.

mgruhler gravatar image mgruhler  ( 2019-12-03 08:16:50 -0600 )edit

I readden these links but anyone not give me a solution, they don't use pigpio but olders gpio version and they code in python not c++. PiGpio is the best library for me to manage interrupts with good result, others are dependent of cpu load.

Thierry gravatar image Thierry  ( 2019-12-04 03:22:10 -0600 )edit

This seems to me to be more of a pigpio question then.

The suggested approach seems to start the pigpiod daemon (with sudo) and use the pigpio_if2 library from userland (without sudo) to interface with it.

mgruhler gravatar image mgruhler  ( 2019-12-04 04:05:18 -0600 )edit

Yes i seen that and i have tried to code in python to test, but i'm not python expert !!! I give you news when good results.

Thierry gravatar image Thierry  ( 2019-12-04 05:23:08 -0600 )edit

There is also a C library...

mgruhler gravatar image mgruhler  ( 2019-12-04 05:54:32 -0600 )edit

I think, i found my solution. With pigpiod_if2 library, that seem good .... Give you result later.

Thierry gravatar image Thierry  ( 2019-12-04 08:35:57 -0600 )edit

YES, i confirm. Declared pigpiod_if2 library in CMakelist.txt and used pigpio_if2.h in C or CPP file and launch pigpiod daemon at startup and no need to use sudo law. THAT'S OK

Thierry gravatar image Thierry  ( 2019-12-10 06:23:53 -0600 )edit

Hey, I am facing the same issue with ROS Noetic on a RP4 and Ubuntu 20.04. Just to make sure. Did you just link the pigpiod_if2 in the CMakeslist.txt to the Node which needs the pigpiod? My current approach: target_link_libraries(node_name pigpio) Do I need to change it to pigpio_if2 when i understand that correct? In cpp file you include <pigpio_if2.h> instead of <pigpio.h>, right? Sorry for the very basic question. I just started with ROS and RP4.

nicmcgurck gravatar image nicmcgurck  ( 2021-12-23 01:42:14 -0600 )edit