Why Analog Offsetting in DCM derivatives (ArduImu, Razor9DOF, Kixrazor)?

Hi all (especially Bill & Doug)
I wonder why "analog" offsetting is done for the gyros and accelerometers at program start? Why not filling omega_I with appropriate startup values instead? This way the code gets a bit leaner and kind of legacy-free.
Do me the favor:
Set all AN_OFFSETs to zero right before main loop.
Set Omega_I[0] to 6, Omega_I[1] to -6, and Omega_I[2] to 6 right before main loop (tested for Razor 9DOF). No levelling is required anymore to start with proper readouts. Ki_yaw may be set a bit larger.
Natalius



Views: 375

Reply to This

Replies to This Discussion

The gyros zero point is not stable over temperature, supply voltage, etc., so it is not possible to use a fixed value equated to zero rotation unless you only plan to operate in laboratory conditions.
Exactly! But exactly because of it why to introduce a set of "constants" (AN_offset[]), viz. never-to be changed offset variables inspite of knowing that they are superfluous and "overtaken" by omega_I anyway?

BTW Doug, you are in good company! A highly respected friend of mine (from aerospace engineering) fully agrees with you that individual offsetting should be considered as "good practice". I have no objections against such - I just ask whether there is an alternative good practice. The recepy and numbers given are meant to let everybody see what I mean.

Natalius
The nice thing about being open source is that if you want to change something, you are free and welcome to do so!

Why don't you try your method and share the results of your experiments?
Absolutely agreed - please see the posting as the result.
It is definetely not meant as a kind of "code criticism". We are all trained to see things similarily. Also, it is a minor issue. But this minor issue has caused a fixation of the way we handle the DCM. As ground calibration/AN-offsetting is a procedure we got used to we may extrapolate reasoning that something similar is good for "autooffsetting"/"autozeroing"/"autotrim" during straight level flight.

I learned the hard way that one better should forget about the latter "good practice".

Natalius
Hi Natalius,

The reasons that I like to record offsets every time I power up are the following.

For gyros, it speeds the locking process. the closer you start to the correct values, which vary with temperature, the quicker the locking process stabilizes for compensating for gyro drift. If you have the wrong values, locking takes a lot longer. Once you have gyro lock, the process will track as temperature changes, but because of the temperature dependence, unless you temperature compensate the gyros (which I prefer not to do) the most reliable thing to do is measure the offsets each time you power up.

For the gyro offsets, the orientation of the plane during power up does not matter, only that the plane is motionless.

For accelerometers, there is not quite as strong reason for recording offsets every time you power up. But you do have to have an approximately correct value, because there is no other way to correct the accelerometer offsets after takeoff. For the accelerometers, you need to hold the plane motionless, and level.

Personally, one reason that I like to record accelerometer offsets on power up because it gives me a convenient way to fine adjust the plane's cruising speed. If I want it to fly a bit faster, I power up with the plane pitched down a little bit. If I want it to fly a bit slower, I power up with the plane pitched up a little bit.

Finally, personally I find it more convenient to measure the offsets each time I power up, rather than have a special procedure for committing them to EEPROM, simply because I fly with so many different prototype boards and airframes, it is one less thing for me to worry about while setting up a new board/plane.

Best regards,
Bill
Fair enough , thanks Billu Bhaiya.
Hi Bill,

Thanks for your explanations and engineering rationale which I appreciate indeed. Let me add another reason for the preference you describe. While we have a good idea for the expectation values the individual AN_offsets should have, we don't have a good idea for the components of the omega_i vector. Although math can be developed to estimate omega_I as a function of AN_offsets, it is definetely not a simple excercise.

My counterargument here: We don't need to estimate because we can measure omega_i in the course of sensor stabilization. This way we also get an idea about a reasonable value for Ki_yaw.

Seeing is believing A: If one starts with all AN_offsets set to zero and Ki_yaw set to 0.00002 the following happens: The IMU sensor doesn't leave its "wild state" for a long, long time: Yaw spins faster than 1 Hz - Roll and pitch are about 45 deg. I didn't have the patience to wait until convergence - it may take hours, don't know.

Seeing is believing B: If one starts will all AN_offsets zeroed and Ki_yaw at 0.002 the spinning yaw may take a couple of minutes until yaw starts a damped oscillation towards its expectation value. During this phase roll and pitch slowly converge to their expectation values. Omega_I converges to values close to {6, -6, 6}.

Seeing is believing C: If one starts with AN_offsets zeroed, Ki_yaw between 0.002 and 0.00002, and omega_I set at {6, -6, 6} the IMU behaves as if "calibrated" and ready to go. Actually the converged values for omega_I were a little smaller. I found {5.98, -5.88, -5.99}, but there is no senseable difference at the level of IMU behavior. Thus the rounded values suffice, "calibration" is not needed, the devilish numbers can be even "hard-wired" as constants, no need to store in EEPROM.

So my devilish advice (while feeling like a ghost driver in a freeway system now): We should learn to trust the DCM - as said Ki_yaw a bit higher and offsetting comes out as a free gift from a beautiful algorithm.

Regards,

Natalius
PS:

"Personally, one reason that I like to record accelerometer offsets on power up because it gives me a convenient way to fine adjust the plane's cruising speed. If I want it to fly a bit faster, I power up with the plane pitched down a little bit. If I want it to fly a bit slower, I power up with the plane pitched up a little bit."

I guess it works because omega_I builds up too slowly. I further guess that it works best if one zeroes Ki_yaw. Although I see that this practice makes life "at the field" easier, please allow me to express some discomfort with it. First, it is a misappreciation of the lady's beauty so to speak (with the lady I mean your DCM). If one trusts her, she is able to cancel out wrong ground calibration later in the air - if one mistrusts her, this option is gone. Second, I have gained the impression that the most important part of using IMU sensors is to do a careful and proper - mechanically stable - fixation of the sensor board to the fuselage. (Believe me again that I learned the hard way). So, instead of putting nose up/down during calibration on ground, one should think about a micrometer screw to adjust a proper "angle of attack" (If someone could bring to the market a little plastic device for such adjustment...)
I have to correct myself:
"Although math can be developed to estimate omega_I as a function of AN_offsets, it is definetely not a simple excercise."
While I don't have a formal proof for it, it looks that omega_i [] for zeroed AN_offset [] just reflects AN [] * gyro_gain * Torad.
Hi Natalius,

You are correct, the steady state value of omega_i[] exactly reflects the residual gyro offsets, which are a function of temperature and supply voltage.

I have done experiments where I have heated the gyros after gyro lock. There is a transient period during which omega_i[] adjusts to the new offsets.

When I say "residual gyro offsets", I am referring to the difference between the latest values of the gyro offsets, minus the values on power up.

Best regards,
Bill

Best regards,
Bill
Sorry for bothering and Thanks for your patience, Bill.

While I see the rationale to do the offsetting at the level of accelerometers (unlike for the case of the gyros), it seems that the effect of the latter is marginal (at least for the 9DOF Razor board I have and given the limited precision I am able to do angular move comparisons). So, the gross effect is that the Razor 9DOF with ALL AN_Offsets zeroed but omega_I initialized instead behaves undistinguishable from a Razor 9DOF with initial AN_offsetting and no omega_i initialization.

May be that some confusion is in the air because we compare apples with bananas. Some DCM-derivates have magnetometer input - some don't. Personally, I like to have a strong magnetometer influence due to its healthy effect on the issue of centrifugal acceleration. So my question: When you did "ground levelling" to preset airspeed, did you also have magnetometer correction?

In Seeing is Believing C, Kp_rollpitch was 0.02, Ki_rollpitch 0.00002, Kp_yaw 1.2 and Ki_yaw as given.

Regards,

Natalius
Hi Natalius,

You said:

"So, the gross effect is that the Razor 9DOF with ALL AN_Offsets zeroed but omega_I initialized instead behaves undistinguishable from a Razor 9DOF with initial AN_offsetting and no omega_i initialization."

We agree on that point.

What I was trying to say is that unless you do one or the other, it will take longer to get gyro lock.

I was also saying that the actual values of the offsets depend on temperature, so if you are going to be operating over a wide temperature range, you should record the offsets on power up.

Regarding the magnetometer, I have two planes that I use quite a bit, one has a magnetometer, one does not. Both perform to my satisfaction. The one with the magnetometer achieves yaw lock prior to launch, so I can use it to launch in waypoint mode without having to orient my plane to the north at power up.

Best regards,
Bill

RSS

© 2014   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service