From 8defea867b010504d6d68d2d7b4674fb46412265 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Thu, 12 Mar 2015 08:46:43 +1100 Subject: [PATCH] OP-1769 ground support wizard alignment with flight side code 1. Moved to using throttle curve 1 which is meant to be primary for throttle. Curve1 can support reversible motor mixer so ok. 2. Changed default throttle1 curve to linear 0-1 representing x>0. For x < 0 the same throttle curve is applied symmetrically to the reverse direction. 3. Allowed in UI both throttle curves to be visible. Throttle curve 2 manually can be used to mix other inputs to affect motor. E.g. slow down in turning. --- .../configgroundvehiclewidget.cpp | 19 ++++++++---------- .../vehicleconfigurationhelper.cpp | 20 +++++++++---------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp index 9496e8679..371accb68 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp @@ -144,8 +144,8 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->differentialSteeringSlider1->setEnabled(true); m_aircraft->differentialSteeringSlider2->setEnabled(true); - m_aircraft->gvThrottleCurve1GroupBox->setTitle(""); - m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve"); + m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); + m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2 "); m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); @@ -176,10 +176,10 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvSteering2Label->setText("Balancing"); // Curve1 for Motorcyle - m_aircraft->gvThrottleCurve1GroupBox->setTitle("Rear throttle curve"); + m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); - m_aircraft->gvThrottleCurve2GroupBox->setTitle(""); - m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false); + m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); + m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); @@ -208,11 +208,10 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvSteering1Label->setText("Front steering"); m_aircraft->gvSteering2Label->setText("Rear steering"); - // Curve2 for Car - m_aircraft->gvThrottleCurve2GroupBox->setTitle(""); + m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); - m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve"); - m_aircraft->gvThrottleCurve1GroupBox->setEnabled(false); + m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); + m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); @@ -222,8 +221,6 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) // If new setup, set curves values if (frameTypeSaved->getValue().toString() != "GroundVehicleCar") { m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0, 0.0); - // Set curve2 range from 0 to 1. - // The curve is applied to both forward and reverse m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, 0.0); } } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index ec02a7d6c..9448af88a 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -779,17 +779,15 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch mSettings->setMixerValueRoll(100); mSettings->setMixerValuePitch(100); mSettings->setMixerValueYaw(100); - // Set curve2 range from -0.926 to 1 : take in account 4% offset in Throttle input - // 0.5 / 0.54 = 0.926 maxThrottle = 1; - minThrottle = -0.926; + minThrottle = 0; break; case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL: mSettings->setMixerValueRoll(100); mSettings->setMixerValuePitch(100); mSettings->setMixerValueYaw(100); maxThrottle = 0.8; - minThrottle = -0.8; + minThrottle = 0; break; default: break; @@ -2076,8 +2074,8 @@ void VehicleConfigurationHelper::setupCar() // Motor (Chan 2) channels[1].type = MIXER_TYPE_REVERSABLEMOTOR; - channels[1].throttle1 = 0; - channels[1].throttle2 = 100; + channels[1].throttle1 = 100; + channels[1].throttle2 = 0; channels[1].roll = 0; channels[1].pitch = 0; channels[1].yaw = 0; @@ -2101,16 +2099,16 @@ void VehicleConfigurationHelper::setupTank() // Left Motor (Chan 1) channels[0].type = MIXER_TYPE_REVERSABLEMOTOR; - channels[0].throttle1 = 0; - channels[0].throttle2 = 100; + channels[0].throttle1 = 100; + channels[0].throttle2 = 0; channels[0].roll = 0; channels[0].pitch = 0; channels[0].yaw = 100; // Right Motor (Chan 2) channels[1].type = MIXER_TYPE_REVERSABLEMOTOR; - channels[1].throttle1 = 0; - channels[1].throttle2 = 100; + channels[1].throttle1 = 100; + channels[1].throttle2 = 0; channels[1].roll = 0; channels[1].pitch = 0; channels[1].yaw = -100; @@ -2140,7 +2138,7 @@ void VehicleConfigurationHelper::setupMotorcycle() channels[0].pitch = 0; channels[0].yaw = 100; - // Motor (Chan 2) : Curve1, no reverse + // Motor (Chan 2) channels[1].type = MIXER_TYPE_MOTOR; channels[1].throttle1 = 100; channels[1].throttle2 = 0;