Cannot initialize/control PWM when running ROS node (permission denied)

I was able to run the or (written by modifying under the folder Navio2/Python by “sudo python”, this works fine and my wheel can rotate and move.

The problem is that I need to incorporate these two functions to the ROS node and got an IOError because permission denied: ‘sys/class/pwm/pwmchip0/export’ when I ran “rosrun my_package_name”

I then type “chmod 666 /syss/class/pwm” and used “rosrun my_package_name” to run my node again, but got another OSError of rcio (see graph attached).

It seems I always got errors when trying to control pmw pins by running ros node using rosrun.

Any suggestions? (Note: I cannot use “sudo rosrun” to get the persmission as I did for the example in the very beginning…)

Hi, @djsuo
You can’t use sudo as your environment variables aren’t set for user root, therefore it’s impossible to run rosrun. You can login as root and source setup.bash. Then everything should work.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.