Rclpy with sudo
I have a Raspberry Pi 3b+ with Ubuntu ARM and ROS2 installed. I have a python package that writes to a topic every two seconds and it works fine when I run it without sudo the thing is that i need to run it as sudo since i have to send messages of my I2C sensor to that topic making SMBUS not work without it. The message that i get is the following: "No module named 'rclpy'"
Asked by MathSqrt2 on 2019-04-04 18:14:22 UTC
Answers
You most likely need to source the setup file after escalating to a new shell with root privileges.
Or use -E
perhaps: https://stackoverflow.com/questions/8633461/how-to-keep-environment-variables-when-using-sudo
Asked by William on 2019-04-04 18:51:03 UTC
Comments
Sadly the -E on the sudo is giving me the same error. You did you meant with the first thing you said? I'm kind newby to this :/
Asked by MathSqrt2 on 2019-04-05 04:16:46 UTC
Comments
If possible: try to see whether there is a way to give your current
$USER
write access to the hw (ie: file in/dev
) instead. In most casessudo
is not needed, just access to the device file.Asked by gvdhoorn on 2019-04-05 07:23:34 UTC