Sunday, November 20, 2011

Assembly complete!

With the frame together, I slapped together yaw mechanism.  (For yaw to work properly, a tricopter needs to be able to rotate one motor about the axis of its arm).  It's sort of tricky to make one that's slop free.  The more wobble there is between the servo arm and the movement of the motor, the worse the tricopter will control.  I made mine tight by using a delrin-like material for the motor mount.  I say delrin-like because the material is just a bit softer than delrin.  By drilling it out a bit smaller than the shaft that it rotates around, I get a really solid grip.  It moves pretty freely too.  The shaft that the motor mount rotates about was then attached to the frame by binding the two with some thin steel wire, then soaking the mess in CA glue.  It's solid.  The servo was attached similarly.
The shield containing the arduino and wiimote sensors was mounted on some slivers of the Tempur-Pedic foam.  I first tried cutting it with a hot wire which worked okay, but I found that a sharp xacto did a better job.  I used small amounts of CA to glue it to the frame and the board.  Otherwise, the foam tends to soak up CA and turn into a brick.  The board is now nice and squishy.  The foam does a really fantastic job of killing vibration.
I tested it by putting the board on my phone (set to vibrate) and taking sensor readings.  I then put a sliver of foam under the board, and watched all the wobbles go away.
Before flying, I had to adjust the PID settings.  PID or proportional integral derivative is a type of algorithm used in control systems.  It's used in a lot of places, from line following robots to HVAC systems.  In my case, P values set the amount of force with which the tricopter resists motion.  If P is too small, the tricopter drifts, and if it's too big, it will oscillate (overcompensation for a change in motion creates a runaway feedback loop).  The I value takes where the tricopter is, where it should be, and the time that it's been off to determine how to correct itself.  This also prevents drifting.  The more time the tricopter has not been in the right place, the harder it will work to get there.  The D value increases the speed of recovery, but if too high, it can also amplify oscillations.
I've learned that PID tuning is a fine art, not only is there a PID loop for each axis, but each variable affects the others.  It took me almost a day of trial and error to get a nice stable platform.  The values I used are to the left.
I'm really pleased with the gyro stabilized flight mode, it feels really solid with the exception of small oscillations after quick maneuvers.  I need to look into that.  For smooth hovering and basic flight, this setup rocks.

To change settings, all I need to do is upload new values to the Arduino.  I do this with an FTDI programmer.  One end plugs into six arduino pins, the other into my computer's USB port, then magic happens.

anyway, flight videos soon!