On the T'Rex project I have the raspberrypi camera finally working with decent latency. Here is a pic (not much but that is the camera image up on my mac on the screen, coming from the pi)
For those trying to do something similar the best solution I found was using netcat (nc.traditional on the pi and just nc on the mac shell commands) with nc and mplayer on the mac (had to get via macports, mplayerX is NOT a good option). Anyway basic idea is:
- on the receiving computer you do
- nc -l [some port number] | mplayer -fps 60 -cache 1024 -
- on the pi you do
- raspivid [setup your video stream] -o - | nc [dest ip] [dest port]
Also, it is important to remember to start the listening stream first on the PC you want to see the video.
In playing around with all the options I ended up installing v4l2 libraries on the pi. I got an rtsp stream (example 6 on the page) up and running using VLC streaming out of the pi using those libraries and I am wondering if I can do a direct kick out to netcat skipping VLC (VLC server was causing 2-3 seconds delay on HTTP and RTSP examples). The reason I would like to try that is the v4l2 stream allows you to tweak some settings while the stream is live. If raspivid allows you do that I haven't figured it out yet. Would help with tweaking the camera view when out roving around.
Bandwidth in the netcat example using a 640x480 stream is ~380KBps. My initial run with full HD was a bit jumbled and laggy though I haven't tried it again since I got some of the settings tweaked. latency was pretty minimal when it was caught up but it was variable from a tenth or two up to a second or three at times. Seemed to be tied to when I hid the video window for a while and brought it back up on the pi got bogged down on something else.
As you can see the camera is mounted to a pan tilt kit (micro server pan tilt kit from Adafruit). I have tested that with an RC controller but have not gotten it running from the arduino trinket. I also have a new basic wiring diagram for the project. Still pretty rough...
For now I am not sure about all of this. But it seems like the roboclaw can provide 5v at 3amps from the main battery supply, and the raspberrypi can pass through whatever it does not use. So I shuold be able to mangle a USB cable to run power from the BEC circuit into the pi USB input (much better protected than running it to the 5v and gnd GPIO pins directly). The question is if the power supply is clean enough to avoid resetting the pi (seems they are pretty sensitive). Worse case I will just run power to the pi from a USB battery backup I have. Then use the pass through to kick out to the two micro servos and trinket arduino. Hope to setup packet/serial communication from the trinket to gpio on the pi board. I got a series connector for two 7.4 lipo 5000mah packs I have. I have a couple of voltage monitors on the way to make sure I don't blow them up. Also found some projects for using some voltage dividers to use analog arduino ports to provide the same function.
I am a bit concerned about the two packs as they are kicking out over 20v fully charged which is more than I was expecting. Need to read up on these motors, they should take over voltage fairly well if I run it lightly, but that is a lot more than I expected to be dealing with. I still have a smaller 11.1 3s pack to run with if need be.
A word of caution for anyone looking to use this platform... I ran it around in RC mode and found that it is relatively easy to get this thing to turtle if you run it up to something it can't climb. The treads will grab and roll it over onto its back pretty easily. I may be building in some roll bars to protect the electronics and to get it back up right in the event of a spill.
No comments:
Post a Comment