From 16412abbde1ec28dc4e15dcbfe581af295e3331a Mon Sep 17 00:00:00 2001 From: jasonshort Date: Fri, 22 Apr 2011 21:15:17 +0000 Subject: [PATCH] added a bit of kI term for Yaw hold. git-svn-id: https://arducopter.googlecode.com/svn/trunk@1918 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- ArduCopterMega/Attitude.pde | 4 +++- ArduCopterMega/Log.pde | 10 ++++++---- ArduCopterMega/config.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ArduCopterMega/Attitude.pde b/ArduCopterMega/Attitude.pde index 4fbf9421ac..1afc46ef18 100644 --- a/ArduCopterMega/Attitude.pde +++ b/ArduCopterMega/Attitude.pde @@ -276,7 +276,9 @@ void output_manual_yaw() clear_yaw_control(); did_clear_yaw_control = true; } - }else{ + + }else{ // motors running + // Yaw control if(g.rc_4.control_in == 0){ output_yaw_with_hold(true); // hold yaw diff --git a/ArduCopterMega/Log.pde b/ArduCopterMega/Log.pde index 3b83f71050..02d297dcf7 100644 --- a/ArduCopterMega/Log.pde +++ b/ArduCopterMega/Log.pde @@ -20,9 +20,6 @@ static int8_t select_logs(uint8_t argc, const Menu::arg *argv); // printf_P is a version of print_f that reads from flash memory static int8_t help_log(uint8_t argc, const Menu::arg *argv) { - // log hack - //Serial.begin(115200, 128, 128); - Serial.printf_P(PSTR("\n" "Commands:\n" " dump " @@ -527,7 +524,10 @@ void Log_Write_Control_Tuning() DataFlash.WriteInt((int)(g.rc_3.servo_out)); DataFlash.WriteInt((int)(g.rc_4.control_in)); DataFlash.WriteInt((int)(g.rc_4.servo_out)); + + // yaw DataFlash.WriteInt((int)yaw_error); + DataFlash.WriteInt((int)(dcm.yaw_sensor/100)); // Yaw mode DataFlash.WriteByte(yaw_debug); @@ -553,13 +553,15 @@ void Log_Write_Control_Tuning() // Read an control tuning packet void Log_Read_Control_Tuning() { - Serial.printf_P(PSTR("CTUN, %d, %d, %d, %d, %d, %d, %1.4f, %1.4f, %1.4f, %d, %d, %d\n"), + Serial.printf_P(PSTR("CTUN, %d, %d, %d, %d, %d, %d, %d, %1.4f, %1.4f, %1.4f, %d, %d, %d\n"), // Control DataFlash.ReadInt(), DataFlash.ReadInt(), DataFlash.ReadInt(), DataFlash.ReadInt(), + // yaw + DataFlash.ReadInt(), DataFlash.ReadInt(), // Yaw Mode diff --git a/ArduCopterMega/config.h b/ArduCopterMega/config.h index d6919fb7f0..553ac5b628 100644 --- a/ArduCopterMega/config.h +++ b/ArduCopterMega/config.h @@ -346,7 +346,7 @@ # define YAW_P 0.4 // increase for more aggressive Yaw Hold, decrease if it's bouncy #endif #ifndef YAW_I -# define YAW_I 0.0 // Always 0 +# define YAW_I 0.1 // increased to .1 to try and get over user's steady state error caused by poor balance #endif #ifndef YAW_D # define YAW_D 0.13 // Trying a lower value to prevent odd behavior