View: 193|Reply: 2

Problem with RaspiTank camera

[Copy link]

1

Threads

2

Posts

15

Credits

Newbie

Rank: 1

Credits
15
Post time 2024-8-14 21:19:10 | Show all posts |Read mode
Edited by 1723638227 at 2024-8-14 09:27 PM

We recently acquired a Raspi-tank kit by Adeept. My daughter has successfully built the kit but we are having problems getting the software going. We have been able to install the Pi OS and boot the Pi, but can't get the camera to work.

There seems to be a lot of confusing information out there regarding Pi cameras. So far I have ascertained with have a Pi Cam v1.3, which, when recognized comes up as an OV5467 device. We are using a Pi 3 rev B board.

By default, libcamera identifies the camera as follows:

$ libcamera-hello --list-cameras
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]

However, if webServer.py is run, it is unable to find the camera and instructs us to enable legacy support:

$ sudo python3 webServer.py
......................pause..........................
Starting camera thread.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video-1'.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (1004) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
--------------------
error: Unable to read camera data.
It may be that the Legacy camera is not turned on or the camera is not connected correctly.
Open the Legacy camera: Enter in Raspberry Pi'sudo raspi-config' -->Select'3 Interface Options' -->'I1 Legacy Camera'.
Use the command: 'sudo killall python3'. Close the self-starting program webServer.py
Use the command: 'raspistill -t 1000 -o image.jpg' to check whether the camera can be used correctly.
Press the keyboard keys 'Ctrl + C' multiple times to exit the current program.
--------Ctrl+C quit-----------
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (1004) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.

If we turn on legacy camera mode in raspi-config, then following reboot, libcamera does not recognize the camera at all:

$ libcamera-hello --list-cameras
No cameras available!

webServer.py continues to display the above message.

If we disable legacy mode again to make the camera recognizable, run the 'sudo python3 killall' command and then run libcamera-jpeg we are uanble to get an image but just get the following error:

$ rpicam-jpeg -n -o test.jpg
[0:05:04.175155952] [1326]  INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
[0:05:04.247789058] [1327]  INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[0:05:04.247903691] [1327]  INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:05:04.249209967] [1326]  INFO Camera camera.cpp:1033 configuring streams: (0) 1296x972-YUV420
[0:05:04.249830735] [1327]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[0:05:05.369471166] [1327]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[12:cap]: Dequeue timer of 1000000.00us has expired!
[0:05:05.369660850] [1327] ERROR RPI pipeline_base.cpp:1333 Camera frontend has timed out!
[0:05:05.369739650] [1327] ERROR RPI pipeline_base.cpp:1334 Please check that your camera sensor connector is attached securely.
[0:05:05.369819024] [1327] ERROR RPI pipeline_base.cpp:1335 Alternatively, try another cable and/or sensor.

Raspberry seems to have added considerably to the confusion by changing the supporting program commands from 'vcgencmd get_camera' to 'libcamera-hello --list-cameras' to 'rpicam-hello --list cameras' so one has to be carefull with online tutorials to documentation. Legacy mode is turned off by default. Furthermore, it seems that it needs to be turned off for the camera to even be regognized by Raspberry tools, yet even these, despite recognizing the camera, do not seem to work.

As for Adeept, the webServer.py tool seems to be designed in a way that prevents the the rest of the robot from operating without a working camera, so we are stuck. Given that the target audience is young people who are trying to learn, I think this is a pretty poor and understadably frustrating experience.

If anyone knows how to get the camera working then I would appreciate some insight.

Firstly, a good starting point might be to confirm whether the legacy camera mode needs to be enabled ot not? webServer.opy seems to imply that it does, but although the documentation mention turning on the GPIO pins, I do not see any mention of tuning on legacy camera mode?

Secondly, if nothing else, it would be useful to get the camera working using standard Raspberry tools. At least we could then verify that it does actually work and our investment in time and money would not be completely wasted. libcamera appears to 'see' it, so why are we getting a timout issue please?

UPDATE: OH DEAR! On top of that it seems that the forum software messes up text in CODE tags by interspersing with HTML markup! How much worse can this get....  Now tidied up using QUOTE tags instead.

Reply

Use magic Report

0

Threads

1

Posts

4

Credits

Newbie

Rank: 1

Credits
4
Post time 2024-8-19 12:17:03 | Show all posts
Verify the hardware connection.
Decide whether to use the legacy or modern camera stack based on your software requirements.
Test the camera independently using Raspberry Pi’s native tools.
If webServer.py still doesn’t work, consider either adapting it to your chosen stack or reaching out for further support or updates.
Reply

Use magic Report

1

Threads

2

Posts

15

Credits

Newbie

Rank: 1

Credits
15
 Author| Post time 2024-8-24 06:05:57 | Show all posts
Thanks. I spent some hours testing the camera with the standard Pi tools but to no avail. It is recognised provided that the legacy stack is turned off, but it doesn't work. It just times out when you try to capture an image. I also tried different versions of  the Raspberry OS but no change. I don't think one can get the old tools anymore so its impossible to test the legacy stack. The webServer.py script is written not to work without the camera so there doesn't seem much more that I can do. If the camera could be bypassed it would at least allow the other robot functions to work. Possibly it could work with a newer version of the Raspberry Pi camera but since I don't have one I cannot put that to the test. Maybe if I have time I will have an in-depth look at the program code, but for now the project has wasted enough of my time and is shelved.
Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules