Browse Source

Removed some old debug prints from motors.pde

added ability to not increment I term for traversals.
mission-4.1.18
Jason Short 13 years ago
parent
commit
6bf0c32173
  1. 3
      ArduCopter/Attitude.pde
  2. 8
      ArduCopter/motors.pde
  3. 5
      libraries/APM_PI/APM_PI.cpp
  4. 3
      libraries/APM_PI/APM_PI.h

3
ArduCopter/Attitude.pde

@ -91,9 +91,10 @@ get_stabilize_yaw(long target_angle) @@ -91,9 +91,10 @@ get_stabilize_yaw(long target_angle)
static int
get_nav_throttle(long z_error)
{
bool calc_i = abs(z_error) < ALT_ERROR_MAX;
// limit error to prevent I term run up
z_error = constrain(z_error, -ALT_ERROR_MAX, ALT_ERROR_MAX);
int rate_error = g.pi_alt_hold.get_pi(z_error, .1); //_p = .85
int rate_error = g.pi_alt_hold.get_pi(z_error, .1, calc_i); //_p = .85
rate_error = rate_error - climb_rate;
// limit the rate

8
ArduCopter/motors.pde

@ -20,7 +20,7 @@ static void arm_motors() @@ -20,7 +20,7 @@ static void arm_motors()
// full right
if (g.rc_4.control_in > 4000) {
if (arming_counter == LEVEL_DELAY){
Serial.printf("\nAL\n");
//Serial.printf("\nAL\n");
// begin auto leveling
auto_level_counter = 200;
arming_counter = 0;
@ -39,7 +39,7 @@ static void arm_motors() @@ -39,7 +39,7 @@ static void arm_motors()
// full left
}else if (g.rc_4.control_in < -4000) {
if (arming_counter == LEVEL_DELAY){
Serial.printf("\nLEV\n");
//Serial.printf("\nLEV\n");
// begin manual leveling
imu.init_accel(mavlink_delay);
@ -65,7 +65,7 @@ static void arm_motors() @@ -65,7 +65,7 @@ static void arm_motors()
static void init_arm_motors()
{
Serial.printf("\nARM\n");
//Serial.printf("\nARM\n");
#if HIL_MODE != HIL_MODE_DISABLED
gcs_send_text_P(SEVERITY_HIGH, PSTR("ARMING MOTORS"));
#endif
@ -106,7 +106,7 @@ static void init_arm_motors() @@ -106,7 +106,7 @@ static void init_arm_motors()
static void init_disarm_motors()
{
Serial.printf("\nDISARM\n");
//Serial.printf("\nDISARM\n");
#if HIL_MODE != HIL_MODE_DISABLED
gcs_send_text_P(SEVERITY_HIGH, PSTR("DISARMING MOTORS"));
#endif

5
libraries/APM_PI/APM_PI.cpp

@ -8,9 +8,10 @@ @@ -8,9 +8,10 @@
#include "APM_PI.h"
long
APM_PI::get_pi(int32_t error, float dt)
APM_PI::get_pi(int32_t error, float dt, bool calc_i)
{
_integrator += ((float)error * _ki) * dt;
if(true)
_integrator += ((float)error * _ki) * dt;
if (_integrator < -_imax) {
_integrator = -_imax;

3
libraries/APM_PI/APM_PI.h

@ -77,7 +77,8 @@ public: @@ -77,7 +77,8 @@ public:
///
/// @returns The updated control output.
///
long get_pi(int32_t error, float dt);
//long get_pi(int32_t error, float dt);
long get_pi(int32_t error, float dt, bool calc_i=true);
/// Reset the PI integrator
///

Loading…
Cancel
Save