mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-454 Add boat to the Vehicle Wizard
This commit is contained in:
parent
1bff0f479c
commit
86bde01643
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file connectiondiagram.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup
|
||||
* @{
|
||||
@ -159,6 +159,12 @@ void ConnectionDiagram::setupGraphicsScene()
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_MOTORCYCLE:
|
||||
elementsToShow << "motorbike";
|
||||
break;
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_BOAT:
|
||||
elementsToShow << "boat";
|
||||
break;
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL_BOAT:
|
||||
elementsToShow << "boat_diff";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -82,9 +82,11 @@ void OutputCalibrationPage::setupActuatorMinMaxAndNeutral(int motorChannelStart,
|
||||
m_actuatorSettings[servoid].channelNeutral = LOW_OUTPUT_RATE_MILLISECONDS;
|
||||
m_actuatorSettings[servoid].channelMax = getHighOutputRate();
|
||||
m_actuatorSettings[servoid].isReversableMotor = false;
|
||||
// Car and Tank should use reversable Esc/motors
|
||||
// Car, Tank, Boat and Boat differential should use reversable Esc/motors
|
||||
if ((getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_CAR)
|
||||
|| (getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_DIFFERENTIAL)) {
|
||||
|| (getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_DIFFERENTIAL)
|
||||
|| (getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_BOAT)
|
||||
|| (getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_DIFFERENTIAL_BOAT)) {
|
||||
m_actuatorSettings[servoid].channelNeutral = NEUTRAL_OUTPUT_RATE_MILLISECONDS;
|
||||
m_actuatorSettings[servoid].isReversableMotor = true;
|
||||
// Set initial output value
|
||||
@ -290,6 +292,30 @@ void OutputCalibrationPage::setupVehicle()
|
||||
|
||||
setupActuatorMinMaxAndNeutral(3, 3, 2);
|
||||
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
break;
|
||||
case SetupWizard::GROUNDVEHICLE_BOAT:
|
||||
loadSVGFile(GROUND_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 2;
|
||||
m_vehicleElementIds << "boat" << "boat-frame" << "boat-motor" << "boat-rudder";
|
||||
m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO;
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2;
|
||||
m_channelIndex << 0 << 3 << 0;
|
||||
|
||||
setupActuatorMinMaxAndNeutral(3, 3, 2);
|
||||
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
break;
|
||||
case SetupWizard::GROUNDVEHICLE_DIFFERENTIAL_BOAT:
|
||||
loadSVGFile(GROUND_SVG_FILE);
|
||||
m_wizardIndexes << 0 << 1 << 1;
|
||||
m_vehicleElementIds << "boat_diff" << "boat_diff-frame" << "boat_diff-left-motor" << "boat_diff-right-motor";
|
||||
m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR;
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2;
|
||||
m_channelIndex << 0 << 0 << 1;
|
||||
|
||||
setupActuatorMinMaxAndNeutral(0, 1, 2);
|
||||
|
||||
getWizard()->setActuatorSettings(m_actuatorSettings);
|
||||
break;
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file surfacepage.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @addtogroup
|
||||
* @{
|
||||
* @addtogroup SurfacePage
|
||||
@ -56,12 +57,12 @@ void SurfacePage::setupSelection(Selection *selection)
|
||||
"Please select the type of ground vehicle you want to create a configuration for below:"));
|
||||
|
||||
selection->addItem(tr("Car"),
|
||||
tr("This setup expects a traditional car with a rear motor and a front streering servo"),
|
||||
tr("This setup expects a traditional car with a rear motor and a front steering servo."),
|
||||
"car",
|
||||
SetupWizard::GROUNDVEHICLE_CAR);
|
||||
|
||||
selection->addItem(tr("Tank"),
|
||||
tr("This setup expects a traditional vehicle using only two motors and differential steering"),
|
||||
tr("This setup expects a traditional vehicle using only two motors and differential steering."),
|
||||
"tank",
|
||||
SetupWizard::GROUNDVEHICLE_DIFFERENTIAL);
|
||||
|
||||
@ -69,4 +70,14 @@ void SurfacePage::setupSelection(Selection *selection)
|
||||
tr("This setup currently expects a motorcyle setup, using one motor and one servo for steering."),
|
||||
"motorbike",
|
||||
SetupWizard::GROUNDVEHICLE_MOTORCYCLE);
|
||||
|
||||
selection->addItem(tr("Boat"),
|
||||
tr("This setup currently expects a boat setup, using one motor and one servo for rudder/helm."),
|
||||
"boat",
|
||||
SetupWizard::GROUNDVEHICLE_BOAT);
|
||||
|
||||
selection->addItem(tr("Boat differential"),
|
||||
tr("This setup expects a boat using only two motors and differential steering."),
|
||||
"boat_diff",
|
||||
SetupWizard::GROUNDVEHICLE_DIFFERENTIAL_BOAT);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 4.6 MiB After Width: | Height: | Size: 4.9 MiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 371 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 492 KiB After Width: | Height: | Size: 630 KiB |
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file setupwizard.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -138,7 +138,8 @@ int SetupWizard::nextId() const
|
||||
|
||||
case PAGE_FIXEDWING:
|
||||
case PAGE_SURFACE:
|
||||
if (getVehicleSubType() == GROUNDVEHICLE_DIFFERENTIAL) {
|
||||
if ((getVehicleSubType() == GROUNDVEHICLE_DIFFERENTIAL) ||
|
||||
(getVehicleSubType() == GROUNDVEHICLE_DIFFERENTIAL_BOAT)) {
|
||||
return PAGE_ESC;
|
||||
} else {
|
||||
return PAGE_SERVO;
|
||||
@ -360,6 +361,12 @@ QString SetupWizard::getSummaryText()
|
||||
case SetupWizard::GROUNDVEHICLE_MOTORCYCLE:
|
||||
summary.append(tr("Motorcycle"));
|
||||
break;
|
||||
case SetupWizard::GROUNDVEHICLE_BOAT:
|
||||
summary.append(tr("Boat"));
|
||||
break;
|
||||
case SetupWizard::GROUNDVEHICLE_DIFFERENTIAL_BOAT:
|
||||
summary.append(tr("Boat differential"));
|
||||
break;
|
||||
default:
|
||||
summary.append(tr("Unknown"));
|
||||
break;
|
||||
@ -422,7 +429,8 @@ QString SetupWizard::getSummaryText()
|
||||
|
||||
// If Tricopter show tail servo speed
|
||||
if (getVehicleSubType() == MULTI_ROTOR_TRI_Y || getVehicleType() == VEHICLE_FIXEDWING
|
||||
|| getVehicleSubType() == GROUNDVEHICLE_MOTORCYCLE || getVehicleSubType() == GROUNDVEHICLE_CAR) {
|
||||
|| getVehicleSubType() == GROUNDVEHICLE_MOTORCYCLE || getVehicleSubType() == GROUNDVEHICLE_CAR
|
||||
|| getVehicleSubType() == GROUNDVEHICLE_BOAT) {
|
||||
summary.append("<br>");
|
||||
summary.append("<b>").append(tr("Servo type: ")).append("</b>");
|
||||
switch (getServoType()) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
***********************************************************************************
|
||||
*
|
||||
* @file vehicleconfigurationhelper.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015-2016.
|
||||
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup
|
||||
* @{
|
||||
@ -478,6 +478,12 @@ void VehicleConfigurationHelper::applyVehicleConfiguration()
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_MOTORCYCLE:
|
||||
setupMotorcycle();
|
||||
break;
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_BOAT:
|
||||
setupBoat();
|
||||
break;
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_DIFFERENTIAL_BOAT:
|
||||
setupBoatDiff();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -950,6 +956,20 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
|
||||
maxThrottle = 0.8;
|
||||
minThrottle = 0;
|
||||
break;
|
||||
case VehicleConfigurationSource::GROUNDVEHICLE_BOAT:
|
||||
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);
|
||||
mSettings->setMixerValuePitch((qint8)100);
|
||||
mSettings->setMixerValueYaw((qint8)100);
|
||||
maxThrottle = 0.8;
|
||||
minThrottle = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2326,3 +2346,69 @@ void VehicleConfigurationHelper::setupMotorcycle()
|
||||
applyMixerConfiguration(channels);
|
||||
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE, guiSettings);
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::setupBoat()
|
||||
{
|
||||
// Typical vehicle setup
|
||||
// 1. Setup mixer data
|
||||
// 2. Setup GUI data
|
||||
// 3. Apply changes
|
||||
|
||||
mixerChannelSettings channels[ActuatorSettings::CHANNELADDR_NUMELEM];
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
|
||||
// Rudder Servo (Chan 1)
|
||||
channels[0].type = MIXER_TYPE_SERVO;
|
||||
channels[0].throttle1 = 0;
|
||||
channels[0].throttle2 = 0;
|
||||
channels[0].roll = 0;
|
||||
channels[0].pitch = 0;
|
||||
channels[0].yaw = 100;
|
||||
|
||||
// Motor (Chan 4)
|
||||
channels[3].type = MIXER_TYPE_REVERSABLEMOTOR;
|
||||
channels[3].throttle1 = 100;
|
||||
channels[3].throttle2 = 0;
|
||||
channels[3].roll = 0;
|
||||
channels[3].pitch = 0;
|
||||
channels[3].yaw = 0;
|
||||
|
||||
guiSettings.ground.GroundVehicleSteering1 = 1;
|
||||
guiSettings.ground.GroundVehicleThrottle2 = 4;
|
||||
|
||||
applyMixerConfiguration(channels);
|
||||
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEBOAT, guiSettings);
|
||||
}
|
||||
|
||||
void VehicleConfigurationHelper::setupBoatDiff()
|
||||
{
|
||||
// Typical vehicle setup
|
||||
// 1. Setup mixer data
|
||||
// 2. Setup GUI data
|
||||
// 3. Apply changes
|
||||
|
||||
mixerChannelSettings channels[ActuatorSettings::CHANNELADDR_NUMELEM];
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
|
||||
// Left Motor (Chan 1)
|
||||
channels[0].type = MIXER_TYPE_REVERSABLEMOTOR;
|
||||
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 = 100;
|
||||
channels[1].throttle2 = 0;
|
||||
channels[1].roll = 0;
|
||||
channels[1].pitch = 0;
|
||||
channels[1].yaw = -100;
|
||||
|
||||
guiSettings.ground.GroundVehicleThrottle1 = 1;
|
||||
guiSettings.ground.GroundVehicleThrottle2 = 2;
|
||||
|
||||
applyMixerConfiguration(channels);
|
||||
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIALBOAT, guiSettings);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file vehicleconfigurationhelper.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
|
||||
* @{
|
||||
* @addtogroup VehicleConfigurationHelper
|
||||
@ -121,6 +122,8 @@ private:
|
||||
void setupCar();
|
||||
void setupTank();
|
||||
void setupMotorcycle();
|
||||
void setupBoat();
|
||||
void setupBoatDiff();
|
||||
|
||||
private slots:
|
||||
void uAVOTransactionCompleted(UAVObject *object, bool success);
|
||||
|
@ -2,7 +2,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file vehicleconfigurationsource.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
|
||||
* @{
|
||||
* @addtogroup VehicleConfigurationSource
|
||||
@ -63,7 +64,7 @@ public:
|
||||
MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_X, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO,
|
||||
MULTI_ROTOR_OCTO_X, MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS,
|
||||
FIXED_WING_DUAL_AILERON, FIXED_WING_AILERON, FIXED_WING_ELEVON, FIXED_WING_VTAIL, HELI_CCPM,
|
||||
GROUNDVEHICLE_MOTORCYCLE, GROUNDVEHICLE_CAR, GROUNDVEHICLE_DIFFERENTIAL };
|
||||
GROUNDVEHICLE_MOTORCYCLE, GROUNDVEHICLE_CAR, GROUNDVEHICLE_DIFFERENTIAL, GROUNDVEHICLE_BOAT, GROUNDVEHICLE_DIFFERENTIAL_BOAT };
|
||||
enum ESC_TYPE { ESC_ONESHOT, ESC_SYNCHED, ESC_RAPID, ESC_STANDARD, ESC_UNKNOWN };
|
||||
enum SERVO_TYPE { SERVO_ANALOG, SERVO_DIGITAL, SERVO_UNKNOWN };
|
||||
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSM, INPUT_SRXL, INPUT_HOTT_SUMD, INPUT_EXBUS, INPUT_IBUS, INPUT_UNKNOWN };
|
||||
|
Loading…
x
Reference in New Issue
Block a user