Saturday, August 25, 2012

The quad copter progresses

I've done a good deal of tinkering since the last post. A new frame was ordered from HobbyKing, replacing the homemade one. This got rid of the vibrations that the pine one had problems with. I also changed the controller ho a Kaptein KUK controller. It's much simpler and cheaper. That way I can try out and experiment whitout worrying about crashing. Here are two videos of the new version flying.
This one was done right after I had changed the frame, see the difference is stability.

In this one i stuck my mobile phone to the copter and did some flying around the garden at home in Røros.

Firkant, a music player, completely in your browser!

EDIT: Try the live demo here!

I'm found of music, it colors my day. This also applies to the rest of my family. Because of that I've set up an Ampache server where we add our music. This makes it really easy to discover new music and listen to eachothers suggestions.
The only problem with Ampache is that all the clients, well, they suck. There are a lot of half finished plugins, small tests etc. but no real client that just works. Works cross platform. Lets you cache music so that you can listen to it while offline etc. All these nicks and picks made me so frustrated that I started rolling my own. I wanted this:

  • Browse artist/album/track

  • Cache things so they are available offline

  • Be truely cross platform

I started hacking at an already existing python player Quickplayer. It worked out ok untill I needed to change the interface while keeping it cross platform. I realized that this would never work.
After some thinking I started wishing I could've done it as a webpage, that would be esay except for the "offline" mode. I read around the net and discovered that Chrome apps actually can be offline, as well as get permissions to XMLHttpRequst to an arbitrary host. This combined with the new File Api support was all I needed. I started coding and in about 3-4 days I had a finished player.
The UI
It's written as a Chrome app, that is a tottally normal webpage only that it's hosted from your harddrive. It also has relaxed access control allow origin so that I can communicate with the webserver that runs the Ampache instance.
It lets you create your own subset library from that is cached locally, enabeling you to listen to your music wherever you've got your laptop.
To view it in the Chrome Web Store.
The code is available at GitHub.


Sunday, June 17, 2012

First flight of my Arducopter!

Yeah, this weekend I've been having some freetime so I used it on my Arducopter project. Here's a picture of the finished build:

[caption id="attachment_130" align="alignnone" width="500"] My quad before it's first takeoff.[/caption]

The chassis was made by hand at OmegaV. It's just some pine spars, plexi glass, nuts and bolts. Experiences from the first flight where theese: The chassis is a bit to wobbely, vibrations build up. The Arducopter was tuned a bit too sloppy, so it flies a bit docile. I think I'll order a industry made chassis because it costs next to nothing and they are much more stiff. I'm also going to buy a cheap KK controller just for experimenting. That way I can crash as much as I want whitout being worried about the bill. Last but not least, here's a video of the flight.

Monday, April 23, 2012

Adding authentication to Sirkel

I got a joyous mail in my inbox today. Mark Roberts wants to implement a distributed merkele tree over my DHT Sirkel. The algorithms he's aiming to implement is described in:

I've been wanting to do this myself, but haven't found the time. Mark is going to do this as a part of his distributed systems cource. I'm going to help him both on a conceptual and implementation-wise. I'll update when there's more to know. Untill now, I'm happy to know that Sirkel may be the first DHT I know of that implements real content authentication!

Monday, March 12, 2012

New data source for OpenAviationMap, OpenAir, and with it a new parser!

I've been working on a parser for the OpenAir format this weekend. As usual I like to work in Haskell. The Parsec library makes sense when creating parsers. You build up a parser from simpler parser, and in the end , you're sitting with a parser for a whole language, it's known as the parser combinator approach.

Parsing OpenAir gave me some special challenges. OpenAir is not what I would call an data format, but more a program. It's a list of instructions, and if you follow them, you will create an airspace. This is very non declarative, very non haskell. Therefore it makes it a challenge to parse it in haskell. Thanks to parsecs mutable state, everything got together.

I'm starting to think that OpenAir really needs a touchup though. OpenAir has choosen a data is programs approach, it feels really unatural. Maybe using YAML as a carrier format together with a schema specification on what attributes an airspace has would be more fruitful?

The instant benefit with my new parser is: Germany! We've now got complete and official coverage of Germany's airspaces. That's no small feat for a hobby project! Hungary is coming along nicely to thanks to Ákos' work on an eAIP parser. That will allow us to parse airspaces for all countries that has an eAIP, and that's actually some =)

The code is available in my github

Saturday, February 18, 2012

New tools for OAM: Import data from OSM to OAM in a batch process.

I've done some work on migrating data from the master OSM database over to our OAM database. The tricky thing here is that when you download something from OSM, it expects any modifications etc. to be uploaded to OSM, not another database. To work around this problem I've written an tool called OsmXmlTool in Haskell. Put simply it does this. Parse an OSM xml file. Create an internal representation of the data in it using haskells Algebraic Datatypes. Then it modifies this representation following several rules; all entities has to get new unique id's etc. Afther that, the datatype is converted back to XML. This data can be loaded into JOSM, fine tuned and uploaded.

To give a idea of how much work this tool saves us. Today i downloaded a bounding box of Norway with all aviation related features. I put it trough my tool, and after that into JOSM. Some minor tweaks to some tags and uploaded. Took me around 10 minutes. In those 10 minutes i had populated the database of 3000 new entities, runways, hangars, helipads, taxiways you name it. Haskell is awesome, OSM too!

To take look at the result, go to OpenAviationMap.

If you wonder how anything is done or have any questions, pop a comment! I'm maybe thinking of making the tool generic, so that it can be used in any project that want to migrate OSM data into their own database, tell me if you're interested.

Thursday, February 16, 2012

Simulation of quantum wave function

Had a lecture in quantum mechanics today, we've been starting to get serious and are now working with arbitrary 1 dimentional potentials. While doing the work I feelt desperatly in need of some visualization. Therefore I packed together a little simulation in haskell this afternoon. Now, Haskell is the right tool for this kind of job. The whole program is just 63 lines of code, and they're ugly too. I bet that it could be crammed down if one wanted. Anyways, Haskell is so great at this stuff for many reasons. For example it lets me define Numerical instances of functions, that mean that i can add two functions together, before I give them the arguments. This is great for building up complex mathematical functions. In the future I'd like to extend this example to generate a wavefunction for an arbitrary potential. This requires solving differential equations though, I don't think Haskell's typesystem is up for that yet. Anyway I'd be interested in ways to express maths, especially differential equations in Haskell, if you have any ideas, tell me!

The code, as always is available at github

The video represent the wave function of a quantum particle in a box. Unlike normal things in day to day life, quantum partilces doesn't have a defined possition, they have a probability of being at given possitions. The y axis of this animation represents the probability of finding the particle at a given point. This specific example is the superpossition of the 4 first exited states of a box particle. As you see, the "possition" that is where you would expect to find the particle changes with time. That mean we have a moving particle. That might not sound strange, but if i say that each of the 4 exited states in themselves are stationary, they don't move at all, then things start to become interesting. The thing is that by superpositioning differnt static states, you can create a new state, that is dynamic, and thus move; exciting!

The video is generated from a series of pictures output by my haskell program. Since I don't know of any good way to create interactive plots in haskell, and this was an 2-hour evening project i decided to go for: Loads of images -> ffmpeg -> video -> profit!

Friday, February 3, 2012

OpenAviationMap technical crash cource

So how does this OpenAviationMap tick? I'll try to explain as condensed as possible.
The main part is a web application written in Ruby called Rails Port. It handles users, and the map API. This is an XML API that lets users send in changes to the map.
To edit the map we have JOSM. It's a Java application written for OpenStreetMap. It lets you draw things on the screen and give it tags. Then you can press upload, enter username and password, and JOSM posts your beautiful drawing to the API.
The Rails Port application then receives this and stores it in a PostGIS enabled PostgreSQL database.
All changes to the map are incremental. That means that you can individually revert changes, much like on Wikipedia or VCS's like GIT or SVN. This gives us the power to let everyone with an account edit the map by default, because no one can do irreplaceable damage.
To view the map I'm using OpenLayers, written in JavaScript. I serve the OpenAviationMap data from the database via some custom code as WFS to OpenLayers which displays it appropriately over (currently) a Google physical base map.

The start of something great; Open Aviation Map

Ever since I took my private pilots license the thought of how old and outdated my goverments aviation data is distributed have been coming back to me once ever now and then. The thought started to grow in me and today I've come far enough to say that I've started to do something with the problem. I've started an open source mapping project. You've might have heard of Open Street Map, the idéa goes like this:

Let's create a website and software infrastructure that makes it really easy for the lay man to create a map. Then, instead of having to bother about drawing all these ways, junktions and houses, we'll just have to create the software that makes it really easy to do.

The thing is that they've come real far on this thought. Just take a look at OpenStreetMap and look at your local area. Chanses are you see a really good map of roads, important houses etc. Now comes the part that makes this map so different from all the other maps around, Google, Bing etc.

  • This map is make by volunteers that just enjoy the feeling of creating something important and complex.

  • The map is completely free, you can do whatever you want with. You always have to share what you do with it under the same license. This makes sure that if someone does a really smart thing; everyone benefits from it which I think is really neat!

What I've done is blatantly copy OpenStreetMaps philosophy and software architecture and used it for aviation data. To take a look at the page go to OpenAviationMap.

It lets hobby aviators around the world stick their heads together and create a world map for flying!
Already before things are stable Germany has a load of data, thanks to Udo Geschonneck who's done a great job adding the navaids and started some aerodromes there.
If one man can create that much data in just a few days, then creating a world map maybe issn't such a crazy idéa afterall.