Commit ff7f7242 authored by James Goppert's avatar James Goppert

Added waypoint types.

parent 375d5dcb
...@@ -100,6 +100,11 @@ void Waypoint::setYaw(float yaw) ...@@ -100,6 +100,11 @@ void Waypoint::setYaw(float yaw)
this->yaw = yaw; this->yaw = yaw;
} }
void Waypoint::setType(type_enum type)
{
this->type = type;
}
void Waypoint::setAutocontinue(bool autoContinue) void Waypoint::setAutocontinue(bool autoContinue)
{ {
this->autocontinue = autoContinue; this->autocontinue = autoContinue;
......
...@@ -36,6 +36,7 @@ This file is part of the PIXHAWK project ...@@ -36,6 +36,7 @@ This file is part of the PIXHAWK project
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <inttypes.h>
class Waypoint : public QObject class Waypoint : public QObject
{ {
...@@ -58,6 +59,14 @@ public: ...@@ -58,6 +59,14 @@ public:
void save(QTextStream &saveStream); void save(QTextStream &saveStream);
bool load(QTextStream &loadStream); bool load(QTextStream &loadStream);
enum type_enum
{
GLOBAL = 0,
LOCAL = 1,
GLOBAL_ORBIT = 2,
LOCAL_ORBIT = 3
};
protected: protected:
quint16 id; quint16 id;
...@@ -65,6 +74,7 @@ protected: ...@@ -65,6 +74,7 @@ protected:
float y; float y;
float z; float z;
float yaw; float yaw;
type_enum type;
bool autocontinue; bool autocontinue;
bool current; bool current;
float orbit; float orbit;
...@@ -76,6 +86,7 @@ public slots: ...@@ -76,6 +86,7 @@ public slots:
void setY(float y); void setY(float y);
void setZ(float z); void setZ(float z);
void setYaw(float yaw); void setYaw(float yaw);
void setType(type_enum type);
void setAutocontinue(bool autoContinue); void setAutocontinue(bool autoContinue);
void setCurrent(bool current); void setCurrent(bool current);
void setOrbit(float orbit); void setOrbit(float orbit);
......
...@@ -12,6 +12,9 @@ WaypointGlobalView::WaypointGlobalView(Waypoint* wp,QWidget *parent) : ...@@ -12,6 +12,9 @@ WaypointGlobalView::WaypointGlobalView(Waypoint* wp,QWidget *parent) :
ui->m_orbitalSpinBox->hide(); ui->m_orbitalSpinBox->hide();
// set type
wp->setType(Waypoint::GLOBAL);
// Read values and set user interface // Read values and set user interface
updateValues(); updateValues();
...@@ -197,11 +200,13 @@ void WaypointGlobalView::changeOrbitalState(int state) ...@@ -197,11 +200,13 @@ void WaypointGlobalView::changeOrbitalState(int state)
{ {
ui->m_orbitalSpinBox->setEnabled(true); ui->m_orbitalSpinBox->setEnabled(true);
ui->m_orbitalSpinBox->show(); ui->m_orbitalSpinBox->show();
wp->setType(Waypoint::GLOBAL_ORBIT);
} }
else else
{ {
ui->m_orbitalSpinBox->setEnabled(false); ui->m_orbitalSpinBox->setEnabled(false);
ui->m_orbitalSpinBox->hide(); ui->m_orbitalSpinBox->hide();
wp->setType(Waypoint::GLOBAL);
} }
} }
......
...@@ -46,6 +46,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -46,6 +46,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
m_ui->setupUi(this); m_ui->setupUi(this);
this->wp = wp; this->wp = wp;
wp->setType(Waypoint::LOCAL);
m_ui->orbitSpinBox->setEnabled(false);
m_ui->orbitSpinBox->hide();
// Read values and set user interface // Read values and set user interface
updateValues(); updateValues();
...@@ -64,6 +67,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -64,6 +67,9 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
connect(m_ui->autoContinue, SIGNAL(stateChanged(int)), this, SLOT(changedAutoContinue(int))); 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->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->orbitSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setOrbit(double)));
connect(m_ui->holdTimeSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setHoldTime(int))); connect(m_ui->holdTimeSpinBox, SIGNAL(valueChanged(int)), wp, SLOT(setHoldTime(int)));
...@@ -153,3 +159,21 @@ void WaypointView::changeEvent(QEvent *e) ...@@ -153,3 +159,21 @@ void WaypointView::changeEvent(QEvent *e)
break; 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);
}
}
...@@ -56,6 +56,7 @@ public slots: ...@@ -56,6 +56,7 @@ public slots:
void moveDown(); void moveDown();
void remove(); void remove();
void changedAutoContinue(int); void changedAutoContinue(int);
void changeOrbitalState(int state);
void changedCurrent(int); void changedCurrent(int);
void updateValues(void); void updateValues(void);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>763</width> <width>853</width>
<height>40</height> <height>30</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar { ...@@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar {
<property name="title"> <property name="title">
<string/> <string/>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>2</number>
</property> </property>
...@@ -343,6 +343,16 @@ QProgressBar::chunk#thrustBar { ...@@ -343,6 +343,16 @@ QProgressBar::chunk#thrustBar {
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="orbitCheckBox">
<property name="toolTip">
<string>enable orbital mode (loiter at waypoint)</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="upButton"> <widget class="QPushButton" name="upButton">
<property name="minimumSize"> <property name="minimumSize">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment