Sunday, April 21, 2013

Film job at ISFIT!

I had the pleasure of taking shots for the closing ceremony movie at ISFIT 2013. The shot's where taken by a GoPro Hero3 strapped to my quad. Movie below, my 5 seconds of fame starts at 6:00

ISFiT 2013 from ISFiT on Vimeo.

Thursday, January 31, 2013

FDM heat equation of isolated rod with dynamic end temparatures

To test my understanding of the FDM method I made a simple implementation of the Crank-Nickelson method applied on the heat equation. The physical intepretation is this: You have a perfectly insulated rod of length $l$. At time $t_0$ you know the temperature distribution in the rod, $f(x)$. You also know that each end of the rod will have a temperature that is a function of time, $g_0(t)$ and $g_1(t)$. Given this information, what will the temperature in the rod be at an arbitraray time $t$ and position $x$? This is what the heat equation tells you, the problem, as usual with partial differential equations is that you can't always solve them explicitly. This is where numerical techniques comes to play and saves the day. Below is the result of a numerical simulation of such a senario. For simplicity the rods length is $1$. \[ f(x) = (2+2 \sin(6 \pi x)) (1-|2(x-1)|), 0\leq x \leq1 \] \[ g_0(x) = g_1(x) = \sin(t), 0 \leq t \] This gives rise to the following solution:
Here is the Octave code that calculates this plot, quite simple and self explanetory:
M = 401; % number of space nodes
h = 1/(M+1); % space step size

T = 40000;  % number of timesteps
t = 0.0000005; % time step size

%U0 = 1-abs(linspace(-1,1,M)); % initial data
U0 = (2+2*sin(linspace(0,6*pi,M))).*(1-abs(linspace(-1,1,M))); % initial data
G1 = sin(linspace(0,2*pi,T));
GM = G1;

r = t/h^2;

U = zeros(M,T);
U(:,1) = U0;

n = M;
e = ones(n,1);
A = spdiags([e, -2*e, e], -1:1, n, n);

lkern = eye(M) + (r/2)*A;
rkern = eye(M) - (r/2)*A;

%for y=1:100
  U(:,1) = U0;
  for i=1:T-1
    U(:,i+1) = rkern\(lkern*U(:,i));
    U(1,i+1) = G1(i+1);
    U(M,i+1) = GM(i+1);
  end
%end

downscale = 1000;

Y = zeros(M,T/downscale);
for i=1:T/downscale;
  Y(:,i) = U(:,downscale*i);
end

tx = linspace(0,1,M);
tt = linspace(0,t*T,T/downscale);
hold off
mesh(tt,tx,Y);
%contour(U)
ylabel('space');
xlabel('time');

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.

Cheers!

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: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.73.2699

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