Servo limits (maximum throw) is not working in stabilize, fbw and other modes

I've recently tried to setup APM for my new flying wing and discovered that it is not safe to fly in other than Manual modes =( The reason is servo throws for most flying wings must be limited, but APM limits them only in Manual, in all other modes servos goes to endpoints.

After some googling I've found 2 bugs submitted to issue logger on google code of arduplane:

1)

Issue 647:

Elevon control throw for manual mode does not match control throw for other modes

2)

Issue 686: Servo limits (maximum throw) is not working in stabilize, fbw and other modes.

Another helpful user - Vladimir Popov commented:

Comment by Vladimir Popov yesterday

I just investigated firmware sourses... Stick deflections are added to servo output a bit tricky - automatic output signal is scaled down to leave place for manual signal. It seems Ok, but the algorithm is internally limited - manual signal must not exceed +-400 ms from trimmed value. I do not know why. So, don't move sticks too much...

I think you can ask developers about this limitation. Function stabilize() in Attitude.pde.

In RTL mode sticks are not mixed at all.

So what should we change in order to make it work? Thanks for the help!

Views: 2070

Reply to This

Replies to This Discussion

Investigated code myself. So if I change '500' to '225' in lines 369,370 (attitude.pde)

g.channel_roll.radio_out = elevon1_trim + (BOOL_TO_SIGN(g.reverse_ch1_elevon) * (ch1 * 500.0/ SERVO_MAX));
g.channel_pitch.radio_out = elevon2_trim + (BOOL_TO_SIGN(g.reverse_ch2_elevon) * (ch2 * 500.0/ SERVO_MAX));

I got somewhat good servo throws. Don't know if it is the correct way of doing it. I'll fly it today.

Warning! Do NOT try this yourself - this is not checked at all. Stay tuned for further notice.

Ok it flies, but tends to nose down a lot. Which proves - this is not the correct way to fix it =)

I mean another part of code :

// Mix Stick input to allow users to override control surfaces
// -----------------------------------------------------------
if ((control_mode < FLY_BY_WIRE_A) ||
(ENABLE_STICK_MIXING == 1 &&
geofence_stickmixing() &&
control_mode > FLY_BY_WIRE_B &&
failsafe == FAILSAFE_NONE)) {

// TODO: use RC_Channel control_mix function?
ch1_inf = (float)g.channel_roll.radio_in - (float)g.channel_roll.radio_trim;
ch1_inf = fabs(ch1_inf);
ch1_inf = min(ch1_inf, 400.0);
ch1_inf = ((400.0 - ch1_inf) /400.0);

ch2_inf = (float)g.channel_pitch.radio_in - g.channel_pitch.radio_trim;
ch2_inf = fabs(ch2_inf);
ch2_inf = min(ch2_inf, 400.0);
ch2_inf = ((400.0 - ch2_inf) /400.0);

// scale the sensor input based on the stick input
// -----------------------------------------------
g.channel_roll.servo_out *= ch1_inf;
g.channel_pitch.servo_out *= ch2_inf;

// Mix in stick inputs
// -------------------
g.channel_roll.servo_out += g.channel_roll.pwm_to_angle();
g.channel_pitch.servo_out += g.channel_pitch.pwm_to_angle();

}

When manual deflection is less than 400 ms, total servo input (automatic + manual) does not exceed 400 ms. When manual signal is bigger than 400 ms, automatic signal is supressed completely, and unlimited manual signal is sent directly to servo. 

I understood that, but I thought mistake was in another part of the code.

When manual signal is bigger than 400 ms, automatic signal is supressed completely, and unlimited manual signal is sent directly to servo. 

But in Manual mode APM also directly sends the value to servo. Why this direct value(when mode is not manual) is different and bigger than in Manual mode?

Any result thence?

Still investigating....

No weather, no flights.Terrible climate :-(

Did you ever solve the problem???

Nope =(

Bump! Anyone managed to solve this?

I upload the newest ArduplaneNG software (from here:http://megapirateng.googlecode.com/svn/branches/arduplane/ ), and I think problem is solved. But didn't fly too much, because I changed the board to HK Pilot 2.5, and working very well!!!

Use http://downloadsvn.codeplex.com then. Just copy paste the above URL for the arduplane branch and you are good to go.

Thanks Istvan! Will try in a few days.

I've tried the version that you linked to. Unfortunately, it has same huge servo throws.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service