This commit is contained in:
Chris Anderson 2012-03-20 07:42:54 -07:00
commit f9f7be832f
5 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- /// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#define THISFIRMWARE "ArduCopter V2.5" #define THISFIRMWARE "ArduCopter V2.5.1"
/* /*
ArduCopter Version 2.5 ArduCopter Version 2.5
Lead author: Jason Short Lead author: Jason Short

View File

@ -723,7 +723,7 @@
// Throttle control gains // Throttle control gains
// //
#ifndef THROTTLE_CRUISE #ifndef THROTTLE_CRUISE
# define THROTTLE_CRUISE 350 // # define THROTTLE_CRUISE 450 //
#endif #endif
#ifndef ALT_HOLD_P #ifndef ALT_HOLD_P

View File

@ -5,7 +5,7 @@
//**************************************************************** //****************************************************************
static byte navigate() static byte navigate()
{ {
// waypoint distance from plane in meters // waypoint distance from plane in cm
// --------------------------------------- // ---------------------------------------
wp_distance = get_distance(&current_loc, &next_WP); wp_distance = get_distance(&current_loc, &next_WP);
home_distance = get_distance(&current_loc, &home); home_distance = get_distance(&current_loc, &home);
@ -32,7 +32,7 @@ static bool check_missed_wp()
int32_t temp; int32_t temp;
temp = target_bearing - original_target_bearing; temp = target_bearing - original_target_bearing;
temp = wrap_180(temp); temp = wrap_180(temp);
return (abs(temp) > 10000); //we pased the waypoint by 10 ° return (abs(temp) > 10000); // we passed the waypoint by 100 degrees
} }
// ------------------------------ // ------------------------------
@ -529,7 +529,7 @@ static int32_t wrap_180(int32_t error)
} }
*/ */
// distance is returned in meters // distance is returned in cm
static int32_t get_distance(struct Location *loc1, struct Location *loc2) static int32_t get_distance(struct Location *loc1, struct Location *loc2)
{ {
float dlat = (float)(loc2->lat - loc1->lat); float dlat = (float)(loc2->lat - loc1->lat);

View File

@ -120,6 +120,7 @@ AC_PID::load_gains()
_ki.load(); _ki.load();
_kd.load(); _kd.load();
_imax.load(); _imax.load();
_imax = abs(_imax);
} }
void void

View File

@ -33,7 +33,7 @@ public:
_kp (initial_p), _kp (initial_p),
_ki (initial_i), _ki (initial_i),
_kd (initial_d), _kd (initial_d),
_imax(initial_imax) _imax(abs(initial_imax))
{ {
// no need for explicit load, assuming that the main code uses AP_Param::load_all. // no need for explicit load, assuming that the main code uses AP_Param::load_all.
} }
@ -78,7 +78,7 @@ public:
const float i, const float i,
const float d, const float d,
const int16_t imaxval) { const int16_t imaxval) {
_kp = p; _ki = i; _kd = d; _imax = imaxval; _kp = p; _ki = i; _kd = d; _imax = abs(imaxval);
} }
float kP() const { return _kp.get(); } float kP() const { return _kp.get(); }