Jack Crossfire's blog View Details
Archive for September, 2007
Posted by Jack Crossfire | Sep 30, 2007 @ 02:30 AM | 2,692 Views
So to fix the algebraic navigation, we now convert the orientation quaternion to eulers and back to a quaternion. The key is the integration is always done to the quaternion, not the temporary eulers.

The pure quaternion seemed to accumulate pirouettes while the euler obviously did not. The accumulated pirouettes caused the slerp operation to freak out.

Eliminating the Kalman filter is worth a lot of clockcycles & lines of code.

Through the magic of realtime satellite photos, snagged a rare view of Pt. Reyes in sunlight. In the 80's you couldn't know if Pt Reyes was clear without driving there.

Pt Reyes in sunlight raw footage (5 min 57 sec)
...Continue Reading
Posted by Jack Crossfire | Sep 28, 2007 @ 01:26 PM | 3,087 Views
According to http://docswiki.gumstix.com/Benchmarks, the 600Mhz Gumstix could probably do 12500 iterations/second, fast enough for inflight training. $170 * 1.09 tax + 10 shipping = 195
Posted by Jack Crossfire | Sep 28, 2007 @ 03:14 AM | 3,159 Views
So the latest network is 615 nodes trained in 25,000,000 iterations offline. It uses 25 previous tilt -> velocity readings to predict the next velocity. Optimized the prediction loop to the point that the Gumstix could run it 15 times a second, but we only do 1 prediction per second. It seems to give better prediction than the best inflight training possible on this chip.

The answer is yes. She can compute a neural network much faster in fixed point and probably equal the accuracy of floating point, but she can't train a neural network in fixed point, so fixed point is dead.

Squeezed in a flight with RPM being recorded. Ideally this flight would be a static hover for 20 min, but lacking the discipline, crashed and destroyed the IMU. No neural network training on RPM this week.

This one was a stall in 20mph wind. Stalls with this copter are sudden losses of head speed due to aerodynamic load. Been losing head speed a lot with these 3.3Ah 12C batteries.

Magnetometer repair: done
Tachometer test: 1 flight down, 100 more to go
Algebraic navigation: couldn't solve the 180' heading problem. Leaving behind inflight training so this won't be an issue for a while.
Posted by Jack Crossfire | Sep 27, 2007 @ 03:18 AM | 3,107 Views
The war continues towards the next test flight. The first static test with the tachometer worked. According to the test, the Mega 16/15/4 maxed out at 17000rpm and we seemed to get correlation between readings and head speed. The tachometer is very approximate. As a 3 phase PWM driven motor, there's no way to guarantee if a pulse is a rotor movement or a duty cycle, so this reading will probably depend slightly on battery voltage.

Additional Xena diodes for the tachometer & protection of the 3.3V parts finally made it in.

The magorator finally got a new halogen.

The magnetometer requires major surgery again.

Still have more tests with the algebraic AHRS module, offline trained neural networks, speed governing by PID loop, and inflight training hasn't even been tested in an actual flight.
Posted by Jack Crossfire | Sep 26, 2007 @ 02:14 PM | 2,832 Views
If the Gumstix spends too much time training the network, it'll overrun the radio input buffer and flight controls will get delayed several seconds. The trick is to maximize network training cycles without starving the flight control input.

Tried various inflight training scenarios to see how much brain power a 200Mhz Gumstix can have. In simulations, inflight training worked best when the network received 25000 iterations in the same sample as the latest GPS reading. Lacking enough clockcycles, we split the iterations across the tilt readings between each GPS reading.

The Gumstix maxed out at 25 iterations per tilt reading. At this limit, the result had no prediction effect at all. The lowest iteration count producing prediction effect was 50 iterations per tilt reading. Reducing the hidden neuron count increased the iteration limit. Increasing the hidden neuron count decreased the iteration limit. No combination of neuron count + iteration limit gained any advantage.

Eliminating climb rate increased the iteration limit and got prediction effect, but this defeats the purpose of a neural network.

At 600Mhz, the fastest Gumstix, the iteration limit would be 75 and that would barely have prediction effect.

The other option is get a new laptop + XBee modules for ground based autopilot, very expensive and not as portable.
Posted by Jack Crossfire | Sep 25, 2007 @ 12:53 PM | 3,094 Views
Neural network assisted hover 4 U:

Neural network autonomous hover (1 min 0 sec)

Even with the 10m error, keeping her in frame for the entire flights was impossible.

Well, the neural network is definitely a different world than last month. A few months ago we were ecstatic with 20 seconds of autopilot. Now position hold is good enough that we don't even look at her at all times anymore. On a global scale, she can hold position. On an American scale, the open spaces are a bit smaller and the position hold is lousy but positive.

The last 2 flights were in a 5mph offshore wind. On flight 1, she sayed within 10m of the target position for 4 minutes. On flight 2, after staying within 10m of the target position for 3 minutes, for some reason she headed off at constant velocity. Getting rid of position error integrals seemed to fix yesterday's oscillation.

Altitude hold was handed back to the computer. Had to manually trim the throttle periodically as the battery drained and that may ruin the neural network output. On a full battery it works. A rotor tachometer for altitude hold is looking better & better.

The neural network can't predict climb rate from throttle at all but we have it predicting climb rate anyway because it feels like it's working. Lack of correlation between head speed & throttle seems 2 B the main problem with this.

With in-flight training + Kalman navigation, the Gumstix can only do around 25 iterations per GPS update. In flight training greatly improves the prediction but it takes over 1000 iterations per GPS update. The only solution may be an FPGA. With the offline training, iterations over 1000000 and hidden nodes over 15 seem 2 make no difference. May be a limitation in lwneuralnet since that uses a lookup table.

Until next week, the next step is to try evolutionary training, switching back to algebraic navigation, enabling a second neural network for feedback.
Posted by Jack Crossfire | Sep 24, 2007 @ 03:48 AM | 3,011 Views
Well, the first test flight with the neural network estimating velocity happened in no wind of any kind. Used a new offline trained network with 6 inputs & 2 outputs, reduced the number of integration steps when predicting velocity to 1, and that got it fast enough to run on the Gumstix.

The neural network offered very little improvement over GPS when predicting velocity based on its own tilt feedback. Nevertheless, the velocity oscillation seemed 2 B gone. Instead, very large drifts in position happened.

The neural network may have eliminated small scale oscillations but left behind large scale oscillations. It may have done nothing and what we saw was virtually no wind combined with precisely calibrated neutral tilt.

Secondly, the offline training for that test flight was based on another flight recording with significant oscillation. When the network was trained using its own flight recording, it gave slightly better results. The network probably needs online training.
Posted by Jack Crossfire | Sep 23, 2007 @ 11:35 PM | 2,954 Views
So the next network used 25 previous tilt & acceleration samples to predict 1 acceleration from 1 tilt. 257 nodes in all. It literally memorized and recalled flight recordings. The training involved 2 hours of offline simulations. This neural network was probably almost as smart as an earthworm.

The good sections of data show it predicting the velocity direction ahead of GPS but not getting the right magnitude at all. Velocity from roll bested the 5 node network.

Don't like training networks offline, from previous flight recordings. Prefer networks which train themselves in flight. There is always some anomaly in offline training which U have 2 live with from then on.
Posted by Jack Crossfire | Sep 23, 2007 @ 03:57 AM | 2,713 Views
Chose lwneuralnet as our neural network library because it's simple and can run on the Gumstix without requiring any more libraries.

So with lwneuralnet the inputs & outputs must be between 0.0 and 1.0. The randomizing feature could rarely generate useful results. Unrandomized networks seemed 2 work best. Lwneuralnet uses back propagation and has no evolutionary algorithm. Ideally we'll B using random evolution in a finished product.

It takes about 1000000 iterations to train the neural network enough to do the job. The neural network didn't seem 2 do much better than dividing acceleration vs. tilt.

With the network from 9/21/07 it worked when it worked but didn't work most of the time. It was way too slow on a 2.4Ghz Opteron to have a chance on the Gumstix.

This is the first time anything has come close to barely getting ahead of GPS, so it's still pretty exciting. There still seems 2 B enough information for a neural network of some kind to predict velocity ahead of GPS.

Probably need to forget about training neural networks in flight at all. Need to focus on feeding past measurements into the inputs of a fixed network.
Posted by Jack Crossfire | Sep 21, 2007 @ 01:53 PM | 2,881 Views
So the neural network strategy is the following:

Shift GPS acceleration history forward in time.

Train neural network to get shifted GPS readings vs tilt.

Predict future velocity by integrating the acceleration vs. tilt network beyond latest GPS reading.

Calculate target tilt from predicted velocity.

Tests with the 3 hidden node design so far have been unsuccessful.


Lwneuralnet has a training algorithm for multiple input samples. It tests the single sample network on random samples of inputs & outputs and assumes a reduction in error for one sample reduces the error for all samples. A moving average of its error actually shows it converging on a solution, but applying the training to new tilts is completely worthless. The acceleration results are all biased.

Training the network in flight is probably too slow. A fixed network using past tilt + acceleration in addition to current tilt as its inputs is looking more attractive.

Meanwhile, started orientation-only test flights with hard coded
orientations. The Kalman filter tends to drift more than the algebraic solution, but in every test run the exact same orientation was locked in after a period of oscillation and drifting.

Algebraic AHRS still fails when heading goes from 179' -> -180'. If that was fixable, the Kalman would disappear faster than Americans in Iraque.

Burt wrote:
> I think it's absurd they're doing Orion development at all.

Speak 4 yourself Burt, in an area where housing costs more than room on the space station. Humans can either spend $20 million for dumpy apartments or move into space.
Posted by Jack Crossfire | Sep 20, 2007 @ 01:01 AM | 3,089 Views
Kalman filter velocity came up too slow in the autopilot department. Time to move on to neural networks. Not sure exactly which neural network to use. There aren't enough clockcycles for a very complex network. The network must constantly evolve in flight, based on wind conditions.

All roads lead towards a tilt -> velocity network, using the most recent tilt & time shifted GPS velocity readings to predict the current velocity from tilt. The delayed GPS readings are shifted up and used to train the network. The same network could B used to generate feedback tilt.

tilt -> acceleration networks would B hard because velocity would drift and tilt isn't entirely proportional to acceleration.

A 5 node model is probably all the Gumstix can do.
Posted by Jack Crossfire | Sep 18, 2007 @ 11:14 PM | 2,816 Views
So it seems the Corona is no longer made and what parts remain are drawing down the last inventory. Tail rotor shafts are already gone. When the Corona dies, we're going 2 need a different copter. Coronas have been replaced by smaller trainers for $100, aerobatic copters for $400, and anything with similar payload starting at $1600. All the new flight times are much shorter. Lacking any dollar/lb advantage below $1600, beginning 2 lean toward a 3 ducted fan replacement.

Estimated cost:

3 * EDF + motor + ESC = $1500
3 * 4Ah 11.1V = $300
2 * yaw servos = $50

Control mapping:
Cyclic -> mix of 3 fans
Collective -> total power
Rudder -> fan angle

Advantages: safer shrowded rotors can fly closer to people. Conversion 2 high speed fixed wing flight. Less vibration.

Losing the damping effect of a flybar makes this high risk.

Software yaw damping didn't go so well either. Small diameter rotors are notoriously inefficient. Avionics would B reused if the Corona was truly unflyable. Could start with cheapest propellers and upgrade to fans when proven.
Posted by Jack Crossfire | Sep 17, 2007 @ 01:57 AM | 2,961 Views
Watched Harry Potter IMAX 3D, only 20 minutes of which are 3D and once again the 3D process was hardly perfect. Our last 3D experience was The Polar Express, that was entirely 3D, it worked, and it was 50% cheaper 2 years ago. Decided it was worth making some more anaglyphs.

Anaglyphs can recreate more of what it felt like to be somewhere than 2D alone. They are a matter of luck and rely more on 2D techniques to simulate 3D than the stereo pair itself. Someday we may make anaglyphs from Vicacopter.

Lacking 2 decent cameras, we have built up notes on making anaglyphs with a single camera.

Use narrow depth of field to enhance depth.

Use slight camera movement for nearby objects, even less than the distance between human eyes. Use large camera movement for distant objects, over 5ft.

Align objects to point in and out instead of sideways.

Make it as bright as possible.

Objects which are to protude in front of the 3D image need 2 B fully enclosed in the borders.

Use Cyan/Red to retain color.

All images must B rectilinear. Fish eye doesn't work.

The stereo pair needs to be lined up vertically as much as possible.
Posted by Jack Crossfire | Sep 16, 2007 @ 02:12 AM | 2,855 Views
Goo Tube finally processed the movie of that cyclic response to velocity using 2 Kalman filters. We've seen actual flying giving much better velocity readings than this, yet this still seems greatly improved since last week.

Cyclic response to Kalman velocity (0 min 55 sec)

Posted by Jack Crossfire | Sep 15, 2007 @ 03:45 PM | 3,032 Views
Decided 2 move forward with the Kalman. It solved our biggest problem with algebraic navigation: loss of control when facing South. Flight tests with Kalman orientation hold + no GPS checked out perfectly. The 200Mhz Gumstix can only do 100 analog readouts/sec if the Kalman filter is doing 30Hz.

Position hold was a different story. GPS seems to feed up through the filter and cause it to lose orientation. However, the velocity curves making those lousy orientation results are the smoothest we've gotten.

Conclusion: need separate Kalman filters for orientation and position. 2 bad the money for a faster Gumstix was already spent on the EB-85 fiasco + monster rent inflation. The algebraic solution for orientation would need a fix for the South facing bug.

Hand tweeking the accelerometer center values got better velocity results. The accelerometer center point may indeed depend on the tilt that provides 0 acceleration reading as 0 deg tilt.

With 2 independant Kalman filters for position & orientation, the 200Mhz Gumstix only does 50Hz analog readings. Further tweeking with the conversion from world to copter frame got the first results that actually looked like what was really happening.
Posted by Jack Crossfire | Sep 14, 2007 @ 02:08 AM | 2,792 Views
4 those of U fascinated by the future of 5Hz GPS, go 2


What a disappointment. Yet another Chinese invention that produces very beautiful, worthless results.
Posted by Jack Crossfire | Sep 13, 2007 @ 12:33 PM | 2,804 Views
So the EB-85 really does generate 5 unique velocity and position sentences every second. It's no more sensitive than the EM406. It still has a heavy ceramic antenna. Before flight testing can begin, we have many issues to resolve.

The EB-85 has no status LED like the EM406. New flashing codes for the flight computer are required.

solid - Flight computer running. No IMU.
1 flash - IMU functioning. No GPS data.
2 flashes - IMU + GPS functioning. Calibrating INS.
3 flashes - IMU, GPS, INS functioning.

The last crashes destroyed Vicacopter's electronics tray. A new one has been built.

Resoldered the Micromag again.

Pitch servo had a broken solder ball.

Fixed the new GPS to the electronics table and it finally has a header for when U want 2 reduce weight for manual flying.

With more technical issues yet 2 B solved, the earliest test flight is probably going 2 B Sunday.

The reason we haven't moved forward with neural networks is because every neural network experiment has so far required a simulator simulating physical responses to the control movements. There is no exact simulator for Vicacopter. She would be the first neural network trained by matching existing control movements and that is unlikely to work.

Another possibility is switching in a large number of random weights during a real flight. That would take a real long time.

Another realization is the Neural Robotics copter seems 2 have trouble flying forward real fast. The Rotomotion copter can do 25 knots with its PID loops but can't hover easily.
Posted by Jack Crossfire | Sep 12, 2007 @ 02:19 AM | 2,551 Views
It took some doing, but the Kalman filter is back. The MEMS are lowpassed before feeding the Kalman and now it seems 2 B more stable.

Didn't try to tie the Kalman into flight control. Just simulated some position plots. The Kalman transposed a lot of the values and changed a lot of signs.

The Kalman yielded no improvement in velocity data over the algrebraic solution. Any improvement in position was also subjective. That explains why there's no Kalman velocity plot from before. The Kalman position plot from before seems 2 B over a longer time period.

Suspect at the rate GPS is improving, there's going 2 B 30Hz GPS next year and hand coded Kalman filters R going 2 B obsolete.
Posted by Jack Crossfire | Sep 11, 2007 @ 12:37 PM | 2,273 Views
Today is 9/11, but more soldiers have died fighting terrorists than office workers. Conclusion: private office workers are better fighters than government armies.

space.com wrote:
> Shuttle Astronauts Honored at Walt Disney World
> Russia Launches New Military Satellite

Definitely a difference in priorities.

AP wrote:
> Health Insurance Premiums Rise 6.1 Pct.
> deficit with China jumped 12.5 percent in July to $23.8 billion
> Oil prices hit all-time high
> investors grew more confident that the Federal Reserve will lower interest rates

Guess you'll B paying for your bosses mortgage after all.
Posted by Jack Crossfire | Sep 11, 2007 @ 01:41 AM | 2,419 Views
Well, squeezed in some flights where we reset the integrated acceleration to every GPS reading instead of blending it. The delay in the velocity estimate was gone but the output was horrible. Go back to this nugget of information


and U'll C the Kalman filter had an edge in position estimation. With fixed wings, U can get away with algebra & GPS, but the trick with copters is the extra position information only a Kalman filter seems to provide.

The advantage with algebraic navigation is a 208Hz update rate. The Kalman can only do 30Hz on this processor, but even with 30 it had the position estimating power. 5Hz GPS is on the way nevertheless.