mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
LP-454 Add boat and differential boat to the ground tab
This commit is contained in:
parent
479282137e
commit
1bff0f479c
@ -364,6 +364,8 @@ FrameType_t GetCurrentFrameType()
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_GROUNDVEHICLECAR:
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_GROUNDVEHICLEBOAT:
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIALBOAT:
|
||||
return FRAME_TYPE_GROUND;
|
||||
|
||||
case SYSTEMSETTINGS_AIRFRAMETYPE_VTOL:
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configgroundvehiclemwidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @file configgroundvehiclewidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -81,7 +81,7 @@ ConfigGroundVehicleWidget::ConfigGroundVehicleWidget(QWidget *parent) :
|
||||
populateChannelComboBoxes();
|
||||
|
||||
QStringList groundVehicleTypes;
|
||||
groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle";
|
||||
groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle" << "Boat" << "Differential (boat)";
|
||||
m_aircraft->groundVehicleType->addItems(groundVehicleTypes);
|
||||
|
||||
m_aircraft->groundShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
@ -126,12 +126,58 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
|
||||
initMixerCurves(frameType);
|
||||
|
||||
if (frameType == "GroundVehicleBoat" || frameType == "Boat") {
|
||||
// Boat
|
||||
m_vehicleImg->setElementId("boat");
|
||||
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Boat"));
|
||||
|
||||
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
||||
m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
||||
|
||||
m_aircraft->gvMotor1Label->setText("First motor");
|
||||
m_aircraft->gvMotor2Label->setText("Second motor");
|
||||
|
||||
m_aircraft->gvSteering1ChannelBox->setEnabled(true);
|
||||
m_aircraft->gvSteering2ChannelBox->setEnabled(true);
|
||||
|
||||
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->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH);
|
||||
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
|
||||
|
||||
initMixerCurves(frameType);
|
||||
|
||||
// If new setup, set curves values
|
||||
if (frameTypeSaved->getValue().toString() != "GroundVehicleBoat") {
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0, 0.0);
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0, 0.0);
|
||||
}
|
||||
} else if ((frameType == "GroundVehicleDifferential") || (frameType == "Differential (tank)") ||
|
||||
(frameType == "GroundVehicleDifferentialBoat") || (frameType == "Differential (boat)")) {
|
||||
bool is_Boat = frameType.contains("oat");
|
||||
|
||||
if (is_Boat) {
|
||||
// Boat differential
|
||||
m_vehicleImg->setElementId("boat_diff");
|
||||
setComboCurrentIndex(m_aircraft->groundVehicleType,
|
||||
m_aircraft->groundVehicleType->findText("Differential (boat)"));
|
||||
m_aircraft->gvSteering1Label->setText("First rudder");
|
||||
m_aircraft->gvSteering2Label->setText("Second rudder");
|
||||
} else {
|
||||
// Tank
|
||||
m_vehicleImg->setElementId("tank");
|
||||
setComboCurrentIndex(m_aircraft->groundVehicleType,
|
||||
m_aircraft->groundVehicleType->findText("Differential (tank)"));
|
||||
m_aircraft->gvSteering1Label->setText("Front steering");
|
||||
m_aircraft->gvSteering2Label->setText("Rear steering");
|
||||
}
|
||||
|
||||
if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)") {
|
||||
// Tank
|
||||
m_vehicleImg->setElementId("tank");
|
||||
setComboCurrentIndex(m_aircraft->groundVehicleType,
|
||||
m_aircraft->groundVehicleType->findText("Differential (tank)"));
|
||||
m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
||||
m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
||||
|
||||
@ -143,9 +189,6 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
m_aircraft->gvSteering1ChannelBox->setEnabled(false);
|
||||
m_aircraft->gvSteering2ChannelBox->setEnabled(false);
|
||||
|
||||
m_aircraft->gvSteering1Label->setText("Front steering");
|
||||
m_aircraft->gvSteering2Label->setText("Rear steering");
|
||||
|
||||
m_aircraft->differentialSteeringSlider1->setEnabled(true);
|
||||
m_aircraft->differentialSteeringSlider2->setEnabled(true);
|
||||
|
||||
@ -158,7 +201,8 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
|
||||
initMixerCurves(frameType);
|
||||
|
||||
// If new setup, set sliders to defaults and set curves values
|
||||
if (frameTypeSaved->getValue().toString() != "GroundVehicleDifferential") {
|
||||
if ((!is_Boat && (frameTypeSaved->getValue().toString() != "GroundVehicleDifferential")) ||
|
||||
(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);
|
||||
@ -288,7 +332,7 @@ void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->gvSteering1ChannelBox, config.ground.GroundVehicleSteering1);
|
||||
setComboCurrentIndex(m_aircraft->gvSteering2ChannelBox, config.ground.GroundVehicleSteering2);
|
||||
|
||||
if (frameType == "GroundVehicleDifferential") {
|
||||
if (frameType.contains("GroundVehicleDifferential")) {
|
||||
// Find the channel number for Motor1
|
||||
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
@ -322,7 +366,7 @@ void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
|
||||
m_aircraft->groundVehicleThrottle1->initCurve(&curveValues);
|
||||
} else {
|
||||
// no, init a straight curve
|
||||
if (frameType == "GroundVehicleDifferential") {
|
||||
if (frameType.contains("GroundVehicleDifferential")) {
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 0.8, 0.0);
|
||||
} else if (frameType == "GroundVehicleCar") {
|
||||
m_aircraft->groundVehicleThrottle1->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
@ -338,7 +382,7 @@ void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
|
||||
m_aircraft->groundVehicleThrottle2->initCurve(&curveValues);
|
||||
} else {
|
||||
// no, init a straight curve
|
||||
if (frameType == "GroundVehicleDifferential") {
|
||||
if (frameType.contains("GroundVehicleDifferential")) {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 0.8, 0.0);
|
||||
} else if (frameType == "GroundVehicleCar") {
|
||||
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0, 0.0);
|
||||
@ -363,7 +407,13 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
|
||||
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->groundVehicleThrottle2->getCurve());
|
||||
|
||||
// All airframe types must start with "GroundVehicle"
|
||||
if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)") {
|
||||
if (m_aircraft->groundVehicleType->currentText() == "Differential (boat)") {
|
||||
airframeType = "GroundVehicleDifferentialBoat";
|
||||
setupGroundVehicleDifferential(airframeType);
|
||||
} else if (m_aircraft->groundVehicleType->currentText() == "Boat") {
|
||||
airframeType = "GroundVehicleBoat";
|
||||
setupGroundVehicleCar(airframeType);
|
||||
} else if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)") {
|
||||
airframeType = "GroundVehicleCar";
|
||||
setupGroundVehicleCar(airframeType);
|
||||
} else if (m_aircraft->groundVehicleType->currentText() == "Differential (tank)") {
|
||||
@ -539,7 +589,7 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
|
||||
|
||||
pixmap.fill(QColor("red"));
|
||||
|
||||
if (airframeType == "GroundVehicleCar") { // Car
|
||||
if ((airframeType == "GroundVehicleCar") || (airframeType == "GroundVehicleBoat")) { // Car
|
||||
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None"
|
||||
&& m_aircraft->gvMotor2ChannelBox->currentText() == "None") {
|
||||
m_aircraft->gvMotor1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
|
||||
@ -559,7 +609,7 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
|
||||
m_aircraft->gvSteering1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
|
||||
m_aircraft->gvSteering2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
|
||||
}
|
||||
} else if (airframeType == "GroundVehicleDifferential") { // Tank
|
||||
} else if (airframeType.contains("GroundVehicleDifferential")) { // Tank and differential Boat
|
||||
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None"
|
||||
|| m_aircraft->gvMotor2ChannelBox->currentText() == "None") {
|
||||
m_aircraft->gvMotor1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
|
||||
|
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configgroundvehiclewidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -67,6 +68,7 @@ private:
|
||||
bool setupGroundVehicleCar(QString airframeType);
|
||||
bool setupGroundVehicleDifferential(QString airframeType);
|
||||
bool setupGroundVehicleMotorcycle(QString airframeType);
|
||||
bool setupGroundVehicleBoat(QString airframeType);
|
||||
|
||||
private slots:
|
||||
virtual void setupUI(QString airframeType);
|
||||
|
@ -882,10 +882,18 @@ void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step)
|
||||
transmitterType = acro;
|
||||
} else if (wizardUi->typeGround->isChecked()) {
|
||||
transmitterType = ground;
|
||||
/* Make sure to tell controller, this is really a ground vehicle. */
|
||||
|
||||
systemSettingsData = systemSettingsObj->getData();
|
||||
systemSettingsData.AirframeType = SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR;
|
||||
systemSettingsObj->setData(systemSettingsData);
|
||||
/* Make sure to tell controller, this is really a ground vehicle. */
|
||||
if ((systemSettingsData.AirframeType != SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR) ||
|
||||
(systemSettingsData.AirframeType != SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL) ||
|
||||
(systemSettingsData.AirframeType != SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE) ||
|
||||
(systemSettingsData.AirframeType != SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEBOAT) ||
|
||||
(systemSettingsData.AirframeType != SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIALBOAT)) {
|
||||
// Apply default ground vehicle airframe
|
||||
systemSettingsData.AirframeType = SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR;
|
||||
systemSettingsObj->setData(systemSettingsData);
|
||||
}
|
||||
} else {
|
||||
transmitterType = heli;
|
||||
}
|
||||
@ -1990,7 +1998,11 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
manualSettingsData = manualSettingsObj->getData();
|
||||
systemSettingsData = systemSettingsObj->getData();
|
||||
|
||||
if (systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR) {
|
||||
if ((systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR) ||
|
||||
(systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL) ||
|
||||
(systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE) ||
|
||||
(systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEBOAT) ||
|
||||
(systemSettingsData.AirframeType == SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIALBOAT)) {
|
||||
QMessageBox::warning(this, tr("Ground Vehicle"),
|
||||
tr("<p>Please <b>center</b> throttle control and press OK when ready.</p>"));
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configvehicletypewidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* E. Lafargue, K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -99,6 +99,8 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR:
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEBOAT:
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIALBOAT:
|
||||
// ground
|
||||
channelDesc = ConfigGroundVehicleWidget::getChannelDescriptions();
|
||||
break;
|
||||
@ -284,7 +286,9 @@ int ConfigVehicleTypeWidget::frameCategory(QString frameType)
|
||||
return ConfigVehicleTypeWidget::HELICOPTER;
|
||||
} else if (frameType == "GroundVehicleCar" || frameType == "Turnable (car)"
|
||||
|| frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)"
|
||||
|| frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
|
||||
|| frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle"
|
||||
|| frameType == "GroundVehicleBoat" || frameType == "Boat"
|
||||
|| frameType == "GroundVehicleDifferentialBoat" || frameType == "Differential (boat)") {
|
||||
return ConfigVehicleTypeWidget::GROUND;
|
||||
} else {
|
||||
return ConfigVehicleTypeWidget::CUSTOM;
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 360 KiB After Width: | Height: | Size: 503 KiB |
@ -155,7 +155,7 @@ function isCC3D() {
|
||||
function frameType() {
|
||||
var frameTypeText = ["FixedWing", "FixedWingElevon", "FixedWingVtail", "VTOL", "HeliCP", "QuadX", "QuadP",
|
||||
"Hexa+", "Octo+", "Custom", "HexaX", "HexaH", "OctoV", "OctoCoaxP", "OctoCoaxX", "OctoX", "HexaCoax",
|
||||
"Tricopter", "GroundVehicleCar", "GroundVehicleDiff", "GroundVehicleMoto"];
|
||||
"Tricopter", "GroundCar", "GroundDiff", "GroundMoto", "GroundBoat", "GroundDiffBoat"];
|
||||
|
||||
if (frameTypeText.length != SystemSettings.SystemSettingsConstants.AirframeTypeCount) {
|
||||
console.log("uav.js: frameType() do not match systemSettings.airframeType uavo");
|
||||
|
@ -1,7 +1,7 @@
|
||||
<xml>
|
||||
<object name="SystemSettings" singleinstance="true" settings="true" category="System">
|
||||
<description>Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand</description>
|
||||
<field name="AirframeType" units="" type="enum" elements="1" options="FixedWing,FixedWingElevon,FixedWingVtail,VTOL,HeliCP,QuadX,QuadP,Hexa,Octo,Custom,HexaX,HexaH,OctoV,OctoCoaxP,OctoCoaxX,OctoX,HexaCoax,Tri,GroundVehicleCar,GroundVehicleDifferential,GroundVehicleMotorcycle" defaultvalue="QuadX"/>
|
||||
<field name="AirframeType" units="" type="enum" elements="1" options="FixedWing,FixedWingElevon,FixedWingVtail,VTOL,HeliCP,QuadX,QuadP,Hexa,Octo,Custom,HexaX,HexaH,OctoV,OctoCoaxP,OctoCoaxX,OctoX,HexaCoax,Tri,GroundVehicleCar,GroundVehicleDifferential,GroundVehicleMotorcycle,GroundVehicleBoat,GroundVehicleDifferentialBoat" defaultvalue="QuadX"/>
|
||||
<field name="VehicleName" units="char" type="uint8" elements="20" defaultvalue="0"/>
|
||||
<field name="ThrustControl" units="" type="enum" elements="1" options="Throttle,Collective,None" defaultvalue="Throttle" />
|
||||
<!-- Which way the vehicle controls its thrust. Can be through
|
||||
|
Loading…
x
Reference in New Issue
Block a user