From c3522882f2239a92ab10b9ee771ecb3c0a2170fa Mon Sep 17 00:00:00 2001 From: BorisB Date: Fri, 1 May 2015 13:45:22 +0200 Subject: [PATCH 1/4] 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 272ce58f5a..61ee3c879a 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 28bc6a6082..05e1c55ec2 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 fe70eff86d..1cad7de364 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 9d22ccc7af..28f23f34a2 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}, From ea7157dadda8a89a72f571b96049ecefba1fdaf6 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 1 May 2015 14:24:25 +0200 Subject: [PATCH 2/4] Update Cli.md Corrections to accidantally deleted blackbox_rate_denom values --- docs/Cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Cli.md b/docs/Cli.md index 61ee3c879a..8db32aff2c 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -242,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 | +| blackbox_rate_denom | | 1 | 32 | 1 | Master | UINT8 | From 16faced65ae786688b425c8635f01f8af79e7643 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 1 May 2015 17:23:29 +0200 Subject: [PATCH 3/4] Update mixer.c Make it possible to still be able to disable the jump protection at all by configuring the highest configurable value. --- src/main/flight/mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/flight/mixer.c b/src/main/flight/mixer.c index 1cad7de364..55ae12cab1 100755 --- a/src/main/flight/mixer.c +++ b/src/main/flight/mixer.c @@ -564,8 +564,8 @@ void mixTable(void) { uint32_t i; - if (motorCount >= 4) { - // prevent "yaw jump" during yaw correction + if (motorCount >= 4 && mixerConfig->yaw_jump_prevention_limit < 500) { + // prevent "yaw jump" during yaw correction (500 is disabled jump protection) axisPID[YAW] = constrain(axisPID[YAW], -mixerConfig->yaw_jump_prevention_limit - ABS(rcCommand[YAW]), mixerConfig->yaw_jump_prevention_limit + ABS(rcCommand[YAW])); } From 1dde2f4c2c0ba9f25a2043fe123938a0809aef02 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Sat, 2 May 2015 00:35:29 +0200 Subject: [PATCH 4/4] Update Cli.md --- docs/Cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Cli.md b/docs/Cli.md index 8db32aff2c..d026c550aa 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -179,7 +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 | +| yaw_jump_prevention_limit | Prevent yaw jumps during yaw stops. To disable set to 500. | 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 |