Hi,
I've been working with ArduPilot 2.6 load currently in the repository.
In my particular airframe, I need to reverse both the ailerons and the elevator, so in my header file, I have REVERSE_ROLL and REVERSE_PITCH both set to -1.
The FBW modes seem to work normally, however, STABILIZE and any AUTO mode (mode>FBW_B) the nudging function seems to be reversed to me.
Looking at the code, I notice that in the main loop we have the code for the FBW modes:
// fake Navigation output using sticks
nav_roll = ((ch1_in - ch1_trim) * (long)HEAD_MAX * REVERSE_ROLL) / (ch1_max - ch1_trim);
nav_roll = constrain(nav_roll, -HEAD_MAX, HEAD_MAX);// nav_pitch is the amount to adjust pitch due to altitude
nav_pitch = ((ch2_in - ch2_trim) * -1 * (long)PITCH_MIN * REVERSE_PITCH) / (ch2_max - ch2_trim); // We use PITCH_MIN because its magnitude is normally greater than PITCH_MAX
nav_pitch = constrain(nav_pitch, PITCH_MIN, PITCH_MAX);
While in the attitude tab we have the AP_STICK_Mixing code:
if ((AP_STICK_MIXING == 1 && control_mode > FLY_BY_WIRE_B) || control_mode < FLY_BY_WIRE_A) { // if Controll mode is Auto/RTL/Loiter with Stick Mixing OR we're in STABILIZE
ch1_inf = (float)ch1_in - (float)ch1_trim; //I wonder if the fact that there is no REVERSE controls here is why my STABILIZE mode appears to work backwards.
ch1_inf = abs(ch1_inf);
ch1_inf = min(ch1_inf, 400.0);
ch1_inf = ((400.0 - ch1_inf) /400.0);
ch2_inf = (float)ch2_in - (float)ch2_trim;
ch2_inf = abs(ch2_inf);
ch2_inf = min(ch2_inf, 400.0);
ch2_inf = ((400.0 - ch2_inf) /400.0);
}
Which does not use the REVERSE_PITCH/ROLL constants. On my aircraft the ailerons and elevator are correctly sensed when in either FLY_BY_WIRE mode, but are reversed in STABILIZE mode.
Is this a problem in the 2.6 code? I can see that this issue would not be caught unless one had to use the reversing function in the header file. On the otherhand, I'm still learning my way around this autopilot so there might be reversing logic deeper in the code that I haven't gotten to yet in my studies.
Cheers,
Tom
Tags:
Permalink Reply by John C. on April 21, 2010 at 3:45pm
Permalink Reply by John C. on April 21, 2010 at 9:29pm
Permalink Reply by John C. on April 21, 2010 at 9:50pm
Permalink Reply by Tom Hastie on April 22, 2010 at 6:45am
Permalink Reply by John C. on April 22, 2010 at 7:29am
Permalink Reply by John C. on April 22, 2010 at 9:01am
Season Two of the Trust Time Trial (T3) Contest has now begun. The third round was a reliablilty/aerial photography round for both planes and copters, which is now closed. Stay tuned for the next round, beginning soon.19 members
59 members
28 members
114 members
94 members
© 2012 Created by Chris Anderson.
