Commit 94947491 authored by pixhawk's avatar pixhawk

Fixed last wp issue

parent 247042fd
...@@ -140,7 +140,6 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -140,7 +140,6 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCPxImuFirmwareUpdate.ui \ src/ui/QGCPxImuFirmwareUpdate.ui \
src/ui/QGCDataPlot2D.ui \ src/ui/QGCDataPlot2D.ui \
src/ui/QGCRemoteControlView.ui \ src/ui/QGCRemoteControlView.ui \
src/ui/WaypointGlobalView.ui \
src/ui/QMap3D.ui \ src/ui/QMap3D.ui \
src/ui/QGCWebView.ui \ src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \ src/ui/map3D/QGCGoogleEarthView.ui \
......
...@@ -32,7 +32,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -32,7 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include "Waypoint.h" #include "Waypoint.h"
#include <QStringList> #include <QStringList>
Waypoint::Waypoint(quint16 _id, float _x, float _y, float _z, float _yaw, bool _autocontinue, bool _current, float _orbit, int _holdTime, MAV_FRAME _frame, MAV_ACTION _action) Waypoint::Waypoint(quint16 _id, double _x, double _y, double _z, double _yaw, bool _autocontinue, bool _current, double _orbit, int _holdTime, MAV_FRAME _frame, MAV_ACTION _action)
: id(_id), : id(_id),
x(_x), x(_x),
y(_y), y(_y),
...@@ -94,7 +94,7 @@ void Waypoint::setId(quint16 id) ...@@ -94,7 +94,7 @@ void Waypoint::setId(quint16 id)
emit changed(this); emit changed(this);
} }
void Waypoint::setX(float x) void Waypoint::setX(double x)
{ {
if (this->x != x) if (this->x != x)
{ {
...@@ -103,7 +103,7 @@ void Waypoint::setX(float x) ...@@ -103,7 +103,7 @@ void Waypoint::setX(float x)
} }
} }
void Waypoint::setY(float y) void Waypoint::setY(double y)
{ {
if (this->y != y) if (this->y != y)
{ {
...@@ -112,7 +112,7 @@ void Waypoint::setY(float y) ...@@ -112,7 +112,7 @@ void Waypoint::setY(float y)
} }
} }
void Waypoint::setZ(float z) void Waypoint::setZ(double z)
{ {
if (this->z != z) if (this->z != z)
{ {
...@@ -121,7 +121,7 @@ void Waypoint::setZ(float z) ...@@ -121,7 +121,7 @@ void Waypoint::setZ(float z)
} }
} }
void Waypoint::setYaw(float yaw) void Waypoint::setYaw(double yaw)
{ {
if (this->yaw != yaw) if (this->yaw != yaw)
{ {
...@@ -166,7 +166,7 @@ void Waypoint::setCurrent(bool current) ...@@ -166,7 +166,7 @@ void Waypoint::setCurrent(bool current)
} }
} }
void Waypoint::setOrbit(float orbit) void Waypoint::setOrbit(double orbit)
{ {
if (this->orbit != orbit) if (this->orbit != orbit)
{ {
...@@ -184,47 +184,47 @@ void Waypoint::setHoldTime(int holdTime) ...@@ -184,47 +184,47 @@ void Waypoint::setHoldTime(int holdTime)
} }
} }
void Waypoint::setX(double x) //void Waypoint::setX(double x)
{ //{
if (this->x != static_cast<float>(x)) // if (this->x != static_cast<double>(x))
{ // {
this->x = x; // this->x = x;
emit changed(this); // emit changed(this);
} // }
} //}
void Waypoint::setY(double y) //void Waypoint::setY(double y)
{ //{
if (this->y != static_cast<float>(y)) // if (this->y != static_cast<double>(y))
{ // {
this->y = y; // this->y = y;
emit changed(this); // emit changed(this);
} // }
} //}
void Waypoint::setZ(double z) //void Waypoint::setZ(double z)
{ //{
if (this->z != static_cast<float>(z)) // if (this->z != static_cast<double>(z))
{ // {
this->z = z; // this->z = z;
emit changed(this); // emit changed(this);
} // }
} //}
void Waypoint::setYaw(double yaw) //void Waypoint::setYaw(double yaw)
{ //{
if (this->yaw != static_cast<float>(yaw)) // if (this->yaw != static_cast<double>(yaw))
{ // {
this->yaw = yaw; // this->yaw = yaw;
emit changed(this); // emit changed(this);
} // }
} //}
void Waypoint::setOrbit(double orbit) //void Waypoint::setOrbit(double orbit)
{ //{
if (this->orbit != static_cast<float>(orbit)) // if (this->orbit != static_cast<double>(orbit))
{ // {
this->orbit = orbit; // this->orbit = orbit;
emit changed(this); // emit changed(this);
} // }
} //}
...@@ -43,20 +43,20 @@ class Waypoint : public QObject ...@@ -43,20 +43,20 @@ class Waypoint : public QObject
Q_OBJECT Q_OBJECT
public: public:
Waypoint(quint16 id = 0, float x = 0.0f, float y = 0.0f, float z = 0.0f, float yaw = 0.0f, bool autocontinue = false, Waypoint(quint16 id = 0, double x = 0.0f, double y = 0.0f, double z = 0.0f, double yaw = 0.0f, bool autocontinue = false,
bool current = false, float orbit = 0.15f, int holdTime = 0, bool current = false, double orbit = 0.15f, int holdTime = 0,
MAV_FRAME frame=MAV_FRAME_GLOBAL, MAV_ACTION action=MAV_ACTION_NAVIGATE); MAV_FRAME frame=MAV_FRAME_GLOBAL, MAV_ACTION action=MAV_ACTION_NAVIGATE);
~Waypoint(); ~Waypoint();
quint16 getId() const { return id; } quint16 getId() const { return id; }
float getX() const { return x; } double getX() const { return x; }
float getY() const { return y; } double getY() const { return y; }
float getZ() const { return z; } double getZ() const { return z; }
float getYaw() const { return yaw; } double getYaw() const { return yaw; }
bool getAutoContinue() const { return autocontinue; } bool getAutoContinue() const { return autocontinue; }
bool getCurrent() const { return current; } bool getCurrent() const { return current; }
float getOrbit() const { return orbit; } double getOrbit() const { return orbit; }
float getHoldTime() const { return holdTime; } double getHoldTime() const { return holdTime; }
MAV_FRAME getFrame() const { return frame; } MAV_FRAME getFrame() const { return frame; }
MAV_ACTION getAction() const { return action; } MAV_ACTION getAction() const { return action; }
const QString& getName() const { return name; } const QString& getName() const { return name; }
...@@ -67,38 +67,38 @@ public: ...@@ -67,38 +67,38 @@ public:
protected: protected:
quint16 id; quint16 id;
float x; double x;
float y; double y;
float z; double z;
float yaw; double yaw;
MAV_FRAME frame; MAV_FRAME frame;
MAV_ACTION action; MAV_ACTION action;
bool autocontinue; bool autocontinue;
bool current; bool current;
float orbit; double orbit;
int holdTime; int holdTime;
QString name; QString name;
public slots: public slots:
void setId(quint16 id); void setId(quint16 id);
void setX(float x); void setX(double x);
void setY(float y); void setY(double y);
void setZ(float z); void setZ(double z);
void setYaw(float yaw); void setYaw(double yaw);
void setAction(MAV_ACTION action); void setAction(MAV_ACTION action);
void setFrame(MAV_FRAME frame); void setFrame(MAV_FRAME frame);
void setAutocontinue(bool autoContinue); void setAutocontinue(bool autoContinue);
void setCurrent(bool current); void setCurrent(bool current);
void setOrbit(float orbit); void setOrbit(double orbit);
void setHoldTime(int holdTime); void setHoldTime(int holdTime);
//for QDoubleSpin // //for QDoubleSpin
void setX(double x); // void setX(double x);
void setY(double y); // void setY(double y);
void setZ(double z); // void setZ(double z);
void setYaw(double yaw); // void setYaw(double yaw);
void setOrbit(double orbit); // void setOrbit(double orbit);
signals: signals:
/** @brief Announces a change to the waypoint data */ /** @brief Announces a change to the waypoint data */
......
...@@ -930,6 +930,7 @@ void MapWidget::changeEvent(QEvent *e) ...@@ -930,6 +930,7 @@ void MapWidget::changeEvent(QEvent *e)
void MapWidget::clearWaypoints(int uas) void MapWidget::clearWaypoints(int uas)
{ {
Q_UNUSED(uas);
// Clear the previous WP track // Clear the previous WP track
//mc->layer("Waypoints")->clearGeometries(); //mc->layer("Waypoints")->clearGeometries();
...@@ -962,6 +963,7 @@ void MapWidget::clearWaypoints(int uas) ...@@ -962,6 +963,7 @@ void MapWidget::clearWaypoints(int uas)
void MapWidget::clearPath(int uas) void MapWidget::clearPath(int uas)
{ {
Q_UNUSED(uas);
mc->layer("Tracking")->clearGeometries(); mc->layer("Tracking")->clearGeometries();
foreach (qmapcontrol::LineString* ls, uasTrails) foreach (qmapcontrol::LineString* ls, uasTrails)
{ {
...@@ -976,6 +978,8 @@ void MapWidget::clearPath(int uas) ...@@ -976,6 +978,8 @@ void MapWidget::clearPath(int uas)
void MapWidget::updateCameraPosition(double radio, double bearing, QString dir) void MapWidget::updateCameraPosition(double radio, double bearing, QString dir)
{ {
Q_UNUSED(dir);
Q_UNUSED(bearing);
// FIXME Mariano // FIXME Mariano
//camPoints.clear(); //camPoints.clear();
QPointF currentPos = mc->currentCoordinate(); QPointF currentPos = mc->currentCoordinate();
......
/*===================================================================== /*===================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
(c) 2009, 2010 PIXHAWK PROJECT <http://pixhawk.ethz.ch>
This file is part of the PIXHAWK project
PIXHAWK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PIXHAWK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PIXHAWK. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
...@@ -159,14 +139,6 @@ void WaypointView::changedAction(int index) ...@@ -159,14 +139,6 @@ void WaypointView::changedAction(int index)
void WaypointView::changedFrame(int index) void WaypointView::changedFrame(int index)
{ {
// hide everything to start
m_ui->lonSpinBox->hide();
m_ui->latSpinBox->hide();
m_ui->altSpinBox->hide();
m_ui->posNSpinBox->hide();
m_ui->posESpinBox->hide();
m_ui->posDSpinBox->hide();
// set waypoint action // set waypoint action
MAV_FRAME frame = (MAV_FRAME)m_ui->comboBox_frame->itemData(index).toUInt(); MAV_FRAME frame = (MAV_FRAME)m_ui->comboBox_frame->itemData(index).toUInt();
wp->setFrame(frame); wp->setFrame(frame);
...@@ -174,11 +146,17 @@ void WaypointView::changedFrame(int index) ...@@ -174,11 +146,17 @@ void WaypointView::changedFrame(int index)
switch(frame) switch(frame)
{ {
case MAV_FRAME_GLOBAL: case MAV_FRAME_GLOBAL:
m_ui->posNSpinBox->hide();
m_ui->posESpinBox->hide();
m_ui->posDSpinBox->hide();
m_ui->lonSpinBox->show(); m_ui->lonSpinBox->show();
m_ui->latSpinBox->show(); m_ui->latSpinBox->show();
m_ui->altSpinBox->show(); m_ui->altSpinBox->show();
break; break;
case MAV_FRAME_LOCAL: case MAV_FRAME_LOCAL:
m_ui->lonSpinBox->hide();
m_ui->latSpinBox->hide();
m_ui->altSpinBox->hide();
m_ui->posNSpinBox->show(); m_ui->posNSpinBox->show();
m_ui->posESpinBox->show(); m_ui->posESpinBox->show();
m_ui->posDSpinBox->show(); m_ui->posDSpinBox->show();
...@@ -217,14 +195,36 @@ void WaypointView::updateValues() ...@@ -217,14 +195,36 @@ void WaypointView::updateValues()
switch(frame) switch(frame)
{ {
case(MAV_FRAME_LOCAL): case(MAV_FRAME_LOCAL):
{
if (m_ui->posNSpinBox->value() != wp->getX())
{
m_ui->posNSpinBox->setValue(wp->getX()); m_ui->posNSpinBox->setValue(wp->getX());
}
if (m_ui->posESpinBox->value() != wp->getY())
{
m_ui->posESpinBox->setValue(wp->getY()); m_ui->posESpinBox->setValue(wp->getY());
}
if (m_ui->posDSpinBox->value() != wp->getZ())
{
m_ui->posDSpinBox->setValue(wp->getZ()); m_ui->posDSpinBox->setValue(wp->getZ());
}
}
break; break;
case(MAV_FRAME_GLOBAL): case(MAV_FRAME_GLOBAL):
{
if (m_ui->lonSpinBox->value() != wp->getX())
{
m_ui->lonSpinBox->setValue(wp->getX()); m_ui->lonSpinBox->setValue(wp->getX());
}
if (m_ui->latSpinBox->value() != wp->getY())
{
m_ui->latSpinBox->setValue(wp->getY()); m_ui->latSpinBox->setValue(wp->getY());
}
if (m_ui->altSpinBox->value() != wp->getZ())
{
m_ui->altSpinBox->setValue(wp->getZ()); m_ui->altSpinBox->setValue(wp->getZ());
}
}
break; break;
} }
changedFrame(frame_index); changedFrame(frame_index);
...@@ -232,7 +232,10 @@ void WaypointView::updateValues() ...@@ -232,7 +232,10 @@ void WaypointView::updateValues()
// update action // update action
MAV_ACTION action = wp->getAction(); MAV_ACTION action = wp->getAction();
int action_index = m_ui->comboBox_action->findData(action); int action_index = m_ui->comboBox_action->findData(action);
if (m_ui->comboBox_action->currentIndex() != action_index)
{
m_ui->comboBox_action->setCurrentIndex(action_index); m_ui->comboBox_action->setCurrentIndex(action_index);
}
switch(action) switch(action)
{ {
case MAV_ACTION_TAKEOFF: case MAV_ACTION_TAKEOFF:
...@@ -248,12 +251,21 @@ void WaypointView::updateValues() ...@@ -248,12 +251,21 @@ void WaypointView::updateValues()
} }
changedAction(action_index); changedAction(action_index);
if (m_ui->yawSpinBox->value() != wp->getYaw()/M_PI*180.)
{
m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.); m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.);
}
m_ui->selectedBox->setChecked(wp->getCurrent()); m_ui->selectedBox->setChecked(wp->getCurrent());
m_ui->autoContinue->setChecked(wp->getAutoContinue()); m_ui->autoContinue->setChecked(wp->getAutoContinue());
m_ui->idLabel->setText(QString("%1").arg(wp->getId()));\ m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
if (m_ui->orbitSpinBox->value() != wp->getOrbit())
{
m_ui->orbitSpinBox->setValue(wp->getOrbit()); m_ui->orbitSpinBox->setValue(wp->getOrbit());
}
if (m_ui->holdTimeSpinBox->value() != wp->getHoldTime())
{
m_ui->holdTimeSpinBox->setValue(wp->getHoldTime()); m_ui->holdTimeSpinBox->setValue(wp->getHoldTime());
}
wp->blockSignals(false); wp->blockSignals(false);
} }
......
...@@ -170,6 +170,9 @@ QProgressBar::chunk#thrustBar { ...@@ -170,6 +170,9 @@ QProgressBar::chunk#thrustBar {
</property> </property>
<item> <item>
<widget class="QCheckBox" name="selectedBox"> <widget class="QCheckBox" name="selectedBox">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Currently selected waypoint</string> <string>Currently selected waypoint</string>
</property> </property>
...@@ -231,12 +234,21 @@ QProgressBar::chunk#thrustBar { ...@@ -231,12 +234,21 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Position X coordinate</string> <string>Position X coordinate</string>
</property> </property>
<property name="wrapping"> <property name="wrapping">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="frame">
<bool>true</bool>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="prefix"> <property name="prefix">
<string>N </string> <string>N </string>
</property> </property>
...@@ -262,6 +274,9 @@ QProgressBar::chunk#thrustBar { ...@@ -262,6 +274,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Position Y coordinate</string> <string>Position Y coordinate</string>
</property> </property>
...@@ -293,6 +308,9 @@ QProgressBar::chunk#thrustBar { ...@@ -293,6 +308,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Position Z coordinate (negative)</string> <string>Position Z coordinate (negative)</string>
</property> </property>
...@@ -321,6 +339,9 @@ QProgressBar::chunk#thrustBar { ...@@ -321,6 +339,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="prefix"> <property name="prefix">
<string>lat </string> <string>lat </string>
</property> </property>
...@@ -349,6 +370,9 @@ QProgressBar::chunk#thrustBar { ...@@ -349,6 +370,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="prefix"> <property name="prefix">
<string>lon </string> <string>lon </string>
</property> </property>
...@@ -402,6 +426,9 @@ QProgressBar::chunk#thrustBar { ...@@ -402,6 +426,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Yaw angle</string> <string>Yaw angle</string>
</property> </property>
...@@ -430,6 +457,9 @@ QProgressBar::chunk#thrustBar { ...@@ -430,6 +457,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Orbit radius</string> <string>Orbit radius</string>
</property> </property>
...@@ -458,6 +488,9 @@ QProgressBar::chunk#thrustBar { ...@@ -458,6 +488,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Time in milliseconds that the MAV has to stay inside the orbit before advancing</string> <string>Time in milliseconds that the MAV has to stay inside the orbit before advancing</string>
</property> </property>
...@@ -486,6 +519,9 @@ QProgressBar::chunk#thrustBar { ...@@ -486,6 +519,9 @@ QProgressBar::chunk#thrustBar {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Take off angle</string> <string>Take off angle</string>
</property> </property>
...@@ -515,6 +551,9 @@ QProgressBar::chunk#thrustBar { ...@@ -515,6 +551,9 @@ QProgressBar::chunk#thrustBar {
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Move Up</string> <string>Move Up</string>
</property> </property>
...@@ -535,6 +574,9 @@ QProgressBar::chunk#thrustBar { ...@@ -535,6 +574,9 @@ QProgressBar::chunk#thrustBar {
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Move Down</string> <string>Move Down</string>
</property> </property>
...@@ -555,6 +597,9 @@ QProgressBar::chunk#thrustBar { ...@@ -555,6 +597,9 @@ QProgressBar::chunk#thrustBar {
<height>22</height> <height>22</height>
</size> </size>
</property> </property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Delete</string> <string>Delete</string>
</property> </property>
......
...@@ -57,6 +57,7 @@ void MAV2DIcon::setYaw(float yaw) ...@@ -57,6 +57,7 @@ void MAV2DIcon::setYaw(float yaw)
void MAV2DIcon::drawIcon(QPen* pen) void MAV2DIcon::drawIcon(QPen* pen)
{ {
Q_UNUSED(pen);
switch (type) switch (type)
{ {
case MAV_ICON_GENERIC: case MAV_ICON_GENERIC:
......
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