From a246c0f9adc4935d54c8c1ef9654eb75ddf875f6 Mon Sep 17 00:00:00 2001 From: edouard Date: Tue, 28 Sep 2010 19:44:55 +0000 Subject: [PATCH] OP-138 Corrected inconsistency with Quad-X read/write. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1792 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/config/airframe.ui | 208 ++++- .../plugins/config/configairframewidget.cpp | 38 +- .../src/plugins/config/images/quad-shapes.svg | 714 +++++++++++++++++- 3 files changed, 939 insertions(+), 21 deletions(-) diff --git a/ground/src/plugins/config/airframe.ui b/ground/src/plugins/config/airframe.ui index a3503d437..e4785427f 100644 --- a/ground/src/plugins/config/airframe.ui +++ b/ground/src/plugins/config/airframe.ui @@ -69,7 +69,7 @@ - 1 + 3 @@ -887,11 +887,207 @@ - - - Custom / Advanced setup UI - - + + + + + + + + + Channel1 + + + + + + + + + + Channel 2 + + + + + + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Channel 3 + + + + + + + + + + Channel 4 + + + + + + + + + + + + + + Channel 5 + + + + + + + + + + Channel 6 + + + + + + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Channel 7 + + + + + + + + + + Channel 8 + + + + + + + + + + + + + + + + + 0 + 0 + + + + + 150 + 150 + + + + + 200 + 200 + + + + + + + + + 0 + 0 + + + + + 150 + 150 + + + + + 200 + 200 + + + + + + + + + + FeedForward + + + + + + + Qt::Horizontal + + + + + + + AccelTime + + + + + + + + + + DecelTime + + + + + + + + + + + + + + TextLabel + + + + diff --git a/ground/src/plugins/config/configairframewidget.cpp b/ground/src/plugins/config/configairframewidget.cpp index aedbaa767..49f2b91d9 100644 --- a/ground/src/plugins/config/configairframewidget.cpp +++ b/ground/src/plugins/config/configairframewidget.cpp @@ -277,22 +277,40 @@ void ConfigAirframeWidget::requestAircraftUpdate() Q_ASSERT(field); m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString())); } else if (frameType == "QuadX") { - // Motors 1/2/3/4 are: NE / SE / SW / NW - field = obj->getField(QString("VTOLMotorNE")); + // Motors 1/2/3/4 are: NW / NE / SE / SW + field = obj->getField(QString("VTOLMotorNW")); Q_ASSERT(field); m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString())); - field = obj->getField(QString("VTOLMotorSE")); + field = obj->getField(QString("VTOLMotorNE")); Q_ASSERT(field); m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString())); - field = obj->getField(QString("VTOLMotorSW")); + field = obj->getField(QString("VTOLMotorSE")); Q_ASSERT(field); m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString())); - field = obj->getField(QString("VTOLMotorNW")); + field = obj->getField(QString("VTOLMotorSW")); Q_ASSERT(field); m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString())); } else if (frameType == "Hexa") { - // Motors 1/2/3 4/5/6 are: ??? + // Motors 1/2/3 4/5/6 are: NW / N / NE and SE / S / SW + field = obj->getField(QString("VTOLMotorNW")); + Q_ASSERT(field); + m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString())); + field = obj->getField(QString("VTOLMotorN")); + Q_ASSERT(field); + m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString())); + field = obj->getField(QString("VTOLMotorNE")); + Q_ASSERT(field); + m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString())); + field = obj->getField(QString("VTOLMotorSE")); + Q_ASSERT(field); + m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString())); + field = obj->getField(QString("VTOLMotorS")); + Q_ASSERT(field); + m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString())); + field = obj->getField(QString("VTOLMotorSW")); + Q_ASSERT(field); + m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString())); } else if (frameType == "Octo") { // Motors 1 to 8 are N / NE / E / etc field = obj->getField(QString("VTOLMotorN")); @@ -402,6 +420,7 @@ void ConfigAirframeWidget::setupAirframeUI(QString frameType) m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor")); m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Quad X")); quad->setElementId("quad-X"); + m_aircraft->quadShape->setSceneRect(quad->boundingRect()); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->multiMotor5->setEnabled(false); m_aircraft->multiMotor6->setEnabled(false); @@ -411,6 +430,7 @@ void ConfigAirframeWidget::setupAirframeUI(QString frameType) m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor")); m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Quad +")); quad->setElementId("quad-plus"); + m_aircraft->quadShape->setSceneRect(quad->boundingRect()); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->multiMotor5->setEnabled(false); m_aircraft->multiMotor6->setEnabled(false); @@ -419,6 +439,9 @@ void ConfigAirframeWidget::setupAirframeUI(QString frameType) } else if (frameType == "Hexa" || frameType == "Hexacopter") { m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor")); m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Hexacopter")); + quad->setElementId("quad-hexa"); + m_aircraft->quadShape->setSceneRect(quad->boundingRect()); + m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->multiMotor5->setEnabled(true); m_aircraft->multiMotor6->setEnabled(true); m_aircraft->multiMotor7->setEnabled(false); @@ -426,6 +449,9 @@ void ConfigAirframeWidget::setupAirframeUI(QString frameType) } else if (frameType == "Octo" || frameType == "Octocopter") { m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor")); m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Octocopter")); + quad->setElementId("quad-octo"); + m_aircraft->quadShape->setSceneRect(quad->boundingRect()); + m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->multiMotor5->setEnabled(true); m_aircraft->multiMotor6->setEnabled(true); m_aircraft->multiMotor7->setEnabled(true); diff --git a/ground/src/plugins/config/images/quad-shapes.svg b/ground/src/plugins/config/images/quad-shapes.svg index 453152aff..5b5a3035e 100644 --- a/ground/src/plugins/config/images/quad-shapes.svg +++ b/ground/src/plugins/config/images/quad-shapes.svg @@ -32,9 +32,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.979899" - inkscape:cx="400.42368" - inkscape:cy="914.60167" + inkscape:zoom="0.9899495" + inkscape:cx="338.04953" + inkscape:cy="818.03268" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -53,7 +53,7 @@ id="guide2927" /> + + @@ -80,7 +88,7 @@ image/svg+xml - + @@ -269,16 +277,17 @@ + inkscape:label="#g4034" + transform="translate(-16,0)"> + + + + + + 1 + + + + + + + + + 5 + + + + + + + + + + 7 + + + + + + + + + 3 + + + + + + 8 + + + + + + + + 4 + + + + + + + + 6 + + + + + + + + 2 + + + + + + + + + 1 + + + + + + + + + 4 + + + + + + + + + 6 + + + + + + + + 3 + + + + + + + + 5 + + + + + + + + 2 + + + +