# ArduIMU code tests/improvements II

I have implemented the dynamic weighting of accelerometer info and works very well...
I have made some flight test and the IMU can register some difficult maneuvers like rolls and loopings...
Well, rolls are not difficult for an IMU (there are no centrifugal forces involved) but loopings are quite difficult.
I´d also start to make some test of the robustness of the IMU/stabilization in difficult flight conditions. I flight in manual mode, do some "strange" maneuvre and then let the stabilization to restore a "normal" flight condition.... First tests were satisfactory but I need more tests...

Yesterday I made some videos showing the problem of vibrations/aliasing of the actual ArduIMU code:

and another video with the solution implemented (I explain this on the first point of the previous post):

Ah, this is the code of the dynamic weighting of accelerometer info:
// Calculate the magnitude of the accelerometer vector
Accel_magnitude = sqrt(Accel_Vector[0]*Accel_Vector[0] + Accel_Vector[1]*Accel_Vector[1] + Accel_Vector[2]*Accel_Vector[2]);
Accel_magnitude = Accel_magnitude / GRAVITY; // Scale to gravity.

// Weight for accelerometer info (<0.5G = 0.0, 1G = 1.0 , >1.5G = 0.0)
Accel_weight = constrain(1 - 2*abs(1 - Accel_magnitude),0,1);

And on the drift correction we apply this factor:
...
*Kp_ROLLPITCH*Accel_weight;
...
*Ki_ROLLPITCH*Accel_weight;
...

JJ.

Views: 318

Tags: arduimu, code, imu, test

Developer
Comment by Ryan Beall on November 13, 2009 at 1:58pm
And you found probably the most significant factor in getting an IMU to work. Congrats and great work!
Comment by Matt on November 13, 2009 at 3:49pm
That is a great improvement - from not working to working. The yaw still has slight drift when powered. I wonder why the yaw moved slightly but not the other axis.

Developer
Comment by Jose Julio on November 14, 2009 at 3:11am
Thanks Ryan...

Matt, the yaw is not drift corrected on this video because we need that the GPS moves to get a heading readout to correct yaw drifts...
Comment by Rana on November 14, 2009 at 5:55am
That's really gre8 !

3D Robotics
Comment by Chris Anderson on November 14, 2009 at 9:07am
Very impressive video technique! Yay shiny screens...

Is this using the ArduIMU+ version 2 (flat) or version 1 hardware?

Developer
Comment by Doug Weibel on November 14, 2009 at 9:28am
@Chris - It is the version 1 hardware. There is a hardware problem with the (flat) board that we have not worked through yet.

3D Robotics
Comment by Chris Anderson on November 14, 2009 at 9:34am
Doug, thanks for the reply. Can you work with me and Jordi to integrate the changes once you've nailed them? We really appreciate the work you guys are doing!

Developer
Comment by Jose Julio on November 14, 2009 at 12:02pm
Yes Chris, I am talking with Jordi and Doug to integrate this modifications on ArduIMU code... :-)
Really my hardware is an old 5DOF IMU from SF (with IDG300) plus an LISY300 (for yaw) from ArduIMU hardware but the problem described here and the solution would be the same...

Video technique was a chance. First time I see the effect I think Oh this is a !!!!!!!! but then I take a look again and think that it´s good for this explanation becuase you can see the plane and propeller....

JJ.

Comment

Join DIY Drones

1

2

3

4

5

6

7

8

9

10

## Groups

327 members

1805 members

81 members

882 members

• ### Agricultural UAVs

305 members

Season Two of the Trust Time Trial (T3) Contest has now begun. The fifth round, 3D model building requiring contestants to survey and reconstruct a building or natural scene from aerial images.

A list of all T3 contests is here.