Friday 25 February 2011

New Motors, White Socks, and an Epic Fail

So I recently got it my new replacement motors from HobbyKing, and I've been making the additional changes needed to the design to allow for mounting them. Last time around I ended up destroying parts mostly due to the high strength of the frame.

This time I decided to mount the motors in such away that they break off the frame on impact during a crash. The result looks like this:



In case you were wondering what the strange fabric straps to the arms are, yes these are indeed my socks.


The whole thing comes in at 1306 grams, totally loaded white socks and all!


On to the video. I haven't had a chance to implement any native code as of yet, but the new hardware setup has yeilded some fairly respectable results on managed code only:


I should note that most of the erratic flight is purely me, I am a horribly unskilled pilot. I suspect the other major factor is my limited space. Its been -20C and below in Calgary for the last few weeks, but I can't wait to get this thing outside once things warm up.

And lastly as promised the EPIC FAIL! I was messing around with tuning and it would seem I put the dot in the wrong place.

The new mounting strategy is very effective, that major crash cost me 5 mins and 3 zip ties. I'm going to be doing some major cleanup on the code this weekend and hope to go live again sometime next week. Also Brandon is hoping to have the project page up and running around the same time.

Managed BitConverter

So I've been tossing around this BitConverter class that I created for dotCopter, but it wasn't till just last night I found a bug with the ToShort method.

So here is the updated version

namespace DotCopter.Commons.Utilities
{
    public static class BitConverter
    {
        public static void ToBytes(byte[] buffer, int offset, long value)
        {
            Utility.InsertValueIntoArray(buffer, offset, 4, (uint)(value >> 32));
            Utility.InsertValueIntoArray(buffer, offset + 4, 4, (uint)value);
        }
 
        public static unsafe void ToBytes(byte[] buffer, int offset, float value)
        {
            Utility.InsertValueIntoArray(buffer, offset, 4, *((uint*)&value));
        }
 
        public static long ToLong(byte[] buffer, int offset)
        {
            long value = (long)Utility.ExtractValueFromArray(buffer, offset, 4) << 32;
            value |= Utility.ExtractValueFromArray(buffer, offset + 4, 4);
            return value;
        }
 
        public static unsafe float ToFloat(byte[] buffer, int offset)
        {
            uint value = Utility.ExtractValueFromArray(buffer, offset, 4);
            return *((float*)&value);
        }
 
        public static short ToShort(byte[] buffer, int offset)
        {
            return (short)(Utility.ExtractValueFromArray(buffer, offset, 2) >> 16);
        }
 
        public static int ToInt(byte[] buffer, int offset)
        {
            return (int)Utility.ExtractValueFromArray(buffer, offset, 4);
        }
    }
}