1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Merge remote-tracking branch 'origin/laurent/OP-1622_Ground_config_tab' into next

This commit is contained in:
Fredrik Larsson 2014-12-03 17:49:09 +11:00
commit 16eec9caed
7 changed files with 1697 additions and 688 deletions

View File

@ -6,15 +6,24 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>880</width> <width>801</width>
<height>608</height> <height>652</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_10"> <layout class="QVBoxLayout" name="verticalLayout_10">
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -63,171 +72,336 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_41"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="rightMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QGroupBox" name="groupBox_7"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_7">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Output channel assignments</string>
</property>
<layout class="QFormLayout" name="formLayout_5">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="2" column="0">
<widget class="QLabel" name="gvMotor1Label">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Motor 1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="gvMotor1ChannelBox">
<property name="toolTip">
<string>Select output channel for the first motor</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="gvMotor2Label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Motor 2</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="gvMotor2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Select output channel for a second motor</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="gvSteering1Label">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Front Steering</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="gvSteering1ChannelBox">
<property name="toolTip">
<string>Select output channel for the first steering actuator</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="gvSteering2Label">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Rear Steering</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="gvSteering2ChannelBox">
<property name="toolTip">
<string>Select output channel for a second steering actuator</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="differentialSteeringMixBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Differential Steering Mix</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_30">
<item>
<layout class="QVBoxLayout" name="diffSteering1Layout">
<item>
<widget class="QLabel" name="differentialSteeringLabel1">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Left %</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="differentialSteeringSlider1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gvDiffSteering1Label">
<property name="text">
<string>50</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="diffSteering2Layout">
<item>
<widget class="QLabel" name="differentialSteeringLabel2">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Right %</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="differentialSteeringSlider2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gvDiffSteering2Label">
<property name="text">
<string>50</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groundframeBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>200</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="title"> <property name="maximumSize">
<string>Output channel assignments</string> <size>
<width>16777215</width>
<height>16777215</height>
</size>
</property> </property>
<layout class="QFormLayout" name="formLayout_5"> <property name="title">
<item row="0" column="0"> <string>Vehicle frame</string>
<widget class="QLabel" name="gvEngineLabel"> </property>
<property name="minimumSize"> <layout class="QVBoxLayout" name="vehicleframeBox">
<size> <property name="leftMargin">
<width>77</width> <number>9</number>
<height>0</height> </property>
</size> <property name="topMargin">
</property> <number>9</number>
<property name="text"> </property>
<string>Engine</string> <property name="rightMargin">
</property> <number>9</number>
<property name="alignment"> </property>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <property name="bottomMargin">
</property> <number>9</number>
</widget> </property>
</item> <item>
<item row="0" column="1"> <widget class="QGraphicsView" name="groundShape">
<widget class="QComboBox" name="gvEngineChannelBox"> <property name="sizePolicy">
<property name="toolTip"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<string>Select output channel for the engine</string> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</widget> </sizepolicy>
</item>
<item row="1" column="0">
<widget class="QLabel" name="gvAileron1Label">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Aileron 1</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="gvAileron1ChannelBox">
<property name="toolTip">
<string>Select output channel for the first aileron (or elevon)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="gvAileron2Label">
<property name="enabled">
<bool>true</bool>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>50</width>
<height>0</height> <height>300</height>
</size> </size>
</property> </property>
<property name="text"> <property name="styleSheet">
<string>Aileron 2</string> <string notr="true">background:transparent</string>
</property> </property>
</widget> <property name="frameShape">
</item> <enum>QFrame::NoFrame</enum>
<item row="2" column="1">
<widget class="QComboBox" name="gvAileron2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property> </property>
<property name="toolTip"> <property name="frameShadow">
<string>Select output channel for the second aileron (or elevon)</string> <enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="gvMotor1Label">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Motor</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="gvMotor1ChannelBox">
<property name="toolTip">
<string>Select output channel for the first motor</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="gvMotor2Label">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>47</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Motor 2</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="gvMotor2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Select output channel for a second motor</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="gvSteering1Label">
<property name="text">
<string>Front Steering</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="gvSteering1ChannelBox">
<property name="toolTip">
<string>Select output channel for the first steering actuator</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="gvSteering2Label">
<property name="text">
<string>Rear Steering</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="gvSteering2ChannelBox">
<property name="toolTip">
<string>Select output channel for a second steering actuator</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -235,259 +409,152 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="differentialSteeringMixBox"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="enabled"> <property name="leftMargin">
<bool>true</bool> <number>0</number>
</property> </property>
<property name="sizePolicy"> <property name="rightMargin">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <number>0</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="title"> <item>
<string>Differential Steering Mix</string> <widget class="QGroupBox" name="gvThrottleCurve1GroupBox">
</property> <property name="sizePolicy">
<layout class="QVBoxLayout" name="verticalLayout_33"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<item> <horstretch>0</horstretch>
<layout class="QHBoxLayout" name="horizontalLayout_30"> <verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>280</width>
<height>280</height>
</size>
</property>
<property name="title">
<string>Front throttle curve</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36">
<item> <item>
<layout class="QVBoxLayout" name="diffSteering1Layout"> <widget class="MixerCurve" name="groundVehicleThrottle1" native="true">
<item> <property name="sizePolicy">
<widget class="QLabel" name="differentialSteeringLabel1"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<property name="minimumSize"> <horstretch>0</horstretch>
<size> <verstretch>0</verstretch>
<width>65</width> </sizepolicy>
<height>0</height> </property>
</size> <property name="minimumSize">
</property> <size>
<property name="font"> <width>0</width>
<font> <height>0</height>
<pointsize>-1</pointsize> </size>
<weight>75</weight> </property>
<italic>false</italic> <property name="maximumSize">
<bold>true</bold> <size>
</font> <width>16777215</width>
</property> <height>16777215</height>
<property name="styleSheet"> </size>
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); </property>
color: rgb(255, 255, 255); <property name="sizeIncrement">
border-radius: 5; <size>
font: bold 12px; <width>0</width>
margin:1px;</string> <height>0</height>
</property> </size>
<property name="text"> </property>
<string>Left %</string> <property name="baseSize">
</property> <size>
<property name="alignment"> <width>0</width>
<set>Qt::AlignCenter</set> <height>0</height>
</property> </size>
</widget> </property>
</item> </widget>
<item>
<widget class="QSlider" name="differentialSteeringSlider1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gvDiffSteering1Label">
<property name="text">
<string>50</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="diffSteering2Layout">
<item>
<widget class="QLabel" name="differentialSteeringLabel2">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Right %</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="differentialSteeringSlider2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gvDiffSteering2Label">
<property name="text">
<string>50</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </widget>
</layout> </item>
</widget> <item>
</item> <spacer name="verticalSpacer">
<item> <property name="orientation">
<widget class="QGroupBox" name="gvThrottleCurve1GroupBox"> <enum>Qt::Vertical</enum>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <property name="sizeType">
<horstretch>0</horstretch> <enum>QSizePolicy::MinimumExpanding</enum>
<verstretch>100</verstretch> </property>
</sizepolicy> <property name="sizeHint" stdset="0">
</property> <size>
<property name="title"> <width>20</width>
<string>Front throttle curve</string> <height>2</height>
</property> </size>
<layout class="QVBoxLayout" name="verticalLayout_36"> </property>
<item> </spacer>
<widget class="MixerCurve" name="groundVehicleThrottle1" native="true"> </item>
<property name="sizePolicy"> <item>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <widget class="QGroupBox" name="gvThrottleCurve2GroupBox">
<horstretch>0</horstretch> <property name="sizePolicy">
<verstretch>0</verstretch> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
</sizepolicy> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="minimumSize"> </sizepolicy>
<size> </property>
<width>0</width> <property name="maximumSize">
<height>0</height> <size>
</size> <width>280</width>
</property> <height>280</height>
<property name="maximumSize"> </size>
<size> </property>
<width>16777215</width> <property name="title">
<height>16777215</height> <string>Rear throttle curve</string>
</size> </property>
</property> <layout class="QVBoxLayout" name="verticalLayout_37">
<property name="sizeIncrement"> <item>
<size> <widget class="MixerCurve" name="groundVehicleThrottle2" native="true">
<width>0</width> <property name="sizePolicy">
<height>0</height> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="baseSize"> </sizepolicy>
<size> </property>
<width>0</width> <property name="minimumSize">
<height>0</height> <size>
</size> <width>0</width>
</property> <height>0</height>
</widget> </size>
</item> </property>
</layout> <property name="maximumSize">
</widget> <size>
</item> <width>16777215</width>
<item> <height>16777215</height>
<widget class="QGroupBox" name="gvThrottleCurve2GroupBox"> </size>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <property name="sizeIncrement">
<horstretch>0</horstretch> <size>
<verstretch>0</verstretch> <width>0</width>
</sizepolicy> <height>0</height>
</property> </size>
<property name="title"> </property>
<string>Rear throttle curve</string> <property name="baseSize">
</property> <size>
<layout class="QVBoxLayout" name="verticalLayout_37"> <width>0</width>
<item> <height>0</height>
<widget class="MixerCurve" name="groundVehicleThrottle2" native="true"> </size>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> </widget>
<horstretch>0</horstretch> </item>
<verstretch>0</verstretch> </layout>
</sizepolicy> </widget>
</property> </item>
<property name="minimumSize"> </layout>
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <layout class="QGridLayout" name="gridLayout">
<property name="orientation"> <property name="sizeConstraint">
<enum>Qt::Vertical</enum> <enum>QLayout::SetDefaultConstraint</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="rightMargin">
<size> <number>0</number>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</spacer> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_28"> <layout class="QHBoxLayout" name="horizontalLayout_28">

View File

@ -236,9 +236,11 @@ void ConfigCustomWidget::refreshWidgetsValues(QString frameType)
m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0); m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0);
} }
double Throttle2CurveMin = m_aircraft->customThrottle2Curve->getMin();
if (MixerSettings * mxr = qobject_cast<MixerSettings *>(mixer)) { if (MixerSettings * mxr = qobject_cast<MixerSettings *>(mixer)) {
MixerSettings::DataFields mixerSettingsData = mxr->getData(); MixerSettings::DataFields mixerSettingsData = mxr->getData();
if (mixerSettingsData.Curve2Source == MixerSettings::CURVE2SOURCE_THROTTLE) { if (mixerSettingsData.Curve2Source == MixerSettings::CURVE2SOURCE_THROTTLE && Throttle2CurveMin >= 0 ) {
m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE); m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
} else { } else {
m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH); m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH);

View File

@ -79,6 +79,9 @@ ConfigGroundVehicleWidget::ConfigGroundVehicleWidget(QWidget *parent) :
groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle"; groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle";
m_aircraft->groundVehicleType->addItems(groundVehicleTypes); m_aircraft->groundVehicleType->addItems(groundVehicleTypes);
m_aircraft->groundShape->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_aircraft->groundShape->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// Set default model to "Turnable (car)" // Set default model to "Turnable (car)"
connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupUI(QString))); connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupUI(QString)));
m_aircraft->groundVehicleType->setCurrentIndex(m_aircraft->groundVehicleType->findText("Turnable (car)")); m_aircraft->groundVehicleType->setCurrentIndex(m_aircraft->groundVehicleType->findText("Turnable (car)"));
@ -97,51 +100,93 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
{ {
// Setup the UI // Setup the UI
m_aircraft->gvEngineChannelBox->setEnabled(false); Q_ASSERT(m_aircraft);
m_aircraft->gvAileron1ChannelBox->setEnabled(false); QSvgRenderer *renderer = new QSvgRenderer();
m_aircraft->gvAileron2ChannelBox->setEnabled(false); renderer->load(QString(":/configgadget/images/ground-shapes.svg"));
m_vehicleImg = new QGraphicsSvgItem();
m_vehicleImg->setSharedRenderer(renderer);
UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
Q_ASSERT(system);
QPointer<UAVObjectField> frameTypeSaved = system->getField(QString("AirframeType"));
m_aircraft->differentialSteeringSlider1->setEnabled(false); m_aircraft->differentialSteeringSlider1->setEnabled(false);
m_aircraft->differentialSteeringSlider2->setEnabled(false); m_aircraft->differentialSteeringSlider2->setEnabled(false);
m_aircraft->gvThrottleCurve1GroupBox->setEnabled(true);
m_aircraft->gvThrottleCurve2GroupBox->setEnabled(true);
if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)") { if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)") {
// Tank // Tank
m_vehicleImg->setElementId("tank");
setComboCurrentIndex(m_aircraft->groundVehicleType, setComboCurrentIndex(m_aircraft->groundVehicleType,
m_aircraft->groundVehicleType->findText("Differential (tank)")); m_aircraft->groundVehicleType->findText("Differential (tank)"));
m_aircraft->gvMotor1ChannelBox->setEnabled(true); m_aircraft->gvMotor1ChannelBox->setEnabled(true);
m_aircraft->gvMotor2ChannelBox->setEnabled(true); m_aircraft->gvMotor2ChannelBox->setEnabled(true);
m_aircraft->gvThrottleCurve1GroupBox->setEnabled(false);
m_aircraft->gvMotor1Label->setText("Left motor"); m_aircraft->gvMotor1Label->setText("Left motor");
m_aircraft->gvMotor2Label->setText("Right motor"); m_aircraft->gvMotor2Label->setText("Right motor");
m_aircraft->gvSteering1ChannelBox->setEnabled(false); m_aircraft->gvSteering1ChannelBox->setEnabled(false);
m_aircraft->gvSteering2ChannelBox->setEnabled(false); m_aircraft->gvSteering2ChannelBox->setEnabled(false);
m_aircraft->gvSteering1Label->setText("Front steering");
m_aircraft->gvSteering2Label->setText("Rear steering"); m_aircraft->gvSteering2Label->setText("Rear steering");
m_aircraft->differentialSteeringSlider1->setEnabled(true); m_aircraft->differentialSteeringSlider1->setEnabled(true);
m_aircraft->differentialSteeringSlider2->setEnabled(true); m_aircraft->differentialSteeringSlider2->setEnabled(true);
m_aircraft->gvThrottleCurve1GroupBox->setTitle("Left throttle curve"); m_aircraft->gvThrottleCurve1GroupBox->setTitle("");
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Right throttle curve"); m_aircraft->gvThrottleCurve2GroupBox->setTitle("Throttle curve");
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_PITCH);
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
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);
}
} else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") { } else if (frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
// Motorcycle // Motorcycle
m_vehicleImg->setElementId("motorbike");
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Motorcycle")); setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Motorcycle"));
m_aircraft->gvMotor1ChannelBox->setEnabled(false); m_aircraft->gvMotor1ChannelBox->setEnabled(false);
m_aircraft->gvMotor2ChannelBox->setEnabled(true); m_aircraft->gvMotor2ChannelBox->setEnabled(true);
m_aircraft->gvThrottleCurve1GroupBox->setEnabled(false);
m_aircraft->gvMotor1Label->setText("Front motor");
m_aircraft->gvMotor2Label->setText("Rear motor"); m_aircraft->gvMotor2Label->setText("Rear motor");
m_aircraft->gvSteering1ChannelBox->setEnabled(true); m_aircraft->gvSteering1ChannelBox->setEnabled(true);
m_aircraft->gvSteering2ChannelBox->setEnabled(true); m_aircraft->gvSteering2ChannelBox->setEnabled(true);
m_aircraft->gvSteering1Label->setText("Front steering");
m_aircraft->gvSteering2Label->setText("Balancing"); m_aircraft->gvSteering2Label->setText("Balancing");
m_aircraft->gvThrottleCurve1GroupBox->setTitle("Front throttle curve");
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve"); m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve");
// Curve range 0 -> +1 (no reverse)
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
initMixerCurves(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);
}
} else { } else {
// Car // Car
m_vehicleImg->setElementId("car");
setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Turnable (car)")); setComboCurrentIndex(m_aircraft->groundVehicleType, m_aircraft->groundVehicleType->findText("Turnable (car)"));
m_aircraft->gvMotor1ChannelBox->setEnabled(true); m_aircraft->gvMotor1ChannelBox->setEnabled(true);
@ -153,9 +198,30 @@ void ConfigGroundVehicleWidget::setupUI(QString frameType)
m_aircraft->gvSteering1ChannelBox->setEnabled(true); m_aircraft->gvSteering1ChannelBox->setEnabled(true);
m_aircraft->gvSteering2ChannelBox->setEnabled(true); m_aircraft->gvSteering2ChannelBox->setEnabled(true);
m_aircraft->gvSteering1Label->setText("Front steering");
m_aircraft->gvSteering2Label->setText("Rear steering");
m_aircraft->gvThrottleCurve1GroupBox->setTitle("Front throttle curve"); m_aircraft->gvThrottleCurve1GroupBox->setTitle("Front throttle curve");
m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve"); m_aircraft->gvThrottleCurve2GroupBox->setTitle("Rear throttle curve");
m_aircraft->groundVehicleThrottle2->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
m_aircraft->groundVehicleThrottle1->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
initMixerCurves(frameType);
// If new setup, set curves values
if (frameTypeSaved->getValue().toString() != "GroundVehicleCar") {
// Curve range 0 -> +1 (no reverse)
m_aircraft->groundVehicleThrottle1->initLinearCurve(5, 1.0);
m_aircraft->groundVehicleThrottle2->initLinearCurve(5, 1.0);
}
} }
QGraphicsScene *scene = new QGraphicsScene();
scene->addItem(m_vehicleImg);
scene->setSceneRect(m_vehicleImg->boundingRect());
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
m_aircraft->groundShape->setScene(scene);
} }
void ConfigGroundVehicleWidget::enableControls(bool enable) void ConfigGroundVehicleWidget::enableControls(bool enable)
@ -174,9 +240,6 @@ void ConfigGroundVehicleWidget::registerWidgets(ConfigTaskWidget &parent)
parent.addWidget(m_aircraft->groundVehicleThrottle2->getCurveWidget()); parent.addWidget(m_aircraft->groundVehicleThrottle2->getCurveWidget());
parent.addWidget(m_aircraft->groundVehicleThrottle2); parent.addWidget(m_aircraft->groundVehicleThrottle2);
parent.addWidget(m_aircraft->groundVehicleType); parent.addWidget(m_aircraft->groundVehicleType);
parent.addWidget(m_aircraft->gvEngineChannelBox);
parent.addWidget(m_aircraft->gvAileron1ChannelBox);
parent.addWidget(m_aircraft->gvAileron2ChannelBox);
parent.addWidget(m_aircraft->gvMotor1ChannelBox); parent.addWidget(m_aircraft->gvMotor1ChannelBox);
parent.addWidget(m_aircraft->gvMotor2ChannelBox); parent.addWidget(m_aircraft->gvMotor2ChannelBox);
parent.addWidget(m_aircraft->gvSteering1ChannelBox); parent.addWidget(m_aircraft->gvSteering1ChannelBox);
@ -198,9 +261,45 @@ void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
{ {
setupUI(frameType); setupUI(frameType);
initMixerCurves(frameType);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer); Q_ASSERT(mixer);
GUIConfigDataUnion config = getConfigData();
// THIS SECTION STILL NEEDS WORK. FOR THE MOMENT, USE THE FIXED-WING ONBOARD SETTING IN ORDER TO MINIMIZE CHANCES OF BOLLOXING REAL CODE
// Retrieve channel setup values
setComboCurrentIndex(m_aircraft->gvMotor1ChannelBox, config.ground.GroundVehicleThrottle1);
setComboCurrentIndex(m_aircraft->gvMotor2ChannelBox, config.ground.GroundVehicleThrottle2);
setComboCurrentIndex(m_aircraft->gvSteering1ChannelBox, config.ground.GroundVehicleSteering1);
setComboCurrentIndex(m_aircraft->gvSteering2ChannelBox, config.ground.GroundVehicleSteering2);
if (frameType == "GroundVehicleDifferential") {
// Find the channel number for Motor1
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// If for some reason the actuators were incoherent, we might fail here, hence the check.
m_aircraft->differentialSteeringSlider1->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW) / 1.27);
}
channel = m_aircraft->gvMotor2ChannelBox->currentIndex() - 1;
if (channel > -1) {
m_aircraft->differentialSteeringSlider2->setValue(
-getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW) / 1.27);
}
}
}
/**
Virtual function to update curve values from board
*/
void ConfigGroundVehicleWidget::initMixerCurves(QString frameType)
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
QList<double> curveValues; QList<double> curveValues;
getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues); getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues);
@ -219,45 +318,12 @@ void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
if (isValidThrottleCurve(&curveValues)) { if (isValidThrottleCurve(&curveValues)) {
m_aircraft->groundVehicleThrottle2->initCurve(&curveValues); m_aircraft->groundVehicleThrottle2->initCurve(&curveValues);
} else { } else {
// no, init a straight curve
if (frameType == "GroundVehicleDifferential") {
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 0.8, -0.8);
} else {
m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0); m_aircraft->groundVehicleThrottle2->initLinearCurve(curveValues.count(), 1.0);
}
GUIConfigDataUnion config = getConfigData();
// THIS SECTION STILL NEEDS WORK. FOR THE MOMENT, USE THE FIXED-WING ONBOARD SETTING IN ORDER TO MINIMIZE CHANCES OF BOLLOXING REAL CODE
// Retrieve channel setup values
setComboCurrentIndex(m_aircraft->gvMotor1ChannelBox, config.ground.GroundVehicleThrottle1);
setComboCurrentIndex(m_aircraft->gvMotor2ChannelBox, config.ground.GroundVehicleThrottle2);
setComboCurrentIndex(m_aircraft->gvSteering1ChannelBox, config.ground.GroundVehicleSteering1);
setComboCurrentIndex(m_aircraft->gvSteering2ChannelBox, config.ground.GroundVehicleSteering2);
if (frameType == "GroundVehicleDifferential") {
// CURRENTLY BROKEN UNTIL WE DECIDE HOW DIFFERENTIAL SHOULD BEHAVE
// If the vehicle type is "differential", restore the slider setting
// Find the channel number for Motor1
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
// Q_ASSERT(obj);
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1;
if (channel > -1) {
// If for some reason the actuators were incoherent, we might fail here, hence the check.
m_aircraft->differentialSteeringSlider1->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL) * 100);
m_aircraft->differentialSteeringSlider2->setValue(
getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH) * 100);
} }
} else if (frameType == "GroundVehicleMotorcycle") {
// CURRENTLY BROKEN UNTIL WE DECIDE HOW MOTORCYCLE SHOULD BEHAVE
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
// Q_ASSERT(obj);
// int chMixerNumber = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
// if (chMixerNumber >=0) {
// field = obj->getField(mixerVectors.at(chMixerNumber));
// int ti = field->getElementNames().indexOf("Yaw");
// m_aircraft->differentialSteeringSlider1->setValue(field->getDouble(ti)*100);
//
// ti = field->getElementNames().indexOf("Pitch");
// m_aircraft->differentialSteeringSlider2->setValue(field->getDouble(ti)*100);
// }
} }
} }
@ -285,7 +351,7 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
} else if (m_aircraft->groundVehicleType->currentText() == "Differential (tank)") { } else if (m_aircraft->groundVehicleType->currentText() == "Differential (tank)") {
airframeType = "GroundVehicleDifferential"; airframeType = "GroundVehicleDifferential";
setupGroundVehicleDifferential(airframeType); setupGroundVehicleDifferential(airframeType);
} else { // "Motorcycle" } else {
airframeType = "GroundVehicleMotorcycle"; airframeType = "GroundVehicleMotorcycle";
setupGroundVehicleMotorcycle(airframeType); setupGroundVehicleMotorcycle(airframeType);
} }
@ -310,8 +376,9 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
GUIConfigDataUnion config = getConfigData(); GUIConfigDataUnion config = getConfigData();
resetActuators(&config); resetActuators(&config);
config.ground.GroundVehicleThrottle1 = m_aircraft->gvMotor1ChannelBox->currentIndex();
config.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex(); config.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex();
config.ground.GroundVehicleSteering1 = m_aircraft->gvSteering1ChannelBox->currentIndex();
config.ground.GroundVehicleSteering2 = m_aircraft->gvSteering2ChannelBox->currentIndex();
setConfigData(config); setConfigData(config);
@ -369,17 +436,20 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
Q_ASSERT(mixer); Q_ASSERT(mixer);
resetMotorAndServoMixers(mixer); resetMotorAndServoMixers(mixer);
double yawmotor1 = m_aircraft->differentialSteeringSlider1->value() * 1.27;
double yawmotor2 = m_aircraft->differentialSteeringSlider2->value() * 1.27;
// left motor // left motor
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1; int channel = m_aircraft->gvMotor1ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yawmotor1);
// right motor // right motor
channel = m_aircraft->gvMotor2ChannelBox->currentIndex() - 1; channel = m_aircraft->gvMotor2ChannelBox->currentIndex() - 1;
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR); setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_REVERSABLEMOTOR);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yawmotor2);
// Output success message // Output success message
m_aircraft->gvStatusLabel->setText("Mixer generated"); m_aircraft->gvStatusLabel->setText("Mixer generated");
@ -446,7 +516,7 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
bool error = false; bool error = false;
// Create a red block. All combo boxes are the same size, so any one should do as a model // Create a red block. All combo boxes are the same size, so any one should do as a model
int size = m_aircraft->gvEngineChannelBox->style()->pixelMetric(QStyle::PM_SmallIconSize); int size = m_aircraft->gvMotor1ChannelBox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size); QPixmap pixmap(size, size);
pixmap.fill(QColor("red")); pixmap.fill(QColor("red"));
@ -454,40 +524,22 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
if (airframeType == "GroundVehicleCar") { // Car if (airframeType == "GroundVehicleCar") { // Car
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None" if (m_aircraft->gvMotor1ChannelBox->currentText() == "None"
&& m_aircraft->gvMotor2ChannelBox->currentText() == "None") { && m_aircraft->gvMotor2ChannelBox->currentText() == "None") {
pixmap.fill(QColor("green"));
m_aircraft->gvMotor1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes m_aircraft->gvMotor1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
m_aircraft->gvMotor2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes m_aircraft->gvMotor2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
// m_aircraft->gvMotor1Label->setText("<font color='red'>" + m_aircraft->gvMotor1Label->text() + "</font>");
// m_aircraft->gvMotor2Label->setText("<font color='red'>" + m_aircraft->gvMotor2Label->text() + "</font>");
error = true; error = true;
} else { } else {
m_aircraft->gvMotor1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvMotor1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
m_aircraft->gvMotor2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvMotor2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
// QTextEdit* htmlText=new QTextEdit(m_aircraft->gvMotor1Label->text()); // HtmlText is any QString with html tags.
// m_aircraft->gvMotor1Label->setText(htmlText->toPlainText());
// delete htmlText;
// htmlText=new QTextEdit(m_aircraft->gvMotor2Label->text()); // HtmlText is any QString with html tags.
// m_aircraft->gvMotor2Label->setText(htmlText->toPlainText());
} }
if (m_aircraft->gvSteering1ChannelBox->currentText() == "None" if (m_aircraft->gvSteering1ChannelBox->currentText() == "None"
&& m_aircraft->gvSteering2ChannelBox->currentText() == "None") { && m_aircraft->gvSteering2ChannelBox->currentText() == "None") {
m_aircraft->gvSteering1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes m_aircraft->gvSteering1ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
m_aircraft->gvSteering2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes m_aircraft->gvSteering2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
// m_aircraft->gvStatusLabel->setText("<font color='red'>ERROR: check steering channel assignment</font>");
// m_aircraft->gvSteering1Label->setText("<font color='red'>" + m_aircraft->gvSteering1Label->text() + "</font>");
// m_aircraft->gvSteering2Label->setText("<font color='red'>" + m_aircraft->gvSteering2Label->text() + "</font>");
error = true; error = true;
} else { } else {
m_aircraft->gvSteering1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvSteering1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
m_aircraft->gvSteering2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvSteering2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
// QTextEdit* htmlText=new QTextEdit(m_aircraft->gvSteering1Label->text()); // HtmlText is any QString with html tags.
// m_aircraft->gvSteering1Label->setText(htmlText->toPlainText());
// delete htmlText;
// htmlText=new QTextEdit(m_aircraft->gvSteering2Label->text()); // HtmlText is any QString with html tags.
// m_aircraft->gvSteering2Label->setText(htmlText->toPlainText());
} }
} else if (airframeType == "GroundVehicleDifferential") { // Tank } else if (airframeType == "GroundVehicleDifferential") { // Tank
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None" if (m_aircraft->gvMotor1ChannelBox->currentText() == "None"
@ -504,8 +556,7 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
m_aircraft->gvSteering1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvSteering1ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
m_aircraft->gvSteering2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes m_aircraft->gvSteering2ChannelBox->setItemData(0, 0, Qt::DecorationRole); // Reset color palettes
} else if (airframeType == "GroundVehicleMotorcycle") { // Motorcycle } else if (airframeType == "GroundVehicleMotorcycle") { // Motorcycle
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None" if (m_aircraft->gvMotor2ChannelBox->currentText() == "None") {
&& m_aircraft->gvMotor2ChannelBox->currentText() == "None") {
m_aircraft->gvMotor2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes m_aircraft->gvMotor2ChannelBox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
error = true; error = true;
} else { } else {
@ -530,3 +581,17 @@ bool ConfigGroundVehicleWidget::throwConfigError(QString airframeType)
} }
return error; return error;
} }
void ConfigGroundVehicleWidget::resizeEvent(QResizeEvent *)
{
if (m_vehicleImg) {
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
}
}
void ConfigGroundVehicleWidget::showEvent(QShowEvent *)
{
if (m_vehicleImg) {
m_aircraft->groundShape->fitInView(m_vehicleImg, Qt::KeepAspectRatio);
}
}

View File

@ -50,13 +50,17 @@ public:
~ConfigGroundVehicleWidget(); ~ConfigGroundVehicleWidget();
virtual void refreshWidgetsValues(QString frameType); virtual void refreshWidgetsValues(QString frameType);
virtual void initMixerCurves(QString frameType);
virtual QString updateConfigObjectsFromWidgets(); virtual QString updateConfigObjectsFromWidgets();
protected: protected:
void enableControls(bool enable); void enableControls(bool enable);
void resizeEvent(QResizeEvent *);
void showEvent(QShowEvent *);
private: private:
Ui_GroundConfigWidget *m_aircraft; Ui_GroundConfigWidget *m_aircraft;
QGraphicsSvgItem *m_vehicleImg;
virtual void registerWidgets(ConfigTaskWidget &parent); virtual void registerWidgets(ConfigTaskWidget &parent);
virtual void resetActuators(GUIConfigDataUnion *configData); virtual void resetActuators(GUIConfigDataUnion *configData);

View File

@ -4,6 +4,7 @@
<file>images/ahrs-calib.svg</file> <file>images/ahrs-calib.svg</file>
<file>images/multirotor-shapes.svg</file> <file>images/multirotor-shapes.svg</file>
<file>images/fixedwing-shapes.svg</file> <file>images/fixedwing-shapes.svg</file>
<file>images/ground-shapes.svg</file>
<file>images/ccpm_setup.svg</file> <file>images/ccpm_setup.svg</file>
<file>images/PipXtreme.png</file> <file>images/PipXtreme.png</file>
<file>images/help.png</file> <file>images/help.png</file>

View File

@ -329,7 +329,7 @@ int ConfigVehicleTypeWidget::frameCategory(QString frameType)
return ConfigVehicleTypeWidget::HELICOPTER; return ConfigVehicleTypeWidget::HELICOPTER;
} else if (frameType == "GroundVehicleCar" || frameType == "Turnable (car)" } else if (frameType == "GroundVehicleCar" || frameType == "Turnable (car)"
|| frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)" || frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)"
|| frameType == "GroundVehicleMotorcyle" || frameType == "Motorcycle") { || frameType == "GroundVehicleMotorcycle" || frameType == "Motorcycle") {
return ConfigVehicleTypeWidget::GROUND; return ConfigVehicleTypeWidget::GROUND;
} else { } else {
return ConfigVehicleTypeWidget::CUSTOM; return ConfigVehicleTypeWidget::CUSTOM;

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 329 KiB