diff --git a/ground/gcs/src/plugins/config/airframe_multirotor.ui b/ground/gcs/src/plugins/config/airframe_multirotor.ui index 3d46b693a..a50cc8969 100644 --- a/ground/gcs/src/plugins/config/airframe_multirotor.ui +++ b/ground/gcs/src/plugins/config/airframe_multirotor.ui @@ -861,7 +861,16 @@ margin:1px; 6 - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -870,7 +879,7 @@ font: bold 12px; margin:1px; - 5 + Pos5 @@ -891,7 +900,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -900,7 +918,7 @@ font: bold 12px; margin:1px; - 6 + Pos6 @@ -921,7 +939,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -930,7 +957,7 @@ font: bold 12px; margin:1px; - 7 + Pos7 @@ -951,7 +978,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -960,7 +996,7 @@ font: bold 12px; margin:1px; - 8 + Pos8 @@ -1029,7 +1065,16 @@ margin:1px; 6 - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -1038,7 +1083,7 @@ font: bold 12px; margin:1px; - 1 + Pos1 @@ -1056,7 +1101,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -1065,7 +1119,7 @@ font: bold 12px; margin:1px; - 2 + Pos2 @@ -1083,7 +1137,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -1092,7 +1155,7 @@ font: bold 12px; margin:1px; - 3 + Pos3 @@ -1110,7 +1173,16 @@ margin:1px; - + + + + 80 + 0 + + + + Qt::AlignCenter + 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); @@ -1119,7 +1191,7 @@ font: bold 12px; margin:1px; - 4 + Pos4 diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp index 8a31ed61d..f4177a8c4 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.cpp @@ -190,15 +190,21 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) Q_ASSERT(m_aircraft); Q_ASSERT(quad); + QStringList motorLabels; + if (frameType == "Tri" || frameType == "Tricopter Y") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Tricopter Y")); + motorLabels << "NW" << "NE" << "S"; + m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); setYawMixLevel(100); } else if (frameType == "QuadX" || frameType == "Quad X") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad X")); + motorLabels << "NW" << "NE" << "SE" << "SW"; + // init mixer levels m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50); @@ -206,12 +212,16 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) } else if (frameType == "QuadP" || frameType == "Quad +") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad +")); + motorLabels << "N" << "E" << "S" << "W"; + m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); setYawMixLevel(50); } else if (frameType == "Hexa" || frameType == "Hexacopter") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter")); + motorLabels << "N" << "NE" << "SE" << "S" << "SW" << "NW"; + m_aircraft->mrRollMixLevel->setValue(100); // Old Roll 50 - Pitch 33 - Yaw 33 m_aircraft->mrPitchMixLevel->setValue(100); // Do not alter mixer matrix setYawMixLevel(100); @@ -219,6 +229,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter X")); + motorLabels << "NE" << "E" << "SE" << "SW" << "W" << "NW"; + m_aircraft->mrRollMixLevel->setValue(100); // Old: Roll 33 - Pitch 50 - Yaw 33 m_aircraft->mrPitchMixLevel->setValue(100); // Do not alter mixer matrix setYawMixLevel(100); @@ -226,6 +238,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter H")); + motorLabels << "NE" << "E" << "SE" << "SW" << "W" << "NW"; + m_aircraft->mrRollMixLevel->setValue(100); // Do not alter mixer matrix m_aircraft->mrPitchMixLevel->setValue(100); // All mixers RPY levels = 100% setYawMixLevel(100); @@ -233,18 +247,24 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter Y6")); + motorLabels << "NW Top" << "NW Bottom" << "NE Top" << "NE Bottom" << "S Top" << "S Bottom"; + m_aircraft->mrRollMixLevel->setValue(86); m_aircraft->mrPitchMixLevel->setValue(100); setYawMixLevel(100); } else if (frameType == "Octo" || frameType == "Octocopter") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter")); + motorLabels << "N" << "NE" << "E" << "SE" << "S" << "SW" << "W" << "NW"; + m_aircraft->mrRollMixLevel->setValue(100); // Do not alter mixer matrix m_aircraft->mrPitchMixLevel->setValue(100); // All mixers RPY levels = 100% setYawMixLevel(100); } else if (frameType == "OctoX" || frameType == "Octocopter X") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter X")); + motorLabels << "NNE" << "ENE" << "ESE" << "SSE" << "SSW" << "WSW" << "WNW" << "NNW"; + m_aircraft->mrRollMixLevel->setValue(100); // Do not alter mixer matrix m_aircraft->mrPitchMixLevel->setValue(100); // All mixers RPY levels = 100% setYawMixLevel(100); @@ -252,18 +272,25 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter V")); + motorLabels << "N" << "NE" << "E" << "SE" << "S" << "SW" << "W" << "NW"; + m_aircraft->mrRollMixLevel->setValue(25); m_aircraft->mrPitchMixLevel->setValue(25); setYawMixLevel(25); } else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax +")); + motorLabels << "N Top" << "N Bottom" << "E Top" << "E Bottom" << "S Top" << "S Bottom" << "W Top" << "W Bottom"; + m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100); setYawMixLevel(50); } else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") { setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X")); + motorLabels << "NW Top" << "NW Bottom" << "NE Top" << "NE Bottom" << "SE Top" << "SE Bottom" << "SW Top" << "SW Bottom"; + + m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50); setYawMixLevel(50); @@ -272,6 +299,9 @@ void ConfigMultiRotorWidget::setupUI(QString frameType) // Enable/Disable controls setupEnabledControls(frameType); + // Update motor position labels + updateMotorsPositionLabels(motorLabels); + // Draw the appropriate airframe updateAirframe(frameType); } @@ -527,6 +557,32 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType) updateAirframe(frameType); } +/** + Helper function to update the UI MotorPositionLabels text + */ +void ConfigMultiRotorWidget::updateMotorsPositionLabels(QStringList motorLabels) +{ + QList mpList; + mpList << m_aircraft->motorPositionLabel1 << m_aircraft->motorPositionLabel2 + << m_aircraft->motorPositionLabel3 << m_aircraft->motorPositionLabel4 + << m_aircraft->motorPositionLabel5 << m_aircraft->motorPositionLabel6 + << m_aircraft->motorPositionLabel7 << m_aircraft->motorPositionLabel8; + + int motorCount = motorLabels.count(); + int uiLabelsCount = mpList.count(); + + if (motorCount < uiLabelsCount) { + // Fill labels for unused motors + for (int index = motorCount; index < uiLabelsCount; index++) { + motorLabels.insert(index, "Not used"); + } + } + + foreach(QString posLabel, motorLabels) { + mpList.takeFirst()->setText(posLabel); + } +} + /** Helper function to update the UI widget objects */ diff --git a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h index dc8f1cf3a..f38495913 100644 --- a/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h +++ b/ground/gcs/src/plugins/config/cfg_vehicletypes/configmultirotorwidget.h @@ -79,6 +79,7 @@ private: void setYawMixLevel(int); void updateRcCurvesUsed(); void updateAirframe(QString multiRotorType); + void updateMotorsPositionLabels(QStringList motorLabels); void setupEnabledControls(QString multiRotorType); private slots: diff --git a/ground/gcs/src/plugins/config/images/multirotor-shapes.svg b/ground/gcs/src/plugins/config/images/multirotor-shapes.svg index f59eb0311..88e79e928 100644 --- a/ground/gcs/src/plugins/config/images/multirotor-shapes.svg +++ b/ground/gcs/src/plugins/config/images/multirotor-shapes.svg @@ -25,17 +25,17 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1280" - inkscape:window-height="928" + inkscape:window-width="1112" + inkscape:window-height="746" id="namedview6635" showgrid="false" - inkscape:zoom="0.16679771" - inkscape:cx="2344.2732" - inkscape:cy="2636.8234" - inkscape:window-x="0" + inkscape:zoom="0.66883113" + inkscape:cx="592.0899" + inkscape:cy="1972.8034" + inkscape:window-x="751" inkscape:window-y="27" - inkscape:window-maximized="1" - inkscape:current-layer="hexa-coax_reverse" + inkscape:window-maximized="0" + inkscape:current-layer="svg4183" inkscape:object-paths="true" inkscape:snap-midpoints="true" inkscape:snap-global="true" @@ -10049,34 +10049,18 @@ id="path5389" d="m 934.1211,1284.0758 c 9.404,9.413 9.404,24.67 -0.008,34.077 -9.406,9.41 -24.664,9.41 -34.076,0 -9.404,-9.407 -9.404,-24.662 0.008,-34.069 9.406,-9.412 24.664,-9.413 34.076,-0.01" />N +NE +SE +S +SW +NW +W +NE +SE +E +SW +NW +N +S +NW +NE +W +NE +SE +E +SW +NW +N +S +NE +W +NE +SE +E +SW +NW +NNE +ENE +ESE +SSE +SSW +WSW +WNW +NNW +SE +S +ENE + + \ No newline at end of file + d="M 1001.67,1438.583 L 1004.365,1438.583 L 1004.365,1421.855 L 1021.094,1421.855 L 1021.094,1438.583 L 1024.082,1438.583 L 1012.877,1449.788 L 1001.67,1438.583 z" /> \ No newline at end of file