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
You need to be a member of diydrones to add comments!
Replies
I learned from our discussion how deeply certain engineering paradigms sit inside our brains. Some of them even develop the status of a sacrilege ("Never ask.."). Initial offsetting seems to belong to this category.
We agreed that initial offsetting is done just for the sake of a faster gyro lock - shorter time to convergence. We also agreed that the DCM handles the drift shuffling for us autonomously - no need for a "guidance". We further agreed about the expectation values omega_i should have both for the case of zeroed AN_offset and measured/non-zeroed AN_offsets.
The question remains: What is the difference between the start from a "measured" AN_offset (or omega_i filled from the latter) and a hard-wired "good guess" such as {6,-6,6}? The answer is that the time to convergence for the measured case might be a bit faster. In my experience it is not senseable - the guess is good enough - and measuring takes time and code as well.
Let me conclude that initial offsetting is not needed in practice.
Best regards,
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