A discussion page to allow me to add my experiences using a Raspberry Pi 2/3/Zero V1.2/1.3 as a companion computer for Ardupilot/APM/Pixhawk flight boards. I will update my experiences as I learn, feel free to comment and offer tips, it's all free here.
I'm building a github for my experiments: https://github.com/benb0jangles/Companion-Pi
Drone Unit: Raspberry Pi Zero V1.3 + Pi Camera Module
img file: https://drive.google.com/open?id=0B1cVb3uX0f0dQTZzSmVISFdYd3M
Ground Unit: Raspberry Pi 2
img file: <to be added>
Goggles Unit: Raspberry Pi Zero V1.3
Ardupilot Technical Questions:
Also, if you have any technical code/hardware questions which you feel may take ongoing contributions and help over an extended timeframe, feel free to ask over on Ardupilot.org technical discussion page here: http://discuss.ardupilot.org/t/companion-pi-2-3-zero/9460
I will update as I get by, please contribute by offering your 'plug & play' wifi adapters using Raspbian Jessie. Also, if you happen to pick up this project, and are working faster than me, then please send us your own .img file experiments. Thanks.
Well, it works on my zero, thank you. Connected my 8Mb Raspberry camera, had a few problems getting it to work. Input 'sudo chmod a+rw /dev/vchiq' it worked then stopped, but after sudo apt-get update & upgrade everything fired on all cylinders.
I then decided to push the resolution and bit rate to see what happened. Awus051nh v2 usb stick attached to zero via usb hub with signal sent via Nano M5 and wirelessly 5Ghz to an oldish laptop.
Ignoring lag and breakup of picture. I had the resolution set at 1920x1080 30fps, and increased the bitrate gradually to 20Mbps. I had the Ubiquiti screen display up on my main computer on the main tab where I could see the graph of the RX & TX bitrate. It maxed out at about 13.3Mbps. The zero did get a bit warm. On the camera front I was quite impressed with the white balance. I had a Logitech c920 connected last night on my Pi 2 and it maxed out at about 3.3-3.5Mbps. I take it that the lag and break up of image is more down to my oldish laptop than signal transfer.
I don't know much about Mavproxy. My next step is to wire my zero to a flight controller and see if I can get telemetry to work.
sudo chmod u+s /dev/vchiq
this works if you need to make the permission permanent (not have to do sudo chmod a+rw /dev/vchiq every time)
break up seems to be due to UDP protocol, I get slightly bett results on the pi2 than the pi zero. Hope at the end of this long road there will be wifibroadcast or UDT implemented too as they seem to prevent bottlenecking/breakup/reconnection issues.
Thanks for the chmod statement.
I also streamed to my main computer which is a lot more powerful that my laptop. It streamed very well. I haven't range tested yet but it does look as if the pixel breakup is down to the laptop not being powerful enough to process the signal quickly enough
Wired the Zero up to a Pixracer via telemetry port.
After 'sudo -s' and 'mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter' I'm getting the error message -
Connect /dev/ttyAMA0 source_system=255
Failed to connect to /dev/ttyAMA0 : [Errno 2] could not open port /dev/ttyAMA0: [Errno 2] No such file or directory: '/dev/ttyAMA0'
Also connected a Pi2 and got the same error message. It's probably something straightforward but at the moment I can't figure it out.
what is the PCB on the gimbal for ? Is it to control the camera gimbals ?
Yes, the gimbal is this board, removed from the metal bracked, and mounted on a custom 3-d printed version. It's a $40 item and it works pretty good.
For experiment purposes, try connecting the pixracer to pi zero uart only (no powering using usb or other power). So just using UART 5v GND TX RX. Also eliminate that TX RX are correctly connected.
I use APM 2.X board for testing, if you have one to also test.
Then if still errno x, I reckon it's mavlink/Jessie Lite issue on the pi zero/2. I have found jessie lite a bit of a pain in the rear for running mavproxy. Lots of permission problems.
I may try compiling an image again, and seeing if I can get a smoother running img going. Was my first 'working' attempt with Pi Zero V1.3 & Jessie Lite. Also feel free to start making your own img files and sending me links to post on Github if you are successful.
I have these gimbals too, I really like that they can be software tweaked using the various GUI programs out there. I also like that they can be upgraded to 3-axis easily & cheaply. My 3-axis upgrade:
Your image is most likely fine, I don't think it's a Jessie Lite issue.
I also tested with a Pi2 running an earlier version of Noobs, connected to a Pixhawk clone. This time I followed the tutorial here: http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html and loaded pymavlink & mavproxy - same result.
I think it is most likely that I'm missing something due to my lack of knowledge in this area. Before I disable the OS use of serial there is a ttyAMA0 file in /dev. After I disable it disappears. The command line from the tutorial 'sudo -s' then, 'mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter' results in no such file or directory, which is correct because ttyAMA0 is no longer in /dev. I'm assuming that the ttyAMA0 is the name of the rx/tx serial port and it may now be called something else or I need to set it up somehow.
I have an APM board, I will redo the test as you have suggested. It certainly keeps my old brain going!
Thank you very much for your help.
I did /dev last night and could not see ttyAMA0 listed. Also the error message refers to the file - Failed to connect to /dev/ttyAMA0 : [Errno 2] could not open port /dev/ttyAMA0: [Errno 2] No such file or directory: '/dev/ttyAMA0'
I've just made up a cable for the APM telemetry socket (forgot it was 5 pin instead of 6 pin) When I've connected it all up, powering the zero from the APM I'll try mavproxy.py and see what happens.