I am running the app_control.py but it has this error. when i run the command sudo python3 app_control.py, it doesnt get controlled by the application on the phone and has no camera input, but get connected. help. >>> %Run app_control.py
Traceback (most recent call last):
File “/home/gooseriri/picar-x/example/app_control.py”, line 9, in
utils.reset_mcu()
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/utils.py”, line 104, in reset_mcu
mcu_reset.off()
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 171, in off
return self.value(0)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 151, in value
self.setup(self.OUT)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 104, in setup
GPIO.setup(self._pin, mode)
RuntimeError: Not running on a RPi!
%Run move.py
Traceback (most recent call last):
File “/home/gooseriri/picar-x/example/move.py”, line 8, in
px = Picarx()
File “/usr/local/lib/python3.9/dist-packages/picarx-2.0.2-py3.9.egg/picarx/picarx.py”, line 44, in init
utils.reset_mcu()
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/utils.py”, line 104, in reset_mcu
mcu_reset.off()
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 171, in off
return self.value(0)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 151, in value
self.setup(self.OUT)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.1.0-py3.9.egg/robot_hat/pin.py”, line 104, in setup
GPIO.setup(self._pin, mode)
RuntimeError: Not running on a RPi!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/gooseriri/picar-x/example/move.py”, line 45, in
px.stop()
NameError: name ‘px’ is not defined
same problem with move.py
- What version of Raspberry Pi system are you currently using?
- Did you follow our tutorial to install all the libraries?
In the process of installing libraries whether there is an error report it, if so, please provide the error report screenshot to us, easy to analyze the problem. - We recommend you to reinstall the Raspberry Pi system, and then reinstall all of our libraries to see how it works.
i have reinstalled everything, it doesn’t work due to “pyaudio” installation error
Do you think that the SD card could be causing the problem?
i don’t think so, other codes work well except for the app control.
Please provide more detailed information so that we can help you better:
- what product are you using?
- what commands are you running that are causing the problem?
- what system are you using, Raspberry Pi OS, Bullseye or Bookworm, 32-bit or 64-bit.
- Picar-x robotics kit
- move.py and app_control.py (but now i restarted the whole robot and all of the codes are not working due to pyaudio not downloading. although before i restarted it, everything worked except the 2 codes)
- Raspberry Pi Legacy 64-bit
On raspbian recent systems the required dependencies for pyaudio are missing, you can install the dependencies manually:
sudo apt install portaudio19-dev
Then in:
sudo pip3 install pyaudio --break-system-packages
Of course, we’ve also updated the robot_hat installer, so you can just re-update it and run the robot_hat installer again:: ~/robot_hat
cd ~/robot-hat
git pull
sudo python3 setup.py install
the pyaudio is downloaded, but yet another error popped up saying permission denied
%Run 13.app_control.py
vilib 0.2.0 launching …
picamera2 0.3.12
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
websocket server start at port 8765
Traceback (most recent call last):
File “/home/boti/picar-x/example/13.app_control.py”, line 19, in
px = Picarx()
File “/usr/local/lib/python3.9/dist-packages/picarx-2.0.2-py3.9.egg/picarx/picarx.py”, line 48, in init
self.config_flie = fileDB(config, 777, os.getlogin())
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.2.3-py3.9.egg/robot_hat/filedb.py”, line 37, in init
self.file_check_create(db, mode, owner)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.2.3-py3.9.egg/robot_hat/filedb.py”, line 76, in file_check_create
raise(e)
File “/usr/local/lib/python3.9/dist-packages/robot_hat-2.2.3-py3.9.egg/robot_hat/filedb.py”, line 65, in file_check_create
os.makedirs(file_path.rsplit(‘/’,1)[0], mode=0o754)
File “/usr/lib/python3.9/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/opt/picar-x’
i tried every code and they were all in error in px = Picarx()
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.12.2 documentation
i had this error before running the app_control btw
Please run the program “sudo python3 13.app_control.py” with sudo, it needs some configuration file read and write permissions. Also have you performed the steps to calibrate the servos, better perform them, 0. Calibrating the PiCar-X — SunFounder PiCar-X Kit documentation.
Regarding the warning about pip, this is a reminder that the pip installer is ready to change the way it installs, it doesn’t affect the usage.