From 5066ac42e2eb0ed85457433dbf3ab82cbebae7d6 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Tue, 20 Dec 2016 11:43:23 +0100 Subject: [PATCH] LP-454 Fix comments and Throttle curve values --- .../configgroundvehiclewidget.cpp | 29 ++++++++++--------- .../vehicleconfigurationhelper.cpp | 10 ++----- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp index 7d2fb783e..2ab90f4d4 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configgroundvehiclewidget.cpp @@ -122,7 +122,7 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); - m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); + m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); initMixerCurves(frameType); @@ -143,12 +143,12 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvSteering1Label->setText("First rudder"); m_aircraft->gvSteering2Label->setText("Second rudder"); - m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); - m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); + m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); + m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false); - m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); + m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); initMixerCurves(frameType); @@ -181,7 +181,6 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvMotor1ChannelBox->setEnabled(true); m_aircraft->gvMotor2ChannelBox->setEnabled(true); - m_aircraft->gvThrottleCurve1GroupBox->setEnabled(false); m_aircraft->gvMotor1Label->setText("Left motor"); m_aircraft->gvMotor2Label->setText("Right motor"); @@ -193,9 +192,11 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->differentialSteeringSlider2->setEnabled(true); m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); + m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2 "); + m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false); - m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); + m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); initMixerCurves(frameType); @@ -205,8 +206,8 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) (is_Boat && (frameTypeSaved->getValue().toString() != "GroundVehicleDifferentialBoat"))) { m_aircraft->differentialSteeringSlider1->setValue(100); m_aircraft->differentialSteeringSlider2->setValue(100); - m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0, 0.0); - m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, 0.0); + m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 0.8, 0.0); + m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 0.8, 0.0); } } else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") { // Motorcycle @@ -228,7 +229,7 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); - m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); + m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false); m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); @@ -257,12 +258,12 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType) m_aircraft->gvSteering1Label->setText("Front steering"); m_aircraft->gvSteering2Label->setText("Rear steering"); - m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); - m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true); m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve1"); m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true); + m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve2"); + m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false); - m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH); + m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); initMixerCurves(frameType); @@ -510,13 +511,13 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT // left motor int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yawmotor1); // right motor channel = m_aircraft->gvMotor2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yawmotor2); // Output success message diff --git a/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index f013ad2b9..dd266f6e3 100644 --- a/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/gcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -944,7 +944,6 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch mSettings->setMixerValueRoll((qint8)100); mSettings->setMixerValuePitch((qint8)100); mSettings->setMixerValueYaw((qint8)100); - maxThrottle = 1; break; case VehicleConfigurationSource::VEHICLE_HELI: break; @@ -955,14 +954,11 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch mSettings->setMixerValueRoll((qint8)100); mSettings->setMixerValuePitch((qint8)100); mSettings->setMixerValueYaw((qint8)100); - maxThrottle = 1; break; case VehicleConfigurationSource::GROUNDVEHICLE_CAR: mSettings->setMixerValueRoll((qint8)100); mSettings->setMixerValuePitch((qint8)100); mSettings->setMixerValueYaw((qint8)100); - maxThrottle = 1; - minThrottle = 0; break; case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL: mSettings->setMixerValueRoll((qint8)100); @@ -975,8 +971,6 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch mSettings->setMixerValueRoll((qint8)100); mSettings->setMixerValuePitch((qint8)100); mSettings->setMixerValueYaw((qint8)100); - maxThrottle = 1; - minThrottle = 0; break; case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL_BOAT: mSettings->setMixerValueRoll((qint8)100); @@ -995,7 +989,7 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch break; } - // Apply Throttle curve max 90% for Multis, 100% for FixedWing/car/Motorbike, 80% for Tank + // Apply Throttle curve 0-100% for all vehicles except differential vehicles at 0-80% QString throttlePattern = "ThrottleCurve%1"; for (int i = 1; i <= 2; i++) { UAVObjectField *field = mSettings->getField(throttlePattern.arg(i)); @@ -1216,7 +1210,7 @@ void VehicleConfigurationHelper::resetVehicleConfig() for (int i = 1; i <= 2; i++) { UAVObjectField *field = mSettings->getField(throttlePattern.arg(i)); Q_ASSERT(field); - // Set default curve at 90% max for Multirotors + // Set default 0 -100% Throttle curve for (quint32 i = 0; i < field->getNumElements(); i++) { field->setValue(i * (1.0f / (field->getNumElements() - 1)), i); }