wiringPi to transmit over UART in subscriber callback without sudo [closed]
Hi,
I am trying to create a ROS node in which I have a subscriber to a /cmd_vel
topic, and a callback function in which I transmit the cmd_vel
data to a slave MCU over UART
.
I am unable to use wiringPi serialPutchar()
, or run any other C executable without directly invoking sudo
. I have seen the other posts on this board, and have tried all of their suggestions to no avail.
Every time I get the warning "wiringPiSetup: Must be root. (Did you forget sudo?)".
Steps I have taken:
- I have edited /etc/inittab
and /boot/cmdline.txt
- I have executed sudo usermod -a -G dialout pi
- I have executed gpio export 15 out
and gpio export 16 in
- I have executed sudo chmod 777 /dev/ttyAMA0
- I call wiringPiSetup()
in the first line of my code
Is it impossible to control any hardware on the PI without acting as sudo? How else can you write a ROS node to send something over the Pi's hardware UART?
Also, is transmitting over UART in a subscriber's callback function a bad practice?
Best,
Brett