Creating Sculptures of the World with Computers and Math

Posted in default on September 18th, 2014 at 22:12:35

The world around us is a complex place. Sometimes you just want to hold a tiny piece of it in your hand — and with some relatively low cost technological investment, you can do so. Using a $500 quadcopter, I have successfully captured images of a building, converted those images to a 3D model, and 3D printed that model — creating a small model of Cambridge City Hall that I can hold in my hand. The process requires no special skills — just some financial investment and time.

IMG_20140914_203339

In March of this year, I purchased a Phantom FC40, a $500 everything-you-need quadcopter. This device is easy to fly, comes with a built-in GPS, on-board camera (with a mount for a GoPro), and a remote — everything you need to start doing some amateur aerial photography. (You can see some of my videos in the FC40 Videos and One Minute Onboard to see some of the aerial photography I’ve done.)

P3214334

Capturing Photos

With quadcopter in hand, this weekend, I ventured to Cambridge City Hall. While there, despite the gusty winds, I captured approximately 20 minutes of video, attempting to film the building from as many angles as possible.[1] I was using the GoPro Hero 3+ Black I recently got, but for the purposes of this excercise, the FC40 camera would probably have been sufficient. I shot most footage in Narrow or Medium mode, to reduce the fisheye effect of the very wide angle GoPro lens; for the one section of video I shot in wide-angle, I removed the wide angle aspect using GoPro Studio before using the video.

Once I had the videos, I reviewed them, doing manual frame-grabs from the video to get coverage. On average, I took one shot for about every two seconds of usable video. (Usable video excludes video where the quadcopter is taking off, where it is facing the wrong direction, where it is flying to get to a different part of the building, where it is occluded by trees, etc.) Another option would be to simply use a program like ffmpeg to extract one frame every second:

ffmpeg -i ~/Documents/input-movie.mp4 -r 1 -f image2 ~/output/project%03d.jpg

The reasons not to do this are:

  • When flying the quadcopter, some portions (even in a sub-second window) are better than others. Motion blur is a non-trivial problem, even with 60fps capture rates; targeting manual screengrabs at slower motion, or during a more steady period makes a small but noticable difference.
  • Many of the shots were in the exact same coverage — largely due to the available landing space being all in front of the building. This means that extracting regular shots would have extracted many very very similar images, which would have increased processing time without noticably increasing quality of results.

Instead, I simply opened each video in VLC, and snapshotted the images that seemed to improve coverage of the building. (Option-Command-S on Mac; in the Video menu.)

Photo from City Hall Shoot Photo from City Hall Shoot Photo from City Hall Shoot Photo from City Hall Shoot Photo from City Hall Shoot

Building the Model

Once done with this, I loaded the images into a program called PhotoScan, the workhorse of this operation.

PhotoScan is an amazing tool. I say this, having tried a number of other tools — including commercial products like Autodesk’s 123d Catch and open source tools like VisualSFM. Nothing combined the ease of use and functional output of PhotoScan by a long shot. I’m currently using PhotoScan in 30 day trial mode, but despite the relatively steep price tag ($179 for single-user ’standard’ license) for what is only a hobby, I’m pretty well convinced I’m going to have to buy it, because the results are simply amazing.

With my 328 photos in hand, I added them to a chunk of a PhotoScan workspace, and set up a Batch Process (Workflow -> Batch Process).

Workflow

  1. Job Type: Align Photos. Change Point Limit to 5000, due to relatively small image size (1920 x 1080); further experiments show that this number ends up creating a better model than either 10000 or 20000 points, in a significantly shorter time window.)
  2. Job Type: Build Dense Cloud.
  3. Job Type: Build Mesh. Ensure that the Source Data is “Dense Cloud”.
  4. Job Type: Build Texture

Kicking off the build for these 328 photos uses all of the CPU on my laptop for approximately 1 hour. The majority of this time is spent matching photos via the “Align Photos” step. (An attempt with 20000 points took about 4 hours instead of just one.)

Setting up workflow

This produces a textured model, fully visible in 3D. In this particular case, anything other than City Hall is pretty … ‘melty’, as I like to call it, since it was only captured incidental to the primary flight objective (city hall itself). From here, you can save the model as a .obj file to use in your favorite 3d program. You can also share it via the web: once exported as a .obj, you can zip the resulting files (including the texture) up, and share for free on Sketchfab: Cambridge City Hall on Sketchfab.

Photoscan assembledPhotoscan assembled Photoscan assembledPhotoscan Assembled

My final goal is a physical version of the centerpiece of this model: City Hall. To achieve this, my next step is Meshlab. Meshlab can open the “Wavefront Object (.obj)” file I saved from Photoscan without a problem. Using the “Select Vertices” tool and the “Delete Vertices” tools, I am able to remove the extraneous parts of the model, leaving behind only City Hall itself. Using the “Export Mesh As” functionality, I can export this as a .stl file — the file format that my 3D printer uses.[2]

Trimming City Hall Trimmed City Hall

Printing the Model - aka ‘hacking it to work’

The next step is to load up the STL file. Since I don’t actually know how to rotate my model, I’ll load it into Repetier-Host, so I can do rotation in my plating process. Playing around with the angles, I take my STL file, and find that a rotation of 204 degrees in the X direction, -5 degrees in the Y direction, and -15 in the Z direction appears to give me a reasonably sane looking model. However, it’s still floating a bit above the bottom, thanks to a small portion of the model that is particularly warped due to low photo coverage. I choose to slice the model anyway, using Slic3r to generate gcode.

3d Printing: Plating

As expected, the model has generated some pretty bogus first couple layers. However, judicious use of copy paste can help me: Using the Repetier jump-to-layer buttons, I remove the first 3 layers of the model, then duplicate the g-code for the 5th layer (The first ‘real’ layer with more than a few spots of actual content), replacing the Z index with the correct height for the first, second, third, and fourth layers.

3d Printing Layers

With these relatively minor modifications made, my model is ready to print; I copy it to my SD card, and send it off to the printer. An hour or so later, I have a 3D sculpture that matches my model pretty well.

IMG_20140914_203339

IMG_20140914_203015 IMG_20140914_202925 IMG_20140914_202855

[1] This can be a challenge in an area where your building is occluded by many trees; shooting shots from the ground can help with this, but I didn’t do any of this for this particular project.
[2] The model that I produce from Meshlab is frankly pretty crappy. A lot of people with experience in this space could probably trivially improve on what I’ve got; I just don’t know much about 3D Model work. Whenvever I open blender, I start with a cube, and end up with something that looks more like a many-tentacled one of Lovecraft’s imagining than reality. As such, the 3d printing process can be a bit … fraught.

GoPro: Upgrade Complete

Posted in Photography on July 28th, 2014 at 22:52:04

In May, I said my next upgrade would be a GoPro. Last week, I confirmed that, as I bought a GoPro Hero 3+ Black. (Thanks to my employer, I even got a 40% discount.) For the first few days, I played with it — did a sunset timelapse, and contributed to the internet cat database by adding pictures of the kitties in a charming 2.7k video. (2.7k probably only available in Flash or Chrome.)

But in part, my reaction was “Enh. What did I think I needed this for?” After all, I already had a camera for my quadcopter (in the form of the A5-powered FC40 camera); I had a DSLR (which can shoot great 720p videos); I had my phone, which could do decent 1080p video, and I always had on me. Why exactly did I need *another* camera?

Today, I finally took the GoPro up on the Phantom, and that particular concern is no longer.

I was recording video, so I didn’t get any particularly high res stills — but that wasn’t really a concern. Shooting 1080p video, I was able to get great shots of both the storm clouds looking out west of town:

And another photo looking East towards Boston.

The colors, the clarity, the overall picture and video quality … this is what I kept seeing in everyone else’s photos, even though I wasn’t getting it in mind. I always wondered if the problem was just my tools… and now I know. As with everything, the user makes a difference… but the tools certainly help.

Orkut was still alive?

Posted in Social on July 4th, 2014 at 21:14:46

Google announced this week that they will be closing down Orkut at the end of September.

Most people reacted with “That thing still exists?” (Unless, of course, they are Brazilian.)

I was an Orkut hipster; I joined before it was cool. (Specifically, I joined back when the network actually wasn’t ~fully connected; my roommate in college and I had different ‘friend graph’ sizes, IIRC.)

Apparently, I used my crschmidt@livejournal.com email to join Orkut. I was able to login and see my profile, and see some of the testimonials that were left for me a decade ago, mostly from friends on LiveJournal.

The one that gets me, is this one (left by an anonymous user):

I would not push Chris Schmidt in to oncoming traffic. Normally when I say that about somebody, it has to do with my ethical code. In this case, though, it has a lot more to do with who Chris is as a human being.

At the time, I’m pretty sure I figured out who left this testimonial, but the cultural context in which it was left has been lost to me now. So I’m left with a vaguely positive testimonial from an anonymous source from a social network I abandoned a decade ago.

… Actually, that sounds about as positive as an end-of-life social networking experience can be. I’ll take it!

Response to new FAA Policy Document

Posted in default on June 25th, 2014 at 14:57:44

Recently, the FAA issued a new policy document on their intended enforcement of drone activities, re-iterating their stance that commercial activities are prohibited, and that they have full regulatory authority over remote controlled model aircraft under their authority to regulate all aircraft.

They asked for comments on regulations.gov, and I submitted my comments. Since comments are only made public after review by the agency involved, I am posting it here as well. (My submission identifier is 1jy-8cv7-nzgk.)

This entire policy is based on a mistaken notion that the “the FAA has considered model aircraft to be aircraft that fall within the statutory and regulatory definitions of an aircraft”; the definition that the FAA uses (”contrivances or devices that are “invented, used, or designed to navigate, or fly in, the air.””) is so broad as to describe everything from a commercial jetliner to a paper airplane, and was clearly never the intent of the creators of the FAA. Considering model aircraft included in the FAA’s regulatory definitions is an absurd notion, as supported by the one case decided so far by the NTSB court: In Pirker v. Huerta: “It is concluded that, as Complainant has not issued an enforceable FAR regulatory rule governing model aircraft operation; has historically exempted model aircraft from the statutory FAR definitions of aircraft by relegating model aircraft operations to voluntary compliance with the guidance expressed in AC 91-57, Respondent’s model aircraft operation was not subject to FAR regulation and enforcement.” (http://www.scribd.com/doc/211088332/Pirker-Decision)

Given the current lack of authority that the FAA has to regulate model aircraft under current rules, this policy of enforcement can not be based on a set of rules: instead, the FAA is attempting to govern based solely on policy documents, entirely evading the process of rulemaking that is required for passing regulations.

This document/rule does not appear to be changing anything in this regard: it is another case of the FAA making an effort to define a policy for enforcement without changing the basic rules and regulations that the agency is working under. The continued lack of any rules or regulations that support this policy mean that this policy is (again) attempting to invoke fear, uncertainty, and doubt into a fledgling industry, hurting the operators of model aircraft who are currently doing so with commercial intent.

While I understand that the FAA has a mandate to ensure safe integration of civilian sUAS into the airspace, this policy does not move further towards that goal; it sets up limitations which are not based on rules with no eye towards safety, and does nothing to move towards the requirements of the FAA Reauthorization Act of 2012.

This policy document continues the FAA’s enforcement of non-existent rules, treating advisory guidelines as law. This position is untenable, and allowing this rule/enforcement policy to stand as is is unhelpful and harmful to the overall community; it will only increase uncertainty, as it continues to be based on FAA policy rather than an official rulemaking process.

Flying under the radar: Avoiding FAA Persecution

Posted in Photography on May 11th, 2014 at 20:19:39

The FAA is aggressively pursuing those that are flying small unmanned aerial systems counter to the guidelines that it feels it has set. Specifically, the FAA believes that sUAS are aircraft, and are regulable under the rules which apply to aircraft, with specific exceptions carved out by a small number of guidelines and rules.

The legal basis for these claims is dubious at best — the summary at Drone Law Journal covers most of the legal questions attached to this issue relatively well. However, most people flying a remote controlled model aircraft are not in a position to fight the FAA. If you want to stay on the ‘easy’ side of the fight, here are the things that I would recommend, based on what the FAA is currently doing.

Stay under 400′ above ground level. The AC 91-57 model aircraft guidance suggests maintaining a limit of 400 feet AGL. This is well below the 700′ limit which is the typical upper bound for class G airspace, and also lower than the 500′ limit on flight over rural areas for private flights. This is a good idea to ensure that your UAV is out of the way of any aircraft.

Stay more than 5 miles from an airport, or contact the tower if needed to be closer. AC 91-57 suggests 3 miles, but Section 336 of the FAA Modernization and Reform Act of 2012 suggests that the FAA can not promulgate any regulation that prevents flight further than 5 miles from an airport.

Stay out of controlled airspace. The FAA recently issued a fine for an operator flying a drone in downtown Manhattan, even though the operator was more than 5 miles from the nearest airport. The letter he received indicates that he was fined for flying recklessly, but also for flying in a Class B airspace without receiving tower clearance. To stay away from the FAA, stay out of all controlled airspace. (This is also a good idea for safety reasons, in general: controlled airspace is controlled because it is where airplanes can be flying low, close to airports.)

Fly only for “recreational or hobby” purposes. The 2012 Act suggests that the FAA has no right to promulate regulations that affect model aircraft if they are flown ’strictly for hobby or recreational use’. Any use beyond this puts you in the sights of the FAA; they have already issued one fine (to Raphael Pirker); although Pirker won in court, the FAA is appealing and has not changed their enforcement approach.

Stay a ’sufficient distance from populated areas’. This is, again, from the AC 91-57 guidance to model aircraft operators. A recent case in Denver where a drone was flown over a crowd at a 4/20 rally resulted in the FAA launching an investigation; the FAA’s website claims that “Routine operation of UAS over densely-populated areas is prohibited.” (FAA UAS Fact Sheet)

Don’t fly in a reckless manner. Both the two people who have been issued fines so far have had those fines issued for what the FAA referred to as ‘reckless’ flying.

So far, the FAA has only been fought in court once, and they lost. Another lawsuit is ongoing, over non-commercial search for missing persons. (A petition to encourage the FAA to change its policies allow these flights is up at the White House petition site, if you believe this is an important issue to fix.) But they have sent cease and desist letters to many, and it seems unlikely that this will stop anytime soon.

By following the above recommendations, it is possible that you may be able to avoid the wrath of the FAA, until they change their policies to pursue people even more aggressively. I am not a lawyer, I am definitely not your lawyer. But if you want to enjoy your new Phantom, these are the recommendations I would make to you, to enjoy your hobby with the least risk of persecution by the FAA.

Video: It’s Hard

Posted in Photography, default on May 7th, 2014 at 07:23:53

So, I’ve been an amateur photographer for years. I started helping to take pictures of family vacations with my dad’s AE-1 back when I was in grade school. I took photo classes in college, and I got my first digital camera in 2003. (I still have it, by the way.)

close up of a flash for a canon camera

I’ve had a Digital Rebel for the past 9 years. (I got my first in December of 2005.) I’ve had my most recent camera for another 3 or so. I’ve brought these cameras to a dozen conferences and events; I’ve used them in bars, on skating rinks, at the beach. I have uploaded over 6000 public pictures to Flickr — which means that in that time, I’ve probably *thrown away* another 12000 or so. (My rate of success has drifted over time, from as low as 10% to as high as 75%.)

I won’t claim I’m an expert photographer — I’m good at taking candid portraits, but a lot of other things continue to evade my skills — but I’ve taken a lot of pictures, and I like a lot of what I take these days.

And now that I’ve started looking at video, that all changes.

I have no meaningful experience with video. I helped run the camcorder at a couple of events for my dad (who has been doing video for years), but that’s it. Now I’m faced with an entirely different medium, with a different set of requirements, and a different set of tools, and I find myself feeling completely frustrated by my efforts.

The number one thing that I learned with digital photography is you have to prepared to throw away 90% of what you take, especially when you get started. (It took me a while to get good at this.) Most of the pictures you take will be crap; even if you got the frame and content you tried to capture, you might have caught a person blinking, or have a photo that’s more out of focus, or with the wrong color balance to the point you can’t adjust it any more.

With video, the same is true (at least, I feel that way): most shots don’t come out the way you want them to. Even worse: a minor edit to a shot can change it from being perfectly reasonable to being silly (or from being perfectly silly to looking just reasonable). So in addition to finding the perfect shot, you’ve got to edit it right.

Attention spans are short. I once read an article from someone complaining about ‘quick cuts’ in modern TV. Since then I’ve paid careful attention, and learned that it is rare for most TV to have single visual cuts that are longer than about 3-5 seconds. (If you watch fast-paced shows like The Amazing Race, this drops by half; you have tons of super-fast clips.) Even for a relatively short, 3.5 minute video, my Ohanami video, on average people only watch one minute of it before they stop. (And I consider that video one of my better / more entertaining efforts so far!)

picture of cherry blossoms

When I started editing video from my quadcopter, Jess jokingly sent me a link to the Friend Who Sent Link To 8-Minute YouTube Video Must Be Fucking Delusional Onion article, in response to my first Phantom FC40 edited video. I defended my position, indicating that I had put a lot of work into trimming out the boring parts… but since then, I’ve become much more ruthless. (In the case of the Ohanami video, I edited approximately 1.5 hours of total video footage into a 3 minute clip reel, and it was relatively well-received.) As usual, my lovely wife was right: people don’t care about 90% of the footage I’m filming, a lesson I should have learned from photography.

Even beyond editing, I’ve got new equipment problems. While the DSLR is great for shooting photos, shooting video with it means holding it out far from me, which makes steady shooting hard. You get jumpy, jerky footage (as you can see in the Us at the Zoo video I put together from this weekend); zooming with a lens is great for photos, but crappy for videos.

In part, this is my choice of tool. The DSLR is a fine camera now that I’ve learned to use it, but it’s not clear that it’s the best tool for shooting video, but it’s what I’ve got for the moment. But even ignoring that, I’ve got the bigger problem: Shooting candid, entertaining video is an entirely different ballgame.

I’m enjoying learning new tricks, and producing slightly more compelling footage and editing. I’m enjoying this new medium; I’ve been watching lots of other people’s videos, to learn how to do it right — or at least better. (My favorite candid family gathering video is this Easter video that someone posted in one of the quadcopter forums due to its use of a quad for a couple of the shots. This has actually been a primary motivator for me to get out there and see what I can do.) So far what I’m learning more than anything else is “This is hard work!”

Next Upgrade: GoPro Hero 3+ Black

Posted in Photography on May 6th, 2014 at 21:08:25

My next upgrade for the quadcopter is going to be a GoPro. Specifically, I’m looking to pick up a Hero 3+ Black (though if I find a great deal on the Silver, I might take that instead.)

A friend of mine joked the other day that he was disappointed in the quality of the shots from my quad; linking the video of flight in DC as what my video should look like. He was clearly just making a snarky comment, but I wanted to establish that there are two huge differences here: a gimbal mount and a GoPro.

A gimbal mount offers in-flight stabilization using a gyroscope, and typically also offers pitch control (looking up and down) via a 7th channel on the transmitter. A good gimbal (like the ZenMuse H3-3D) costs about $350 — and is also balanced around a particular type of camera (in this case, the GoPro), for both balance and placement. A gimbal is key for doing stable shots: a quadcopter stays in the air primarily through brute force, constantly adjusting its four motors to stay level, and shifting in moving air is constant. Without a gimbal, you will always have shake, especially when hovering or moving slowly. (With a strong lateral or forward movement, there tends to be less drift.) This YouTube video demonstrates two different types of gimbals, and is a good video of a gimbal in action.

But currently I’m shooting with a cheap 720p camera, and the more I shoot, the more I notice it (and see how it suffers). Upgrading to a GoPro — in addition to making the gimbal usable without hacky mounts — seems like it will have the following effects:

  1. Better color. Everything taken from a modern GoPro is just significantly more consistent in color, and that’s a huge problem, especially in low light, from the cheap FC40 cam.
  2. Better compression (or maybe none? I don’t know.) The FC40 cam does a shitton of compression on-device before you ever get to the video, which makes getting some types of video out of it (like my forest flight) impossible to get good quality out of. This is a real PITA for flying in a lot of places — even the river gets affected.
  3. Better consistency in light. The FC40 does do exposure adjustement, but it’s super jerky and ugly, especially in the evening. The GoPro footage I’ve seen doesn’t seem to have the same problems.
  4. Better base resolution. The black offers up to 2.7k video at 30 fps, or various different sizes (like the 1440p super-wide) that give you plenty of room to crop crap out while doing post-processing for things like image stabilization.

The reasons for choosing the Black over the Silver aren’t huge — the Silver doesn’t have the higher end resolutions (4k, 2k, 1440p), but is otherwise pretty similar. However, when you look at eBay, the price differential is < $50, rather than the $100 difference retail, and I think that the $50 is worth it.

I know that the video I'm producing isn't great yet, but that's okay. As time goes on and I can invest some more in my tools, and also learn better video editing techniques, I feel confident I'll be able to continue to improve in this area.

But step one is definitely a GoPro.

Flying Machines within Yosemite

Posted in default on May 3rd, 2014 at 08:40:39

The NPS released an announcement today related to drone use within Yosemite. It claims that a statement that ‘“delivering or retrieving a person or object by parachute, helicopter, or other airborne means, except in emergencies involving public safety or serious property loss, or pursuant to the terms and conditions of a permit” is illegal.’ applies to drone use.

Drone flying over a waterfall in a wooded area

Now, I personally find that sentiment a bit odd — my quadcopter isn’t ‘delivering or retrieving [an] object’, as far as I know; I would be hard-pressed to consider that phrasing to apply to me if I were reading it. But even more importantly, reading the CFR that is referenced, there is a much more obvious section that the FAA would probably claim applies: 36 CFR 2.17 (a)(1) says: “Operating or using aircraft on lands or waters other than at locations designated pursuant to special regulations.”

Given that the NPS has instead chosen to go with section 3, this seems like a position of the NPS/DOI that the FAA’s position on drones/remote controlled model aircraft being treated as ‘aircraft’ is just wrong. However, weaseling this into another regulation (with the dubious claim that the ‘object being delivered is the drone itself’, as they claimed on their Facebook page), is almost as bad of an approach. It at least has the benefit that it doesn’t affect flying outside the parks, so I find it less personally concerning for long-term survival of the hobby.

They already have a prohibition (36 CFR 2.12 (a)(1)) which prevents ‘operating motorized equipment … [t]hat exceeds a noise level of 60 decibels measured on the A-weighted scale at 50 feet; or … makes noise which is unreasonable, considering … [the] purpose for which the area was established [and] impact on park users…’ I think this is an entirely reasonable regulation, but the noise level from the quad almost certainly doesn’t meet the “60 decibels at 50 feet”, so only the “bothering other people” aspect would apply — and therefore make it reasonable to operate in an area where there are no other people around, or where people won’t be bothered by the noise (such as where I was on the Presidio, where no one could even hear the quad over the wind).

I think this has three big take-aways for me:

  1. The people who wrote this document did not feel that drones are aircraft. This runs counter to the FAA position, but is good, because there is no legal defense for calling these things aircraft. This means that there continues to be support for the legal notion that there are no current regulations which apply.
  2. The NPS has a desire to block the use of drones, and will do whatever they can to do so. This means that regardless of what the law says, you should not expect to fly in a National Park and not get told you can’t.
  3. Given the other regulations prohibiting the use of ‘motorized toys’, I expect the NPS will change their regs to explicitly ban drones in the future, at which point you will not have a legal leg to stand on — so if you want to pick a fight, you might as well do it now.

I continue to be supportive of reasonable regulation regarding drone use in the national airspace, and continue to be supportive of the NPS/DOI passing reasonable regulations that apply to model aircraft. I dislike the use of wordsmithing to try and fit these things into existing regulations, and I think that the NPS should work hard to make their regulations legally match their claimed authority.

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. 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_CODEC A06‘) 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