Commit ff7f7242 authored by James Goppert's avatar James Goppert

Added waypoint types.

parent 375d5dcb
......@@ -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;
......
......@@ -36,6 +36,7 @@ This file is part of the PIXHAWK project
#include <QObject>
#include <QString>
#include <QTextStream>
#include <inttypes.h>
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);
......
......@@ -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);
}
}
......
......@@ -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);
}
}
......@@ -56,6 +56,7 @@ public slots:
void moveDown();
void remove();
void changedAutoContinue(int);
void changeOrbitalState(int state);
void changedCurrent(int);
void updateValues(void);
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>763</width>
<height>40</height>
<width>853</width>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar {
<property name="title">
<string/>
</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">
<number>2</number>
</property>
......@@ -343,6 +343,16 @@ QProgressBar::chunk#thrustBar {
</property>
</widget>
</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>
<widget class="QPushButton" name="upButton">
<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