autorope / donkeycar

Open source hardware and software platform to build a small scale self driving car.
http://www.donkeycar.com
MIT License
3.05k stars 1.28k forks source link

Car not turning on when running python manage.py drive #1141

Open sherifayantayo opened 10 months ago

sherifayantayo commented 10 months ago

Screenshot 2023-08-11 133149

(myenv) sherif@raspberrypi:~/mycar $ python manage.py drive


_ ___ /___ ___/ ____ / / / _ _ /// _ / / / / `/_ / // // // / / / / ,< / / /_/ / / / / // /_ / /___/ _/// ////|| \/_, / _/ \,/ /_/ /____/

using donkey v5.0.dev3 ... INFO:donkeycar.config:loading config file: /home/sherif/mycar/config.py INFO:donkeycar.config:loading personal config over-rides from myconfig.py INFO:main:PID: 3734 WARNING:donkeycar.parts.pins:pigpio was not imported. cfg.CAMERA_TYPE PICAM INFO:main:cfg.CAMERA_TYPE PICAM Traceback (most recent call last): File "/home/sherif/mycar/manage.py", line 1142, in drive(cfg, model_path=args['--model'], use_joystick=args['--js'], File "/home/sherif/mycar/manage.py", line 104, in drive add_camera(V, cfg, camera_type) File "/home/sherif/mycar/manage.py", line 880, in add_camera cam = get_camera(cfg) File "/home/sherif/mycar/manage.py", line 798, in get_camera cam = PiCamera(image_w=cfg.IMAGE_W, image_h=cfg.IMAGE_H, image_d=cfg.IMAGE_DEPTH, File "/home/sherif/donkeycar/projects/donkeycar/donkeycar/parts/camera.py", line 22, in init from picamera.array import PiRGBArray File "/home/sherif/donkeycar/projects/donkeycar/myenv/lib/python3.9/site-packages/picamera/init.py", line 72, in from picamera.exc import ( File "/home/sherif/donkeycar/projects/donkeycar/myenv/lib/python3.9/site-packages/picamera/exc.py", line 41, in import picamera.mmal as mmal File "/home/sherif/donkeycar/projects/donkeycar/myenv/lib/python3.9/site-packages/picamera/mmal.py", line 49, in _lib = ct.CDLL('libmmal.so') File "/usr/lib/python3.9/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: libmmal.so: cannot open shared object file: No such file or directory

zlite commented 10 months ago

Did you do a "pip install pigpio" first, as instructed?

sherifayantayo commented 10 months ago

pip install pigpio

I didnt see this in the instructions, I did do it now and ran it but i got the same error

zlite commented 10 months ago

That missing file is part of the standard RPi camera library. Are you using the latest RaspberryPi OS (Bullseye 64 bit)?

This ChatGPT answer can help: https://chat.openai.com/share/09971d0d-fb1d-4d28-befe-fcdd760dc622

On Fri, Aug 11, 2023 at 10:36 AM sherifayantayo @.***> wrote:

pip install pigpio

I didnt see this in the instructions, I did do it now and ran it but i got the same error

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675147795, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENF2L425X4NMTLKNXFW3XUZURVANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

sherifayantayo commented 10 months ago

Yes , it is the latest RaspberryPi OS (Bullseye 64 bit, i followed the instructions Screenshot 2023-08-11 133149

sherifayantayo commented 10 months ago

But i got the same error

zlite commented 10 months ago

Did you enable the camera (don't select legacy camera) in raspi-config?

On Fri, Aug 11, 2023 at 10:57 AM sherifayantayo @.***> wrote:

But i got the same error

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675168722, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENFZTTW2UPNAZS2GE77DXUZXBDANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

sherifayantayo commented 10 months ago

Screenshot 2023-08-11 141620 I didnt find any other camera apart from legacy camera

zlite commented 10 months ago

Try disabling legacy camera

On Fri, Aug 11, 2023 at 11:12 AM sherifayantayo @.***> wrote:

[image: Screenshot 2023-08-11 141620] https://user-images.githubusercontent.com/82980558/260102037-fb76d018-f8ff-43d1-8b40-65539c1ae9ef.jpg I didnt find any other camera apart from legacy camera

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675182767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENFY74FYJBFULS7A24XTXUZYWZANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

zlite commented 10 months ago

Failing that, do sudo apt-get install libraspberrypi-dev

On Fri, Aug 11, 2023 at 11:17 AM Chris Anderson @.***> wrote:

Try disabling legacy camera

On Fri, Aug 11, 2023 at 11:12 AM sherifayantayo @.***> wrote:

[image: Screenshot 2023-08-11 141620] https://user-images.githubusercontent.com/82980558/260102037-fb76d018-f8ff-43d1-8b40-65539c1ae9ef.jpg I didnt find any other camera apart from legacy camera

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675182767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENFY74FYJBFULS7A24XTXUZYWZANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

sherifayantayo commented 10 months ago

Screenshot 2023-08-11 142713 It didnt work

zlite commented 10 months ago

And do you have an actual Pi camera attached?

On Fri, Aug 11, 2023 at 11:22 AM sherifayantayo @.***> wrote:

[image: Screenshot 2023-08-11 142713] https://user-images.githubusercontent.com/82980558/260106265-47298e21-0c63-42fb-9e9a-8934eabb564b.jpg It didnt work

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675194627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENF3KQMKQRUUVCBI53E3XUZZ73ANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

sherifayantayo commented 10 months ago

Yes i have one installed. The car wheels work with the calibration steering left to right and back to forth but for whatever reason when I run the python manage.py command as you saw I got these issues

zlite commented 10 months ago

Might be something wrong with your camera. Try the usual RPi camera tests

On Fri, Aug 11, 2023 at 11:31 AM sherifayantayo @.***> wrote:

Yes i have one installed. The car wheels work with the calibration steering left to right and back to forth but for whatever reason when I run the python manage.py command as you saw I got these issues

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675203126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENF3PAPNVTMKSW2K5T3DXUZ273ANCNFSM6AAAAAA3NGO4NY . You are receiving this because you commented.Message ID: @.***>

-- ◤ CHRIS ANDERSON 3DR | CEO website https://www.3dr.com/ | linkedin https://www.linkedin.com/company/3d-robotics | twitter https://www.twitter.com/3drobotics

TCIII commented 10 months ago

@zlite I think that the problem is that picamera does not work on the Bullseye 64-bit OS and manage.py is trying to use picamera instead of picamera2 for some reason. There is no need to activate a camera on the BullsEye OS as it is done automatically (picamera2) during the Bullseye OS install unless a legacy camera is in use and is selected in the raspi-config app.

I have a picam v2 working just fine with the Bullseye 64-bit OS running DC 5.0.dev3.

TCIII

sherifayantayo commented 10 months ago

I ran this . it seems the camera is working. (myenv) sherif@raspberrypi:~/mycar $ vcgencmd get_camera supported=1 detected=1, libcamera interfaces=0

TCIII commented 10 months ago

@sherifayantayo,

As I posted above, manage.py is trying to use picamera and not picamera2 for some reason.

You might have to uninstall DC, disable the legacy camera, reboot and reinstall DC so that python uses picamera2 and not picamera.

Did you install DC using these instructions: Installation for Donkey Car main (>= 5.0) using Raspberry Pi OS Bullseye

If you installed DC correctly you should see this when running manage.py drive:

INFO:picamera2.picamera2:Configuration successful!
INFO:picamera2.picamera2:Camera started
INFO:donkeycar.parts.camera:PiCamera opened...
INFO:donkeycar.parts.camera:...warming camera
INFO:donkeycar.parts.camera:PiCamera ready.
INFO:donkeycar.vehicle:Adding part PiCamera.

TCIII

sherifayantayo commented 10 months ago

Yes i installed with these instructions

Did you install DC using these instructions: Installation for Donkey Car main (>= 5.0) using Raspberry Pi OS Bullseye

TCIII

TCIII commented 10 months ago

@sherifayantayo,

Did you select enable the legacy camera in the raspi-config app before installing DC?

sherifayantayo commented 10 months ago

@sherifayantayo,

Did you select enable the legacy camera in the raspi-config app before installing DC?

These werent in the instructions for Installation for Donkey Car main (>= 5.0) using Raspberry Pi OS Bullseye

sherifayantayo commented 10 months ago

@sherifayantayo, Did you select enable the legacy camera in the raspi-config app before installing DC?

These werent in the instructions for Installation for Donkey Car main (>= 5.0) using Raspberry Pi OS Bullseye

So I didn’t enable legacy camera before i installed donkey car . since you just recently installed donkey car , did you have issues with the adafruit pca9685 module when you ran donkey calibrate ?

TCIII commented 10 months ago

@TCIII,

No, as I am using an RC HAT.

However, I have not had any issues using the RPi with the PCA9685 module.

Suggestion: I think that you need to take this issue to the DC software forum which will give you much more exposure and a faster solution for your problem.

TCIII

DocGarbanzo commented 10 months ago

@sherifayantayo - there should be no picamera in your venv's site-packages path, as @TCIII and @zlite already mentioned. We are now using picamera2. For me, picamera2 is already part of the system python install (living in /usr/lib/python3/site-packages). So even installing it with pip in our virtual env, doesn't do anything for me. What does ls /usr/lib/python3/dist-packages/picamera2 return for you? If it doesn't return anything then I recommend you do:

sudo apt-get update
sudo apt-get upgrade

See if this does the picamera2 install in the system python. If not, you can install it manually by

sudo apt install -y python3-picamera2

Remove your current virtual env (just delete it) and re-create it, following the donkey docs. Even if you don't have pycamera2 in your system python, the donkey install would install it there as it is part of the dependencies. Make sure you don't enable the legacy cam in raspi-config. So long story short, picamera2 should be either in your system python or your venv but picamera should not be in any of those. This will likely get the camera to work.

Ezward commented 10 months ago

@sherifayantayo I have a hunch that legacy camera was chosen at some point and now you have picamera instead of pycamera2. I suggest you reinstall from scratch, again using the 64bit OS, but make sure NOT to enable legacy camera at any point. After installing the OS just go on with the install as documented and everything should work.

zlite commented 10 months ago

Also make double sure you're using the newer 64-bit Bullseye OS and not the old Buster

On Fri, Aug 11, 2023, 10:25 PM Ed Murphy @.***> wrote:

@sherifayantayo https://github.com/sherifayantayo I have a hunch that legacy camera was chosen at some point and now you have picamera instead of pycamera2. I suggest you reinstall from scratch, again using the 64bit OS, but make sure NOT to enable legacy camera at any point. After installing the OS just go on with the install as documented and everything should work.

— Reply to this email directly, view it on GitHub https://github.com/autorope/donkeycar/issues/1141#issuecomment-1675710824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAENFZ7B3M63WJRFCE5UNLXU4HTNANCNFSM6AAAAAA3NGO4NY . You are receiving this because you were mentioned.Message ID: @.***>