Added break feature on yaw control. Please verify it works properly before flying.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1752 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
jasonshort 2011-03-07 16:59:58 +00:00
parent 6b99e76fcb
commit 9b79904a5e
2 changed files with 12 additions and 6 deletions

View File

@ -149,13 +149,18 @@ output_yaw_with_hold(boolean hold)
long error = ((long)g.rc_4.control_in * 6) - rate; // control is += 6000 * 6 = 36000 long error = ((long)g.rc_4.control_in * 6) - rate; // control is += 6000 * 6 = 36000
// -error = CCW, +error = CW // -error = CCW, +error = CW
if(g.rc_4.control_in == 0) if(g.rc_4.control_in == 0){
g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 3.0);// kP .07 * 36000 = 2520
else // we are breaking;
g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 1.0);// kP .07 * 36000 = 2520 g.rc_4.servo_out = (omega.z > 0) ? -1800 : 1800;
}else{
g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 1.0);// kP .07 * 36000 = 2520
}
g.rc_4.servo_out = constrain(g.rc_4.servo_out, -2400, 2400); // limit to 24° g.rc_4.servo_out = constrain(g.rc_4.servo_out, -2400, 2400); // limit to 24°
} }
} }
// slight left rudder give right roll. // slight left rudder give right roll.

View File

@ -75,7 +75,9 @@ handle_process_now()
void void
handle_no_commands() handle_no_commands()
{ {
if (command_must_ID) return; if (command_must_ID)
return;
switch (control_mode){ switch (control_mode){
case LAND: case LAND:
// don't get a new command // don't get a new command
@ -85,7 +87,6 @@ handle_no_commands()
// set_mode(LOITER); // set_mode(LOITER);
default: default:
if()
set_mode(RTL); set_mode(RTL);
//next_command = get_LOITER_home_wp(); //next_command = get_LOITER_home_wp();
//SendDebug("MSG <load_next_command> Preload RTL cmd id: "); //SendDebug("MSG <load_next_command> Preload RTL cmd id: ");