From 20ab9471fbca3151ef356f2b5b9a73d91175916e Mon Sep 17 00:00:00 2001 From: julian_lilov Date: Mon, 14 Dec 2020 11:36:54 +0200 Subject: [PATCH 1/3] LP_620 --- flight/libraries/plans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/libraries/plans.c b/flight/libraries/plans.c index f2c9d23b7..3e481af6d 100644 --- a/flight/libraries/plans.c +++ b/flight/libraries/plans.c @@ -495,7 +495,7 @@ void plan_run_VelocityRoam() cmd.Pitch = applyExpo(cmd.Pitch, stabSettings.StickExpo.Pitch); cmd.Yaw = applyExpo(cmd.Yaw, stabSettings.StickExpo.Yaw); - bool flagRollPitchHasInput = (fabsf(cmd.Roll) > 0.0f || fabsf(cmd.Pitch) > 0.0f); + bool flagRollPitchHasInput = (fabsf(cmd.Roll) > 0.05f || fabsf(cmd.Pitch) > 0.05f); if (!flagRollPitchHasInput) { // no movement desired, re-enter positionHold at current start-position From 6915a2c1882f9b04167d10bc18d268c5b939352b Mon Sep 17 00:00:00 2001 From: julian_lilov Date: Thu, 7 Jan 2021 16:14:35 +0200 Subject: [PATCH 2/3] Revert "LP_620" This reverts commit 20ab9471fbca3151ef356f2b5b9a73d91175916e. There is a cleaner way to apply a deadband for VR (the already existing "Assisted Control stick deadband") --- flight/libraries/plans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/libraries/plans.c b/flight/libraries/plans.c index 3e481af6d..f2c9d23b7 100644 --- a/flight/libraries/plans.c +++ b/flight/libraries/plans.c @@ -495,7 +495,7 @@ void plan_run_VelocityRoam() cmd.Pitch = applyExpo(cmd.Pitch, stabSettings.StickExpo.Pitch); cmd.Yaw = applyExpo(cmd.Yaw, stabSettings.StickExpo.Yaw); - bool flagRollPitchHasInput = (fabsf(cmd.Roll) > 0.05f || fabsf(cmd.Pitch) > 0.05f); + bool flagRollPitchHasInput = (fabsf(cmd.Roll) > 0.0f || fabsf(cmd.Pitch) > 0.0f); if (!flagRollPitchHasInput) { // no movement desired, re-enter positionHold at current start-position From 3c2cc704a5597aea19a44c38f2aea7a2d5fa6d63 Mon Sep 17 00:00:00 2001 From: julian_lilov Date: Thu, 7 Jan 2021 17:10:34 +0200 Subject: [PATCH 3/3] LP_620 Always recognize VelocityRoam as "assisted" --- flight/modules/Receiver/receiver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/flight/modules/Receiver/receiver.c b/flight/modules/Receiver/receiver.c index 8b5643c5b..903ec2e6d 100644 --- a/flight/modules/Receiver/receiver.c +++ b/flight/modules/Receiver/receiver.c @@ -914,6 +914,23 @@ static void applyLPF(float *value, ManualControlSettingsResponseTimeElem channel #ifndef PIOS_EXCLUDE_ADVANCED_FEATURES static uint8_t isAssistedFlightMode(uint8_t position) { + // Since VelocityRoam is by all means an "assisted" mode, + // here we do explicitly recognize it as "assisted", no matter + // if it has "GPSAssist" set in FlightModeAssistMap or not, thus + // always applying the "Assisted Control stick deadband" when + // VelocityRoam is active. + FlightModeSettingsData modeSettings; + FlightModeSettingsGet(&modeSettings); + + uint8_t thisMode = FLIGHTSTATUS_FLIGHTMODE_MANUAL; + if (position < FLIGHTMODESETTINGS_FLIGHTMODEPOSITION_NUMELEM) { + thisMode = modeSettings.FlightModePosition[position]; + } + + if (thisMode == FLIGHTSTATUS_FLIGHTMODE_VELOCITYROAM) { + return STABILIZATIONSETTINGS_FLIGHTMODEASSISTMAP_GPSASSIST; + } + uint8_t isAssistedFlag = STABILIZATIONSETTINGS_FLIGHTMODEASSISTMAP_NONE; uint8_t FlightModeAssistMap[STABILIZATIONSETTINGS_FLIGHTMODEASSISTMAP_NUMELEM];