Added interactive control for altitude in Loiter (position hold) and Altitude hold (mostly just used for testing).

Throttle down = descend, throttle high = ascend.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1831 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
jasonshort 2011-03-30 05:27:13 +00:00
parent 294d6752fe
commit 72fc8a1f51

View File

@ -416,7 +416,7 @@ uint8_t delta_ms_medium_loop;
byte slow_loopCounter;
int superslow_loopCounter;
byte fbw_timer; // for limiting the execution of FBW input
byte flight_timer; // for limiting the execution of flight mode thingys
//unsigned long nav_loopTimer; // used to track the elapsed ime for GPS nav
unsigned long nav2_loopTimer; // used to track the elapsed ime for GPS nav
@ -919,10 +919,10 @@ void update_current_flight_mode(void)
break;
case SIMPLE:
fbw_timer++;
flight_timer++;
// 25 hz
if(fbw_timer > 4){
fbw_timer = 0;
if(flight_timer > 4){
flight_timer = 0;
current_loc.lat = 0;
current_loc.lng = 0;
@ -966,11 +966,11 @@ void update_current_flight_mode(void)
case FBW:
// we are currently using manual throttle during alpha testing.
fbw_timer++;
flight_timer++;
// 10 hz
if(fbw_timer > 10){
fbw_timer = 0;
if(flight_timer > 10){
flight_timer = 0;
if(GPS_disabled){
current_loc.lat = home.lat = 0;
@ -1010,9 +1010,20 @@ void update_current_flight_mode(void)
//if(g.rc_3.control_in)
// get desired height from the throttle
next_WP.alt = home.alt + (g.rc_3.control_in); // 0 - 1000 (40 meters)
next_WP.alt = max(next_WP.alt, 30);
//next_WP.alt = home.alt + (g.rc_3.control_in); // 0 - 1000 (40 meters)
//next_WP.alt = max(next_WP.alt, 30);
flight_timer++;
if(flight_timer >= 2){
flight_timer = 0;
if(g.rc_3.control_in <= 0){
next_WP.alt -= 1;
}else if (g.rc_3.control_in > 700){
next_WP.alt += 1;
}
}
// !!! testing
//next_WP.alt -= 500;
@ -1051,10 +1062,23 @@ void update_current_flight_mode(void)
case LOITER:
flight_timer++;
if(flight_timer >= 2){
flight_timer = 0;
if(g.rc_3.control_in <= 0){
next_WP.alt -= 1;
}else if (g.rc_3.control_in > 700){
next_WP.alt += 1;
}
}
// Yaw control
// -----------
output_manual_yaw();
// Output Pitch, Roll, Yaw and Throttle
// ------------------------------------