mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
OP-1769 Ground support: Align wizard to flight side code implementation
This commit is contained in:
parent
dd2733d73f
commit
1d7059d4d7
@ -116,7 +116,6 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true);
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true);
|
||||
|
||||
// Default Curve2 range -1 -> +1, allow forward/reverse (Car and Tank)
|
||||
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
|
||||
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH);
|
||||
|
||||
@ -154,13 +153,11 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
initMixerCurves(frameType);
|
||||
|
||||
// If new setup, set sliders to defaults and set curves values
|
||||
// Allow forward/reverse 0.8 / -0.8 for Throttle, keep some room
|
||||
// to allow rotate at full throttle and heading stabilization
|
||||
if (frameTypeSaved->getValue().toString() != "GroundVehicleDifferential") {
|
||||
m_aircraft->differentialSteeringSlider1->setValue(100);
|
||||
m_aircraft->differentialSteeringSlider2->setValue(100);
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 0.8, -0.8);
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0, 0.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, 0.0);
|
||||
}
|
||||
} else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
|
||||
// Motorcycle
|
||||
@ -184,7 +181,6 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setTitle("");
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setEnabled(false);
|
||||
|
||||
// Curve range 0 -> +1 (no reverse)
|
||||
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
|
||||
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
|
||||
|
||||
@ -192,8 +188,8 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
|
||||
// If new setup, set curves values
|
||||
if (frameTypeSaved->getValue().toString() != "GroundVehicleMotorCycle") {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0);
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, 0.0);
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0, 0.0);
|
||||
}
|
||||
} else {
|
||||
// Car
|
||||
@ -213,9 +209,9 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
m_aircraft->gvSteering2Label->setText("Rear steering");
|
||||
|
||||
// Curve2 for Car
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve");
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setTitle("");
|
||||
m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true);
|
||||
m_aircraft->gvThrottleCurve1GroupBox->setTitle("");
|
||||
m_aircraft->gvThrottleCurve1GroupBox->setTitle("Throttle curve");
|
||||
m_aircraft->gvThrottleCurve1GroupBox->setEnabled(false);
|
||||
|
||||
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH);
|
||||
@ -225,11 +221,10 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
|
||||
// If new setup, set curves values
|
||||
if (frameTypeSaved->getValue().toString() != "GroundVehicleCar") {
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0);
|
||||
// Set curve2 range from -0.926 to 1 (forward / reverse)
|
||||
// Take in account 4% offset in Throttle input after calibration
|
||||
// 0.5 / 0.54 = 0.926
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, -0.926);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,7 +320,7 @@ void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
|
||||
m_aircraft->groundVehicleThrottle1->initCurve(&curveValues);
|
||||
} else {
|
||||
// no, init a straight curve
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 1.0);
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
}
|
||||
|
||||
// Setup all Throttle2 curves for all types of airframes
|
||||
@ -336,11 +331,11 @@ void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
|
||||
} else {
|
||||
// no, init a straight curve
|
||||
if (frameType == "GroundVehicleDifferential") {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 0.8, -0.8);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
} else if (frameType == "GroundVehicleCar") {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0, -1.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
} else {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -513,11 +508,11 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
// Output success message
|
||||
m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
|
Loading…
Reference in New Issue
Block a user