Trying to integrate arducam onto Blue ROV 2?

Hello, I am attempting to integrate an Arducam OV5647 picamera onto my Blue ROV 2’s. I have gotten this working on one of my vehicles with the following steps:

  1. plugged in the camera
  2. sudo raspi-config–>enable camera–>reboot
  3. sudo pip install picamera
  4. sudo killall raspivid (kills a script that runs at startup and interferes with my use of the camera)
  5. running this example script:

[code]import time
import picamera
with picamera.PiCamera() as camera:
camera.resolution = (1024, 768)
camera.start_preview()

Camera warm-up time

time.sleep(2)
camera.capture(‘foo.jpg’)[/code]

However, I have another, nearly identical vehicle, on which the camera is not working. There is no process “raspivid”, or “raspistill”, or anything like that, to kill. But when I try to run the example script, I get the following error:

mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0xffa410 (ENOSPC) mmal: mmal_connection_enable: output port couldn't be enabled Traceback (most recent call last): File "pi_camera_test.py", line 4, in <module> with picamera.PiCamera() as camera: File "/usr/local/lib/python2.7/dist-packages/picamera/camera.py", line 433, in __init__ self._init_preview() File "/usr/local/lib/python2.7/dist-packages/picamera/camera.py", line 513, in _init_preview self, self._camera.outputs[self.CAMERA_PREVIEW_PORT]) File "/usr/local/lib/python2.7/dist-packages/picamera/renderers.py", line 558, in __init__ self.renderer.inputs[0].connect(source).enable() File "/usr/local/lib/python2.7/dist-packages/picamera/mmalobj.py", line 2212, in enable prefix="Failed to enable connection") File "/usr/local/lib/python2.7/dist-packages/picamera/exc.py", line 184, in mmal_check raise PiCameraMMALError(status, prefix) picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

This is the same error I got on the original vehicle before killing the “raspivid” process. To make sure the camera is connected correctly, I have run:

vcgencmd get_camera

which returns: supported=1 detected=1

Both vehicles are running Raspbian 8.0, codename jessie. The only difference between them is I have removed the tether interface board on the first vehicle, the one on which the camera is working. So I figure that there must be some other process that has to do with the tether board that is tying up the camera on the tethered vehicle. Problem is, I can’t figure out what that process is.

I compared the results of ps -A on both vehicles, and found some processes that were different. Of those, the suspicious looking ones were: start_webui.sh, which apparently is some web interface for the pi camera, and mmal-vchiq, which has something to do with the camera, but I’m not sure what. However, I tried killing both these processes, to no avail.

Here is the output of my ps -A on the tethered vehicle (the one the camera isn’t working on):

[code]1 ? 00:00:02 systemd
2 ? 00:00:00 kthreadd
3 ? 00:00:00 rcu_gp
4 ? 00:00:00 rcu_par_gp
5 ? 00:00:00 kworker/0:0-cgr #
6 ? 00:00:00 kworker/0:0H-mm #
7 ? 00:00:00 kworker/u8:0-ev #
8 ? 00:00:00 mm_percpu_wq #
9 ? 00:00:00 ksoftirqd/0
10 ? 00:00:00 rcu_sched
11 ? 00:00:00 rcu_bh
12 ? 00:00:00 migration/0
13 ? 00:00:00 cpuhp/0
14 ? 00:00:00 cpuhp/1
15 ? 00:00:00 migration/1
16 ? 00:00:00 ksoftirqd/1
17 ? 00:00:00 kworker/1:0-eve #
18 ? 00:00:00 kworker/1:0H-kb #
19 ? 00:00:00 cpuhp/2
20 ? 00:00:00 migration/2
21 ? 00:00:00 ksoftirqd/2
22 ? 00:00:00 kworker/2:0-eve #
23 ? 00:00:00 kworker/2:0H-kb #
24 ? 00:00:00 cpuhp/3
25 ? 00:00:00 migration/3
26 ? 00:00:00 ksoftirqd/3
27 ? 00:00:00 kworker/3:0-cgr
28 ? 00:00:00 kworker/3:0H-kb
29 ? 00:00:00 kdevtmpfs
30 ? 00:00:00 netns
31 ? 00:00:00 kworker/0:1-eve
32 ? 00:00:00 kworker/1:1-cgr #
33 ? 00:00:00 kworker/2:1-pm #
34 ? 00:00:00 khungtaskd
35 ? 00:00:00 oom_reaper
36 ? 00:00:00 writeback
37 ? 00:00:00 kcompactd0
38 ? 00:00:00 crypto
39 ? 00:00:00 kblockd
40 ? 00:00:00 watchdogd
41 ? 00:00:00 rpciod
42 ? 00:00:00 kworker/u9:0-hc
43 ? 00:00:00 xprtiod
44 ? 00:00:00 kworker/u8:1-ev
46 ? 00:00:00 kswapd0
47 ? 00:00:00 nfsiod
58 ? 00:00:00 kthrotld
59 ? 00:00:00 kworker/3:1-cgr
60 ? 00:00:00 iscsi_eh
61 ? 00:00:00 dwc_otg
62 ? 00:00:00 DWC Notificatio
63 ? 00:00:00 vchiq-slot/0 #
64 ? 00:00:00 vchiq-recy/0 #
65 ? 00:00:00 vchiq-sync/0 #
66 ? 00:00:00 vchiq-keep/0 #
67 ? 00:00:00 SMIO
68 ? 00:00:00 kworker/2:2-eve
69 ? 00:00:00 irq/86-mmc1
70 ? 00:00:00 kworker/2:3-eve
71 ? 00:00:00 kworker/2:4-mm_
72 ? 00:00:00 mmc_complete # 73 ? 00:00:00 kworker/2:1H-kb 74 ? 00:00:00 kworker/0:1H-kb 75 ? 00:00:00 kworker/1:1H-kb 76 ? 00:00:00 kworker/1:2H 77 ? 00:00:00 jbd2/mmcblk0p2- 78 ? 00:00:00 ext4-rsv-conver 79 ? 00:00:00 kworker/0:2H-mm 80 ? 00:00:00 ipv6_addrconf 84 ? 00:00:00 kworker/3:1H-kb 87 ? 00:00:00 kworker/2:2H 94 ? 00:00:00 kworker/3:2H 105 ? 00:00:00 kworker/1:2-cgr 108 ? 00:00:00 kworker/u8:2-ev 122 ? 00:00:00 kworker/0:2-eve 126 ? 00:00:00 systemd-journal 130 ? 00:00:00 systemd-udevd 180 ? 00:00:00 SMIO 211 ? 00:00:00 mmal-vchiq
223 ? 00:00:00 mmal-vchiq 245 ? 00:00:00 cfg80211 251 ? 00:00:00 kworker/3:2-mm_ 252 ? 00:00:00 brcmf_wq/mmc1:0 254 ? 00:00:00 brcmf_wdog/mmc1 273 ? 00:00:00 mmal-vchiq
274 ? 00:00:00 mmal-vchiq 276 ? 00:00:00 mmal-vchiq
406 ? 00:00:00 kworker/1:3-eve
407 ? 00:00:00 wpa_supplicant
481 ? 00:00:00 avahi-daemon
482 ? 00:00:00 cron
485 ? 00:00:00 inetd $

489 ? 00:00:00 rsyslogd
491 ? 00:00:00 dbus-daemon
509 ? 00:00:00 avahi-daemon
536 ? 00:00:00 systemd-logind
567 ? 00:00:00 thd
625 ? 00:00:00 kworker/u9:1-hc
626 ? 00:00:00 hciattach 627 ? 00:00:00 kworker/u9:2-hc 630 ? 00:00:00 bluetoothd
716 ? 00:00:00 dhcpcd
732 ? 00:00:00 ntpd
736 ? 00:00:00 sshd
740 ? 00:00:00 screen
745 pts/1 00:00:00 sh
747 pts/1 00:00:00 xargs 748 pts/1 00:01:02 mavproxy.py 772 ? 00:00:00 screen 774 pts/2 00:00:00 bash 776 pts/2 00:00:01 gst-launch-1.0 783 ? 00:00:00 screen 785 pts/3 00:00:00 start_webui.sh
794 ? 00:00:00 screen
796 pts/4 00:00:00 start_webtermin 804 ? 00:00:00 screen 806 pts/4 00:00:01 tty.js
807 pts/5 00:00:01 comm_router.py 830 ? 00:00:00 screen 832 pts/7 00:00:02 node
840 ? 00:00:00 screen
842 pts/8 00:00:00 nmea-receiver.p 850 ? 00:00:00 screen 852 pts/9 00:00:01 underwater-gps.
862 tty1 00:00:00 agetty
878 ? 00:00:00 ssh-agent
881 pts/3 00:00:05 node 882 pts/3 00:00:00 tee
1285 ? 00:00:00 kworker/u8:3-ev
1310 ? 00:00:00 sshd
1320 ? 00:00:00 systemd
1323 ? 00:00:00 (sd-pam)
1326 ? 00:00:00 sshd
1328 pts/0 00:00:00 bash
1450 pts/0 00:00:00 ps[/code]

Any ideas? Of course I could just start killing every process until the camera works, but I want to avoid breaking things if possible.

Hi Randy,

Try increasing the GPU memory in raspi-config

Thanks. I forgot to mention it, but I actually tried that. I increased the GPU from 128 to 256 mb. It didn’t solve the problem. Should I increase it further than that?

I don’t think so.

Also, to properly disable video, you should comment this line. It is possible that there are still two processes fightint for the camera resource. We use gstreamer with uv4l instead of raspivid.

Great, that fixed the problem. Thanks!