jaspreeth / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Do not auto-save trim values #403

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
config.h

#ifndef AUTO_TRIM
# define AUTO_TRIM                              ENABLED
#endif

AUTO_TRIM is enabled by default, and in the example Skywalker config file.

This feature over-writes auto-trim values when manual mode is exited from some 
other mode.

        // Store control surface trim values
        // ---------------------------------
        if(g.mix_mode == 0){
                g.channel_roll.radio_trim = g.channel_roll.radio_in;
                g.channel_pitch.radio_trim = g.channel_pitch.radio_in;
                g.channel_rudder.radio_trim = g.channel_rudder.radio_in;

The intention was to over-write trim values with current trim if you execute a 
mode change to some auto mode. These new trim numbers are permanent, until the 
next power up with radio connected, when they are over-written.

I believe this feature if not well understood is undesirable, as it is not 
certain that MANUAL mode will be exited when the sticks are "hands off". For 
example, a pilot may take off, climb the plane, put it into a bank and while 
still flying the plane, flick the mode switch to LOITER or STABILIZE or 
whatever. This will save current values as "center" values and cause issues for 
correct autopilot control.

Also (minor) it re-saves the throttle trim needlessly:

        // save to eeprom
        g.channel_roll.save_eeprom();
        g.channel_pitch.save_eeprom();
        g.channel_throttle.save_eeprom();
        g.channel_rudder.save_eeprom();

PART II

trim_control_surfaces() is called upon power up.
If the RX has not yet bound with the TX, then the values are not well defined, 
and the trim values saved will be incorrect. Then when the TX is turned on, and 
the RX binds and starts sending good PPM, the proper trim values are not saved.

Finally it should be noted more clearly that during boot up, the plane should 
not be moved AND the sticks on the radio should not be moved.

PART III

Since trim_control_surfaces() is called from set_mode(), the set_mode that is 
called when failsafe is detected will re-set trim to possibly undefined values, 
and cause control problems.

Original issue reported on code.google.com by justinbe...@gmail.com on 5 Sep 2011 at 2:40

GoogleCodeExporter commented 8 years ago
I just checked the current public source, version 2.23, and see
g.channel_throttle.save_eeprom();
has been commented out. so ignore that small part of this report!

Original comment by justinbe...@gmail.com on 5 Sep 2011 at 3:20

GoogleCodeExporter commented 8 years ago
Many features are "undesirable if not well understood".  This feature is well 
tested and has proven very valuable in the field.

I have no issue with setting the default value to disabled if you think that 
will be better for new users.

Original comment by dewei...@gmail.com on 12 Sep 2011 at 1:27