From c3522882f2239a92ab10b9ee771ecb3c0a2170fa Mon Sep 17 00:00:00 2001 From: BorisB Date: Fri, 1 May 2015 13:45:22 +0200 Subject: [PATCH] yaw_fix default values Pull request #802 has by default disabled yaw jump. That is fine on the most of the configurations, but one of my multirotors had an angled motor due to crash and this was causing weird behaviour. It is also possible to configure very low values, which can even cause a craft to not be able to stop after yaw and I am talking about the values below 100 like 1. Anyway this fix provides only valid configurable values what can't cause any danger. Also default parameter is not unlimited anymore and is configured to 200, which is a safe value to anybody who does the upgrade. cli.md is also edited --- docs/Cli.md | 3 ++- src/main/config/config.c | 2 +- src/main/flight/mixer.c | 2 +- src/main/io/serial_cli.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/Cli.md b/docs/Cli.md index 272ce58f5..61ee3c879 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -179,6 +179,7 @@ Re-apply any new defaults as desired. | throttle_correction_angle | The throttle_correction_value will be added to the throttle input. It will be maximal at the throttle_correction_angle and over, null when the copter is leveled and proportional in bewteen. The angle is set with 0.1 deg steps from 1 to 900, ie : 300 = 30.0 deg, 225 = 22.5 deg. | 1 | 900 | 800 | Profile | UINT16 | | yaw_control_direction | | -1 | 1 | 1 | Master | INT8 | | yaw_direction | | -1 | 1 | 1 | Profile | INT8 | +| yaw_jump_prevention_limit | Prevent yaw jumps during yaw stops. | 200 | 80 | 500 | Master | UINT16 | | tri_unarmed_servo | On tricopter mix only, if this is set to 1, servo will always be correcting regardless of armed state. to disable this, set it to 0. | 0 | 1 | 1 | Profile | INT8 | | default_rate_profile | Default = profile number | 0 | 2 | | Profile | UINT8 | | rc_rate | | 0 | 250 | 90 | Rate Profile | UINT8 | @@ -241,4 +242,4 @@ Re-apply any new defaults as desired. | i_vel | | 0 | 200 | 45 | Profile | UINT8 | | d_vel | | 0 | 200 | 1 | Profile | UINT8 | | blackbox_rate_num | | 1 | 32 | 1 | Master | UINT8 | -| blackbox_rate_denom | | 1 | 32 | 1 | Master | UINT8 | +| blackbox_rate_denom | diff --git a/src/main/config/config.c b/src/main/config/config.c index 28bc6a608..05e1c55ec 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -319,7 +319,7 @@ void resetRcControlsConfig(rcControlsConfig_t *rcControlsConfig) { void resetMixerConfig(mixerConfig_t *mixerConfig) { mixerConfig->pid_at_min_throttle = 1; mixerConfig->yaw_direction = 1; - mixerConfig->yaw_jump_prevention_limit = 0; + mixerConfig->yaw_jump_prevention_limit = 200; #ifdef USE_SERVOS mixerConfig->tri_unarmed_servo = 1; mixerConfig->servo_lowpass_freq = 400; diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index fe70eff86..1cad7de36 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -564,7 +564,7 @@ void mixTable(void) { uint32_t i; - if (motorCount >= 4 && mixerConfig->yaw_jump_prevention_limit) { + if (motorCount >= 4) { // prevent "yaw jump" during yaw correction axisPID[YAW] = constrain(axisPID[YAW], -mixerConfig->yaw_jump_prevention_limit - ABS(rcCommand[YAW]), mixerConfig->yaw_jump_prevention_limit + ABS(rcCommand[YAW])); } diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 9d22ccc7a..28f23f34a 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -387,7 +387,7 @@ const clivalue_t valueTable[] = { { "pid_at_min_throttle", VAR_UINT8 | MASTER_VALUE, &masterConfig.mixerConfig.pid_at_min_throttle, 0, 1 }, { "yaw_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_direction, -1, 1 }, - { "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, 0, 500 }, + { "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, 80, 500 }, #ifdef USE_SERVOS { "tri_unarmed_servo", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.tri_unarmed_servo, 0, 1 }, { "servo_lowpass_freq", VAR_INT16 | MASTER_VALUE, &masterConfig.mixerConfig.servo_lowpass_freq, 10, 400},