Archive for April, 2014

FC40 Camera – Reverse Engineering

Posted in Photography, Software on April 27th, 2014 at 21:42:16

So, the Phantom FC40 comes with a wireless camera, controllable from an iPhone or Android phone. As adumbrated at hotrate.com, it’s a small device — about two inches by two inches, similar to the size of a GoPro if you cut off the ‘lens’ part. I think the camera is a stripped down version of a another wifi camera; at least, the specs, shape, etc. seem to match.

It records 720p video to a built-in SD Card, and is controllable via an App on the iPhone or Android. However, there’s no way to control it from a laptop, which sort of annoys me. I’d also like to experiment with linking the camera and doing live-streaming straight from the camera to the web — I think that would rock.

After doing some research, I found that it looks like the software on this camera is very similar to the wifi support on the GoPro: It uses an “Ambarella streaming” web-app hosted by Apache Coyote on the device. The device provides an RTSP stream, and in theory allows you to browse the files on the device and get access to them.

However, it appears that DJI stripped most of this functionality out — in a pretty hacky way, from what I can tell, leaving half-complete stuff and stubs. It has instead implemented its own hacky interface that you can use to control the camera, though it still does RTSP streaming to the phone application.

In trying to work with the camera, I learned the following things:

– The camera sets up a wifi access point, using 192.168.1.1 as its IP, and serves DHCP addresses starting with 192.168.1.100 to clients. It serves an HTTP server on port 80. (This is different than the GoPro which defaults to a different IP setup and runs on port 8080.)
– Most interaction to the camera is through posting of XML to /CGI/ calls.
– Most HTTP calls/functions in the camera require a “Cookie” called “Session” with a value in it. If they don’t have it, they simply return an Error code.
– To get a session, you post to “/CGI/CameraLogin?Device=Mobile&Stream=RTP_H264_WQVGA” with a ‘password=’ (blank) form value. This returns a set of data in XML (‘Login OKFC40_S7NO4621102U40_NO_CODECA06‘) and also has a Set-Cookie header: ‘ Set-Cookie: Session=750997680’. However, the Set-Cookie header is preceded by a space, and therefore is not recognized by regular browsers; it seems the FC40 app knows to look for this, but this prevents trivial use of forms in browsers to replicate the functionality. (No idea if this is intentional or not.)
– There is a CGI for RemoteControl
– There is a CGI for status.

I’ve put together some documentation for these and put them into a fc40 camera github repo. I’ll probably end up expanding it a bit more.

The most interesting thing, of course, is the live streaming of video. After poking it a bit, I did find out that it does RTSP streaming, and I was able to discover that VLC does, in theory, play RTSP streams. However, although the setup mostly works, when it tries to PLAY a stream via VLC, the camera immediately closes the connection. Having inspected packets, I believe the only difference is that the User-Agent is VLC instead of being blank/not included, which is apparently a not-unheard of trick for security-by-obscurity for RTSP streams. I have not yet gotten to the point where I can test this theory, but I’m working towards it.

I wish that DJI was a bit more open about these things, but maybe the reason they’re not is because they took the hardware from some OEM who didn’t want people to get this instead of a more expensive model… or instead of upgrading to a GoPro, which does have a pretty open setup out of the box where all these things ‘just work’. In any case, I figured I’d share what I learned for others to play with.

Flying — or not — within National Parks

Posted in default on April 24th, 2014 at 21:26:38

The United States National Park system is a terrific system designed to protect and preserve some of the most beautiful parts of this country. Ever since I was a kid, I’ve loved the NPS; from rangers putting together brilliant education programs to the beautiful sights protected in the untamed wilds that National Parks serve to protect, I have a strong place in my heart for this part of the federal government. (I’ve often joked that I deal with my taxes primarily by deciding that my money is clearly only going to fund the parts of government I like — and the National Parks are the most common example I give of where that money would go if I could choose.)

The Presidio of San Francisco, a large area in the northwest end of San Francisco, is one of these National Parks. The park is a former military base, and is now a home to cultural and natural pleasures, and includes some great open spaces with great views of the Golden Gate Bridge. Unfortunately, these spaces are the types of things that you are prohibited from seeing from the air, because the National Parks Service has strict rules against the flying of UASes within a park.

The NPS hosts information on Unmanned Aerial Systems in the aviation section of their website talking about the benefits of these aircraft. The website references “Operational Procedures Memorandum (OPM) 09-11” (with a link that no longer works) as the rules that govern UAS flight within National Parks. Some searching suggests that the replacement for this is OPM 11-11: available from the DOI library (though that seems to have expired Dec 2013 with no replacement I can find).

The summary is: All UASes are aircraft, and the FAA controls aircraft, and the rules are you can’t fly them (without following strict rules that most RC multi-rotor pilots aren’t following). No mention is made in the document of exceptions for model aircraft, unlike UAS Guidance 08-01, the most recent FAA guidelines, which state that hobbyists should seek guidance from “Advisory Circular (AC) 91-57, Model Aircraft Operating Standards”.

Now, normally I’d just chalk this up to oversight: This document must be written targeted at public agencies wanting to fly UAS within NPS airspace, not something that people are actively enforcing. Unfortunately, evidence to the contrary seems strong. After flying around in the Presidio, I was walking back to my car carrying the quadcopter when a ranger stopped me, and let me know that if he saw me flying it around, he’d have to kick me out of the park. This type of comment from NPS rangers is not something unique to me: I have talked to coworkers who fly, and have also been asked to leave National Park spaces when flying RC aircraft as a hobbyist.

It’s frustrating to see the National Parks Service take an approach which is so narrow towards hobbyists for reasons that aren’t clearly stated anywhere I can find. (Perhaps the belief is that RC planes would spoil things for everyone else. If so, I understand that, but I wish that it was stated publicly somewhere. I would still be frustrated, but I would at least understand.) As it is, a policy which seems designed and targeted towards heavy duty governmental use of UASes is being applied to hobbyists, and I find that frustrating and sad.

Prior to knowing this was an issue, I flew a bit in Criss Field in the Presidio, and what felt like a great view at the time. It makes me sad to think that images like the ones I captured are the types of things that the NPS wants to prevent.
Golden Gate Bridge as seen from Criss Field

“Is that a Drone?”: Adventures with a Quadcopter

Posted in Photography on April 24th, 2014 at 00:04:30

So, I briefly mentioned this in another post about YouTube, but I bought myself a Phantom FC40 Quadcopter for my birthday.

It’s an all-in-one easy-to-use out of the box flying platform. It comes with a camera, which has wifi support for remote operation (“FPV”). It requires no experience with flying any type of aircraft — it’s pretty much all automatic, and driving it is more like a video game than anything else. It normally retails for $500; I picked it up for $430 during a sale at B&H. (Since then, they’ve been almost constantly sold out, so either supply is tiny or demand has picked up a lot.)

It is the most exciting toy I have ever bought. Flying it is super neat, and the videos that it takes are brilliant. For a long time I’ve considered that I’d like to get my pilot’s license, but I had never really had the ability to set aside the money it would take to do it. The Phantom is certainly no pilot’s license, but it still lets me see the neighborhood I live in in a different way, which is part of my intent.

I would like to do some things with mapping using the quad: doing super-local aerial imagery stitching. But so far, I’ve been having too much fun just flying the thing around.

The FC40 — which is the low end, basic model — doesn’t have any remote telemetry, so I can’t tell how far, fast, or high I’m going. The transmitter, in theory, goes to about 1000 feet, and remote video goes to about 300 feet. I don’t think I’ve hit the 1000′ limit, but I’m pretty sure I’ve passed the 300 foot limit.

I need to get more practice on video editing: creating a compelling story is hard. (More on that in another post sometime.) But the hardware itself is terrific. It’s simple enough that even little kids can do it. The copter is resilient — even when I accidentally got turned around and flew the thing into a fence at full speed, it came out basically unscathed (minus a few replaceable prop guards). It’s stable — even in 10-15mph winds, it holds steady, and if the transmitter goes on the blink, it will return to its start position, for example.

I bought the Phantom — rather than doing something more “DIY”/open source — because the price for what you get was terrific. By the time you buy motors, electronics, and a camera, you’re already looking at $350-$400 of retail parts; getting all of that, in a pre-assembled ready to fly package was brilliant.

The support story on the Phantom is a bit weird; especially with the FC40, which is among the newer models, there’s a bit of an issue around replacement parts (I’ve lost one of my vibration dampers for the camera, and I can’t figure out how to get a new one, because no one sells that as a part for the FC40), but I think that’s likely to slowly go away as the FC40 becomes as widespread as the other Phantom models.

Of course, with any new technology, there are a set of FAQs that you should expect. The Quad is no exception.

Is that a drone?
It really depends on what you mean by the word drone. Many people who ask this think of drones like the US Government uses them — far-flung remote-operated bombing or long-term surveillance machines. This isn’t that. On the other hand, if what you mean is “Can this thing fly and take video, possibly without me seeing the person operating it?” the answer is yes — in that sense it is a drone. My usual answer is “I just call it my quadcopter.”

Is that a camera on the front?
Yep! It’s a 720p video camera which records to a memory card inside the camera. I can also hook it up to an iPhone or Android — but realistically, I don’t, because so far I’m not good enough to fly my quad without actually staring at it the whole time. It’s something I want to work on.

How high can it go?
Higher than I can see it. Under the most conservative rules regarding model aircraft — which is the most straightforward way to look at the Phantom — you can fly legally up to 400 feet, as long as it isn’t being done for commercial purposes and as long as it is more than 5 miles from an airport. I don’t have good data, but I believe I have flown higher than that when flying in the middle of nowhere, though not much — when I get that high, I can’t see the copter, so an errant gust of wind can mess things up if I’m not careful, so I generally try to stay pretty close.

How far can it go?
The transmitter is rated for up to 980 feet (I usually say ‘a quarter mile’), but some people have reported having it work up to twice that without any kind of booster. It runs off the same frequencies as some wifi routers, so it isn’t as long distance in a city as in the middle of nowhere.

Is that legal?
So long as I’m 5 miles from an airport, staying low, and not bothering people, the commonly held belief is that it falls under the FAA’s model airplane rules, and is legal to fly. Though the FAA makes contradictory statements all the time, so the “and not bothering people” becomes really key. 🙂

Do you go to MIT?
Nope.

Between this, and the cost ($500 is generally viewed as “a lot cheaper than I would have thought it would be”), this forms the majority of the common questions I get about flying the quad around Boston — and I *always* get questions. I’ve gone out and flown approximately 20 different occasions now, and I’ve never *not* gotten questions from *someone* 🙂