From 07d80ce8f9965fb8efa653fde2a564da3f9e5e64 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Sun, 15 Apr 2012 20:33:49 -0700 Subject: [PATCH 1/7] Test commit --- Tools/GIT_Test/GIT_Success.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tools/GIT_Test/GIT_Success.txt b/Tools/GIT_Test/GIT_Success.txt index 4bb1685ce8..e379c6684e 100644 --- a/Tools/GIT_Test/GIT_Success.txt +++ b/Tools/GIT_Test/GIT_Success.txt @@ -5,3 +5,5 @@ list below ---------------- Test Developer ... + +Chris Anderson From 5160e2ea34e3cd900c5a1da033523ecb54bfd182 Mon Sep 17 00:00:00 2001 From: Phil Cole Date: Sun, 15 Apr 2012 21:12:59 -0700 Subject: [PATCH 2/7] test file commit --- Tools/GIT_Test/GIT_Success.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/GIT_Test/GIT_Success.txt b/Tools/GIT_Test/GIT_Success.txt index e379c6684e..2303d386b3 100644 --- a/Tools/GIT_Test/GIT_Success.txt +++ b/Tools/GIT_Test/GIT_Success.txt @@ -7,3 +7,4 @@ list below Test Developer ... Chris Anderson +Phil Cole was here. From 9e36b9b6724be04a3b296d330d87b22ad8b286ca Mon Sep 17 00:00:00 2001 From: Phil Cole Date: Sun, 15 Apr 2012 22:20:38 -0700 Subject: [PATCH 3/7] Git tool test Rebased old branch (demo-branch) onto master in the clone to get the file to appear and then added the text. --- Tools/GIT_Test/GIT_Success.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/GIT_Test/GIT_Success.txt b/Tools/GIT_Test/GIT_Success.txt index 2303d386b3..a4d60e15ae 100644 --- a/Tools/GIT_Test/GIT_Success.txt +++ b/Tools/GIT_Test/GIT_Success.txt @@ -7,4 +7,4 @@ list below Test Developer ... Chris Anderson -Phil Cole was here. +Phil Cole put this here after rebasing an old branch to master. From 8e90aeea4efb3067ebf31b62e4c3bca71f526d1b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2012 20:51:46 +1000 Subject: [PATCH 4/7] AHRS: added AHRS_YAW_P parameter this allows users to change the yaw gain in DCM --- libraries/AP_AHRS/AP_AHRS.h | 2 ++ libraries/AP_AHRS/AP_AHRS_DCM.cpp | 8 +++++++- libraries/AP_AHRS/AP_AHRS_DCM.h | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libraries/AP_AHRS/AP_AHRS.h b/libraries/AP_AHRS/AP_AHRS.h index 883c158a53..10e2b90381 100644 --- a/libraries/AP_AHRS/AP_AHRS.h +++ b/libraries/AP_AHRS/AP_AHRS.h @@ -82,6 +82,8 @@ public: // attitude virtual Matrix3f get_dcm_matrix(void) = 0; + static const struct AP_Param::GroupInfo var_info[]; + protected: // pointer to compass object, if enabled Compass * _compass; diff --git a/libraries/AP_AHRS/AP_AHRS_DCM.cpp b/libraries/AP_AHRS/AP_AHRS_DCM.cpp index b6fa2e1f45..2cf29b3249 100644 --- a/libraries/AP_AHRS/AP_AHRS_DCM.cpp +++ b/libraries/AP_AHRS/AP_AHRS_DCM.cpp @@ -23,6 +23,12 @@ // from the GPS and wait for the ground speed to get above GPS_SPEED_MIN #define GPS_SPEED_RESET 100 +// table of user settable parameters +const AP_Param::GroupInfo AP_AHRS::var_info[] PROGMEM = { + AP_GROUPINFO("YAW_P", 0, AP_AHRS_DCM, _kp_yaw), + AP_GROUPEND +}; + // run a full DCM update round void AP_AHRS_DCM::update(void) @@ -453,7 +459,7 @@ AP_AHRS_DCM::drift_correction(float deltat) // allow the yaw reference source to affect all 3 components // of _omega_yaw_P as we need to be able to correctly hold a // heading when roll and pitch are non-zero - _omega_yaw_P = error * _kp_yaw; + _omega_yaw_P = error * _kp_yaw.get(); // add yaw correction to integrator correction vector, but // only for the z gyro. We rely on the accelerometers for x diff --git a/libraries/AP_AHRS/AP_AHRS_DCM.h b/libraries/AP_AHRS/AP_AHRS_DCM.h index 5952380c7e..600592d8e5 100644 --- a/libraries/AP_AHRS/AP_AHRS_DCM.h +++ b/libraries/AP_AHRS/AP_AHRS_DCM.h @@ -17,7 +17,7 @@ public: AP_AHRS_DCM(IMU *imu, GPS *&gps) : AP_AHRS(imu, gps) { _kp_roll_pitch = 0.13; - _kp_yaw = 0.4; + _kp_yaw.set(0.4); _dcm_matrix(Vector3f(1, 0, 0), Vector3f(0, 1, 0), Vector3f(0, 0, 1)); @@ -42,10 +42,12 @@ public: float get_error_rp(void); float get_error_yaw(void); + // settable parameters + AP_Float _kp_yaw; + private: float _kp_roll_pitch; float _ki_roll_pitch; - float _kp_yaw; float _ki_yaw; bool _have_initial_yaw; From d07b77237e42fab9333a50f1fd250d056117a824 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2012 20:52:02 +1000 Subject: [PATCH 5/7] AHRS: enable AHRS_ group in ArduPlane --- ArduPlane/Parameters.h | 1 + ArduPlane/Parameters.pde | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ArduPlane/Parameters.h b/ArduPlane/Parameters.h index 5519f0cd22..6125550fe0 100644 --- a/ArduPlane/Parameters.h +++ b/ArduPlane/Parameters.h @@ -84,6 +84,7 @@ public: k_param_airspeed_offset, k_param_sonar_enabled, k_param_airspeed_enabled, + k_param_ahrs, // AHRS group // // 150: Navigation parameters diff --git a/ArduPlane/Parameters.pde b/ArduPlane/Parameters.pde index 3619095c05..0603b47f6c 100644 --- a/ArduPlane/Parameters.pde +++ b/ArduPlane/Parameters.pde @@ -125,7 +125,8 @@ static const AP_Param::Info var_info[] PROGMEM = { GOBJECT(compass, "COMPASS_", Compass), GOBJECT(gcs0, "SR0_", GCS_MAVLINK), GOBJECT(gcs3, "SR3_", GCS_MAVLINK), - GOBJECT(imu, "IMU_", IMU) + GOBJECT(imu, "IMU_", IMU), + GOBJECT(ahrs, "AHRS_", AP_AHRS) }; From 95cb35c7bb19bbbb862b64b1153c6d2a5ba09089 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2012 20:55:03 +1000 Subject: [PATCH 6/7] AHRS: enable AHRS_ group in ArduCopter --- ArduCopter/Parameters.h | 1 + ArduCopter/Parameters.pde | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h index 40e653835d..47f82568cb 100644 --- a/ArduCopter/Parameters.h +++ b/ArduCopter/Parameters.h @@ -102,6 +102,7 @@ public: k_param_rtl_land_enabled, k_param_axis_enabled, k_param_copter_leds_mode, //158 + k_param_ahrs, // AHRS group // // 160: Navigation parameters diff --git a/ArduCopter/Parameters.pde b/ArduCopter/Parameters.pde index ba9e31207c..aba0a9be34 100644 --- a/ArduCopter/Parameters.pde +++ b/ArduCopter/Parameters.pde @@ -135,12 +135,13 @@ static const AP_Param::Info var_info[] PROGMEM = { GOBJECT(compass, "COMPASS_", Compass), GOBJECT(gcs0, "SR0_", GCS_MAVLINK), GOBJECT(gcs3, "SR3_", GCS_MAVLINK), - GOBJECT(imu, "IMU_", IMU) + GOBJECT(imu, "IMU_", IMU), + GOBJECT(ahrs, "AHRS_", AP_AHRS), #if FRAME_CONFIG == HELI_FRAME - ,GOBJECT(motors, "H_", AP_MotorsHeli) + GOBJECT(motors, "H_", AP_MotorsHeli), #else - ,GOBJECT(motors, "MOT_", AP_Motors) + GOBJECT(motors, "MOT_", AP_Motors), #endif }; From 870b5e5f75b09e0719da24c7fef29656c3920c51 Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Mon, 16 Apr 2012 23:47:57 +0900 Subject: [PATCH 7/7] ArduCopter - CH6 Tuning - added AHRS_YAW_KP parameter as 30. Now you can easily set the amount that the mag is used to correct the gyro based yaw estimate in the DCM --- ArduCopter/ArduCopter.pde | 4 ++++ ArduCopter/defines.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index e477fdedef..e29e588fa4 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -2166,6 +2166,10 @@ static void tuning(){ g.pid_optflow_roll.kD(tuning_value); g.pid_optflow_pitch.kD(tuning_value); break; + + case CH6_AHRS_YAW_KP: + ahrs._kp_yaw.set(tuning_value); + break; } } diff --git a/ArduCopter/defines.h b/ArduCopter/defines.h index 12a722bc97..693f429870 100644 --- a/ArduCopter/defines.h +++ b/ArduCopter/defines.h @@ -184,6 +184,8 @@ #define CH6_LOITER_RATE_KI 28 #define CH6_LOITER_RATE_KD 23 +#define CH6_AHRS_YAW_KP 30 + // nav byte mask // -------------