diff --git a/src/Waypoint.cc b/src/Waypoint.cc index 7901330b9a561a8350596491f2db95f510ccb9c5..07a4f6f2b6d487eecab4ac1569c7110a29d0a47f 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -100,6 +100,11 @@ void Waypoint::setYaw(float yaw) this->yaw = yaw; } +void Waypoint::setType(type_enum type) +{ + this->type = type; +} + void Waypoint::setAutocontinue(bool autoContinue) { this->autocontinue = autoContinue; diff --git a/src/Waypoint.h b/src/Waypoint.h index 8e8f40025aa81d307354fc2e07fd439611b37966..777e78488ed7478f42d88bfe44cfc76cd3bfe0af 100644 --- a/src/Waypoint.h +++ b/src/Waypoint.h @@ -36,6 +36,7 @@ This file is part of the PIXHAWK project #include #include #include +#include class Waypoint : public QObject { @@ -58,6 +59,14 @@ public: void save(QTextStream &saveStream); bool load(QTextStream &loadStream); + enum type_enum + { + GLOBAL = 0, + LOCAL = 1, + GLOBAL_ORBIT = 2, + LOCAL_ORBIT = 3 + }; + protected: quint16 id; @@ -65,6 +74,7 @@ protected: float y; float z; float yaw; + type_enum type; bool autocontinue; bool current; float orbit; @@ -76,6 +86,7 @@ public slots: void setY(float y); void setZ(float z); void setYaw(float yaw); + void setType(type_enum type); void setAutocontinue(bool autoContinue); void setCurrent(bool current); void setOrbit(float orbit); diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 928b0d9046bf90c401d23634520af2011a94238f..48efbcf040cd5d9bca0e246c2e542b63dc4f3a57 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -175,6 +175,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) getStatusForCode((int)state.status, uasState, stateDescription); emit statusChanged(this, uasState, stateDescription); emit statusChanged(this->status); + emit loadChanged(this,state.load/10.0f); + emit UAS::valueChanged(this, "Load", ((float)state.load)/1000.0f, MG::TIME::getGroundTimeNow()); stateAudio = " changed status to " + uasState; } diff --git a/src/ui/WaypointGlobalView.cc b/src/ui/WaypointGlobalView.cc index 44a9202f0d5a45a0537ae22ff7e0d3790cf4d519..e5e468ff30d82fa87d60bbf526165a964cb11da3 100644 --- a/src/ui/WaypointGlobalView.cc +++ b/src/ui/WaypointGlobalView.cc @@ -12,6 +12,9 @@ WaypointGlobalView::WaypointGlobalView(Waypoint* wp,QWidget *parent) : ui->m_orbitalSpinBox->hide(); + // set type + wp->setType(Waypoint::GLOBAL); + // Read values and set user interface updateValues(); @@ -197,11 +200,13 @@ void WaypointGlobalView::changeOrbitalState(int state) { ui->m_orbitalSpinBox->setEnabled(true); ui->m_orbitalSpinBox->show(); + wp->setType(Waypoint::GLOBAL_ORBIT); } else { ui->m_orbitalSpinBox->setEnabled(false); ui->m_orbitalSpinBox->hide(); + wp->setType(Waypoint::GLOBAL); } } diff --git a/src/ui/WaypointView.cc b/src/ui/WaypointView.cc index 13c772e2336a79c1a4fe8423da38b2ebba5d3072..4e9ee95db7d2ff5454cbee3172f6c98bd31285af 100644 --- a/src/ui/WaypointView.cc +++ b/src/ui/WaypointView.cc @@ -46,6 +46,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : m_ui->setupUi(this); this->wp = wp; + wp->setType(Waypoint::LOCAL); + m_ui->orbitSpinBox->setEnabled(false); + m_ui->orbitSpinBox->hide(); // Read values and set user interface updateValues(); @@ -64,6 +67,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : connect(m_ui->autoContinue, SIGNAL(stateChanged(int)), this, SLOT(changedAutoContinue(int))); connect(m_ui->selectedBox, SIGNAL(stateChanged(int)), this, SLOT(changedCurrent(int))); + connect(m_ui->orbitCheckBox, SIGNAL(stateChanged(int)), this, SLOT(changeOrbitalState(int))); + + connect(m_ui->orbitSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setOrbit(double))); connect(m_ui->holdTimeSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setHoldTime(int))); @@ -153,3 +159,21 @@ void WaypointView::changeEvent(QEvent *e) break; } } + +void WaypointView::changeOrbitalState(int state) +{ + Q_UNUSED(state); + + if(m_ui->orbitCheckBox->isChecked()) + { + m_ui->orbitSpinBox->setEnabled(true); + m_ui->orbitSpinBox->show(); + wp->setType(Waypoint::LOCAL_ORBIT); + } + else + { + m_ui->orbitSpinBox->setEnabled(false); + m_ui->orbitSpinBox->hide(); + wp->setType(Waypoint::LOCAL); + } +} diff --git a/src/ui/WaypointView.h b/src/ui/WaypointView.h index e293064d2c8270e3a4b90bdbeb206ec963cc766e..36710213596d2c0e26f914e63a512e7ae5269088 100644 --- a/src/ui/WaypointView.h +++ b/src/ui/WaypointView.h @@ -56,6 +56,7 @@ public slots: void moveDown(); void remove(); void changedAutoContinue(int); + void changeOrbitalState(int state); void changedCurrent(int); void updateValues(void); diff --git a/src/ui/WaypointView.ui b/src/ui/WaypointView.ui index ad3680fc77b5b74217f4be87610319893c11e467..4396337c09a5b3ca12524279cda980269b12aef5 100644 --- a/src/ui/WaypointView.ui +++ b/src/ui/WaypointView.ui @@ -6,8 +6,8 @@ 0 0 - 763 - 40 + 853 + 30 @@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar { - + 2 @@ -343,6 +343,16 @@ QProgressBar::chunk#thrustBar { + + + + enable orbital mode (loiter at waypoint) + + + + + +