Browse Source

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
master
jasonshort 14 years ago
parent
commit
9b79904a5e
  1. 13
      ArduCopterMega/Attitude.pde
  2. 5
      ArduCopterMega/commands_logic.pde

13
ArduCopterMega/Attitude.pde

@ -149,13 +149,18 @@ output_yaw_with_hold(boolean hold) @@ -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
// -error = CCW, +error = CW
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
g.rc_4.servo_out = g.pid_acro_rate_yaw.get_pid(error, delta_ms_fast_loop, 1.0);// kP .07 * 36000 = 2520
if(g.rc_4.control_in == 0){
// we are breaking;
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°
}
}
// slight left rudder give right roll.

5
ArduCopterMega/commands_logic.pde

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

Loading…
Cancel
Save