From 277b720048bce4aecffd7e1c2273607219e77041 Mon Sep 17 00:00:00 2001 From: pixhawk Date: Wed, 11 Jan 2012 17:36:32 +0100 Subject: [PATCH] Added "Onboard Waypoints"-support for all loiter commands --- src/ui/WaypointEditableView.cc | 3 +- src/ui/WaypointEditableView.h | 3 +- src/ui/WaypointEditableView.ui | 11 ++-- src/ui/WaypointViewOnlyView.cc | 104 +++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 10 deletions(-) diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index 73fdfb0d7..0d1c4f547 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -34,7 +34,6 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : // CUSTOM COMMAND WIDGET customCommand->setupUi(m_ui->customActionWidget); - // add actions m_ui->comboBox_action->addItem(tr("NAV: Waypoint"),MAV_CMD_NAV_WAYPOINT); m_ui->comboBox_action->addItem(tr("NAV: TakeOff"),MAV_CMD_NAV_TAKEOFF); @@ -43,7 +42,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : m_ui->comboBox_action->addItem(tr("NAV: Loiter Turns"),MAV_CMD_NAV_LOITER_TURNS); m_ui->comboBox_action->addItem(tr("NAV: Ret. to Launch"),MAV_CMD_NAV_RETURN_TO_LAUNCH); m_ui->comboBox_action->addItem(tr("NAV: Land"),MAV_CMD_NAV_LAND); -// m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET); + //m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET); //m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY); //m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW); //m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP); diff --git a/src/ui/WaypointEditableView.h b/src/ui/WaypointEditableView.h index d2b6c3322..096559cf5 100644 --- a/src/ui/WaypointEditableView.h +++ b/src/ui/WaypointEditableView.h @@ -49,7 +49,6 @@ namespace Ui class WaypointEditableView; } class Ui_QGCCustomWaypointAction; - class WaypointEditableView : public QWidget { Q_OBJECT @@ -83,7 +82,7 @@ protected: Waypoint* wp; // Special widgets extendending the // waypoint view to mission capabilities - Ui_QGCCustomWaypointAction* customCommand; + Ui_QGCCustomWaypointAction* customCommand; QGC_WAYPOINTEDITABLEVIEW_MODE viewMode; private: diff --git a/src/ui/WaypointEditableView.ui b/src/ui/WaypointEditableView.ui index 5ba5bb569..29ed36fb2 100644 --- a/src/ui/WaypointEditableView.ui +++ b/src/ui/WaypointEditableView.ui @@ -465,16 +465,16 @@ QPushButton:pressed { Qt::StrongFocus - Loiter radius + Loiter radius. Negative for counter-clockwise - Loiter radius + Loiter radius. Negative for counter-clockwise m - 0.050000000000000 + -5000.000000000000000 5000.000000000000000 @@ -519,11 +519,10 @@ where to accept this waypoint as reached - Rotaty wing and ground vehicles only: -Time to stay at this position before advancing + Time to stay/loiter at this position before advancing - Rotaty wing and ground vehicles only: Time to stay at this position before advancing + Time to stay/loiter at this position before advancing s diff --git a/src/ui/WaypointViewOnlyView.cc b/src/ui/WaypointViewOnlyView.cc index 8e51ec267..1dd9968e9 100644 --- a/src/ui/WaypointViewOnlyView.cc +++ b/src/ui/WaypointViewOnlyView.cc @@ -209,6 +209,110 @@ void WaypointViewOnlyView::updateValues() } //end Frame switch break; } + case MAV_CMD_NAV_LOITER_UNLIM: + { + switch (wp->getFrame()) + { + case MAV_FRAME_GLOBAL_RELATIVE_ALT: + case MAV_FRAME_GLOBAL: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there indefinitely (clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(wp->getParam3())); + } + else + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there indefinitely (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3())); + } + break; + } + case MAV_FRAME_LOCAL_NED: + default: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there indefinitely (clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f',2).arg(wp->getParam3())); + } + else + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there indefinitely (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3())); + } + break; + } + } //end Frame switch + break; + } + case MAV_CMD_NAV_LOITER_TURNS: + { + switch (wp->getFrame()) + { + case MAV_FRAME_GLOBAL_RELATIVE_ALT: + case MAV_FRAME_GLOBAL: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there for %5 turns (clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(wp->getParam3()).arg(wp->getParam1())); + } + else + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there for %5 turns (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3()).arg(wp->getParam1())); + } + break; + } + case MAV_FRAME_LOCAL_NED: + default: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there for %5 turns (clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f',2).arg(wp->getParam3()).arg(wp->getParam1())); + } + else + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there for %5 turns (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3()).arg(wp->getParam1())); + } + break; + } + } //end Frame switch + break; + } + case MAV_CMD_NAV_LOITER_TIME: + { + switch (wp->getFrame()) + { + case MAV_FRAME_GLOBAL_RELATIVE_ALT: + case MAV_FRAME_GLOBAL: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there for %5s (clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(wp->getParam3()).arg(wp->getParam1())); + } + else + { + m_ui->displayBar->setText(QString("Go to (lat %1o, lon %2o, alt %3) and loiter there for %5s (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 7).arg(wp->getY(),0, 'f', 7).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3()).arg(wp->getParam1())); + } + break; + } + case MAV_FRAME_LOCAL_NED: + default: + { + if (wp->getParam3()>=0) + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there for %5s (clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f',2).arg(wp->getParam3()).arg(wp->getParam1())); + } + else + { + m_ui->displayBar->setText(QString("Go to (%1, %2, %3) and loiter there for %5s (counter-clockwise); rad: %4").arg(wp->getX(),0, 'f', 2).arg(wp->getY(),0, 'f', 2).arg(wp->getZ(),0, 'f', 2).arg(-wp->getParam3()).arg(wp->getParam1())); + } + break; + } + } //end Frame switch + break; + } + case MAV_CMD_NAV_RETURN_TO_LAUNCH: + { + m_ui->displayBar->setText(QString("Return to launch location")); + break; + } case MAV_CMD_NAV_LAND: { switch (wp->getFrame()) -- 2.22.0