Commit d39079b9 authored by hengli's avatar hengli

Merge branch 'dev' of pixhawk.ethz.ch:qgroundcontrol into dev

parents 17cb2805 efc0e3c6
...@@ -26,3 +26,4 @@ deploy/mac ...@@ -26,3 +26,4 @@ deploy/mac
deploy/linux deploy/linux
controller_log* controller_log*
user_config.pri user_config.pri
*.app
...@@ -65,7 +65,7 @@ macx { ...@@ -65,7 +65,7 @@ macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
DESTDIR = $$BASEDIR/bin/mac #DESTDIR = $$BASEDIR/bin/mac
INCLUDEPATH += -framework SDL INCLUDEPATH += -framework SDL
LIBS += -framework IOKit \ LIBS += -framework IOKit \
...@@ -77,11 +77,11 @@ macx { ...@@ -77,11 +77,11 @@ macx {
ICON = $$BASEDIR/images/icons/macx.icns ICON = $$BASEDIR/images/icons/macx.icns
# Copy audio files if needed # Copy audio files if needed
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacOs/.
# Copy google earth starter file # Copy google earth starter file
QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOs/.
# Copy model files # Copy model files
QMAKE_PRE_LINK += && cp -f $$BASEDIR/models/*.skp $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. #QMAKE_PRE_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs/.
exists(/Library/Frameworks/osg.framework):exists(/Library/Frameworks/OpenThreads.framework) { exists(/Library/Frameworks/osg.framework):exists(/Library/Frameworks/OpenThreads.framework) {
# No check for GLUT.framework since it's a MAC default # No check for GLUT.framework since it's a MAC default
...@@ -146,12 +146,12 @@ macx { ...@@ -146,12 +146,12 @@ macx {
linux-g++ { linux-g++ {
debug { debug {
DESTDIR = $$BUILDDIR/debug #DESTDIR = $$BUILDDIR/debug
CONFIG += debug CONFIG += debug
} }
release { release {
DESTDIR = $$BUILDDIR/release #DESTDIR = $$BUILDDIR/release
} }
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...@@ -178,7 +178,8 @@ linux-g++ { ...@@ -178,7 +178,8 @@ linux-g++ {
message("Building support for OpenSceneGraph") message("Building support for OpenSceneGraph")
DEPENDENCIES_PRESENT += osg DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries # Include OpenSceneGraph libraries
LIBS += -losg LIBS += -losg \
-losgViewer
DEFINES += QGC_OSG_ENABLED DEFINES += QGC_OSG_ENABLED
} }
...@@ -186,8 +187,7 @@ linux-g++ { ...@@ -186,8 +187,7 @@ linux-g++ {
message("Building support for osgEarth") message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries # Include osgEarth libraries
LIBS += -losgViewer \ LIBS += -losgEarth \
-losgEarth \
-losgEarthUtil -losgEarthUtil
DEFINES += QGC_OSGEARTH_ENABLED DEFINES += QGC_OSGEARTH_ENABLED
} }
...@@ -214,12 +214,12 @@ linux-g++ { ...@@ -214,12 +214,12 @@ linux-g++ {
linux-g++-64 { linux-g++-64 {
debug { debug {
DESTDIR = $$BUILDDIR/debug #DESTDIR = $$BUILDDIR/debug
CONFIG += debug CONFIG += debug
} }
release { release {
DESTDIR = $$BUILDDIR/release #DESTDIR = $$BUILDDIR/release
} }
QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/. QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...@@ -247,7 +247,8 @@ linux-g++-64 { ...@@ -247,7 +247,8 @@ linux-g++-64 {
message("Building support for OpenSceneGraph") message("Building support for OpenSceneGraph")
DEPENDENCIES_PRESENT += osg DEPENDENCIES_PRESENT += osg
# Include OpenSceneGraph libraries # Include OpenSceneGraph libraries
LIBS += -losg LIBS += -losg \
-losgViewer
DEFINES += QGC_OSG_ENABLED DEFINES += QGC_OSG_ENABLED
} }
...@@ -255,8 +256,7 @@ linux-g++-64 { ...@@ -255,8 +256,7 @@ linux-g++-64 {
message("Building support for osgEarth") message("Building support for osgEarth")
DEPENDENCIES_PRESENT += osgearth DEPENDENCIES_PRESENT += osgearth
# Include osgEarth libraries # Include osgEarth libraries
LIBS += -losgViewer \ LIBS += -losgEarth \
-losgEarth \
-losgEarthUtil -losgEarthUtil
DEFINES += QGC_OSGEARTH_ENABLED DEFINES += QGC_OSGEARTH_ENABLED
} }
...@@ -321,28 +321,19 @@ exists($$BASEDIR/lib/osgEarth123) { ...@@ -321,28 +321,19 @@ exists($$BASEDIR/lib/osgEarth123) {
RC_FILE = $$BASEDIR/qgroundcontrol.rc RC_FILE = $$BASEDIR/qgroundcontrol.rc
# Copy dependencies # Copy dependencies
QMAKE_PRE_LINK += && cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$TARGETDIR/debug/. BASEDIR_WIN = $$replace(BASEDIR,"/","\\")
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/debug/. TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/osg55-osg.dll $$TARGETDIR/release/. &&
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/osg55-osgViewer.dll $$TARGETDIR/release/. &&
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/osg55-osgGA.dll $$TARGETDIR/release/. &&
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/osg55-osgDB.dll $$TARGETDIR/release/. &&
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/osg55-osgText.dll $$TARGETDIR/release/. &&
#QMAKE_PRE_LINK += cp -f $$BASEDIR/lib/osgEarth_3rdparty/win32/OpenSceneGraph-2.8.2/bin/OpenThreads.dll $$TARGETDIR/release/. &&
QMAKE_PRE_LINK += && cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$TARGETDIR/release/. QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR_WIN\lib\sdl\win32\SDL.dll\" \"$$TARGETDIR_WIN\debug\SDL.dll\"
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/release/. QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR_WIN\lib\sdl\win32\SDL.dll\" \"$$TARGETDIR_WIN\release\SDL.dll\"
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/. QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\audio\" \"$$TARGETDIR_WIN\debug\audio\" /S /E /Y
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/. QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\audio\" \"$$TARGETDIR_WIN\release\audio\" /S /E /Y
QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\models\" \"$$TARGETDIR_WIN\debug\models\" /S /E /Y
# osg/osgEarth dynamic casts might fail without this compiler option. QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\models\" \"$$TARGETDIR_WIN\release\models\" /S /E /Y
# see http://osgearth.org/wiki/FAQ for details.
# Copy google earth starter file # Copy google earth starter file
QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/release/ QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR/images/earth.html $$TARGETDIR_WIN\release\"
QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/debug/ QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR/images/earth.html $$TARGETDIR_WIN\debug\"
} }
...@@ -364,27 +355,25 @@ win32-g++ { ...@@ -364,27 +355,25 @@ win32-g++ {
debug { debug {
DESTDIR = $$BUILDDIR/debug #DESTDIR = $$BUILDDIR/debug
} }
release { release {
DESTDIR = $$BUILDDIR/release #DESTDIR = $$BUILDDIR/release
} }
RC_FILE = $$BASEDIR/qgroundcontrol.rc RC_FILE = $$BASEDIR/qgroundcontrol.rc
# Copy dependencies # Copy dependencies
debug { BASEDIR_WIN = $$replace(BASEDIR,"/","\\")
QMAKE_PRE_LINK += && cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$BUILDDIR/debug/. TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/debug/.
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/. QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR_WIN\lib\sdl\win32\SDL.dll\" \"$$TARGETDIR_WIN\debug\SDL.dll\"
} QMAKE_PRE_LINK += && copy /Y \"$$BASEDIR_WIN\lib\sdl\win32\SDL.dll\" \"$$TARGETDIR_WIN\release\SDL.dll\"
QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\audio\" \"$$TARGETDIR_WIN\debug\audio\" /S /E /Y
release { QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\audio\" \"$$TARGETDIR_WIN\release\audio\" /S /E /Y
QMAKE_PRE_LINK += && cp -f $$BASEDIR/lib/sdl/win32/SDL.dll $$BUILDDIR/release/. QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\models\" \"$$TARGETDIR_WIN\debug\models\" /S /E /Y
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/release/. QMAKE_PRE_LINK += && xcopy \"$$BASEDIR_WIN\models\" \"$$TARGETDIR_WIN\release\models\" /S /E /Y
QMAKE_PRE_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/.
}
# osg/osgEarth dynamic casts might fail without this compiler option. # osg/osgEarth dynamic casts might fail without this compiler option.
# see http://osgearth.org/wiki/FAQ for details. # see http://osgearth.org/wiki/FAQ for details.
......
...@@ -33,8 +33,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -33,8 +33,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, 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)
MAV_FRAME _frame, MAV_ACTION _action)
: id(_id), : id(_id),
x(_x), x(_x),
y(_y), y(_y),
......
...@@ -347,7 +347,7 @@ void MAVLinkProtocol::sendHeartbeat() ...@@ -347,7 +347,7 @@ void MAVLinkProtocol::sendHeartbeat()
if (m_heartbeatsEnabled) if (m_heartbeatsEnabled)
{ {
mavlink_message_t beat; mavlink_message_t beat;
mavlink_msg_heartbeat_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID,&beat, OCU, MAV_AUTOPILOT_GENERIC); mavlink_msg_heartbeat_pack(getSystemId(), getComponentId(),&beat, OCU, MAV_AUTOPILOT_GENERIC);
sendMessage(beat); sendMessage(beat);
} }
} }
......
...@@ -421,6 +421,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -421,6 +421,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
} }
} }
break; break;
case MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET:
{
mavlink_gps_local_origin_set_t pos;
mavlink_msg_gps_local_origin_set_decode(&message, &pos);
// FIXME Emit to other components
}
break;
case MAVLINK_MSG_ID_RC_CHANNELS_RAW: case MAVLINK_MSG_ID_RC_CHANNELS_RAW:
{ {
mavlink_rc_channels_raw_t channels; mavlink_rc_channels_raw_t channels;
...@@ -657,6 +664,36 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -657,6 +664,36 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
} }
} }
void UAS::setLocalOriginAtCurrentGPSPosition()
{
bool result = false;
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText("Setting new World Coordinate Frame Origin");
msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
// Close the message box shortly after the click to prevent accidental clicks
QTimer::singleShot(5000, &msgBox, SLOT(reject()));
if (ret == QMessageBox::Yes)
{
mavlink_message_t msg;
mavlink_msg_action_pack(mavlink->getSystemId(), mavlink->getSystemId(), &msg, this->getUASID(), 0, MAV_ACTION_SET_ORIGIN);
// Send message twice to increase chance that it reaches its goal
sendMessage(msg);
// Wait 5 ms
MG::SLEEP::usleep(5000);
// Send again
sendMessage(msg);
result = true;
}
}
void UAS::setLocalPositionSetpoint(float x, float y, float z, float yaw) void UAS::setLocalPositionSetpoint(float x, float y, float z, float yaw)
{ {
#ifdef MAVLINK_ENABLED_PIXHAWK #ifdef MAVLINK_ENABLED_PIXHAWK
......
...@@ -243,6 +243,8 @@ public slots: ...@@ -243,6 +243,8 @@ public slots:
/** @brief Update the system state */ /** @brief Update the system state */
void updateState(); void updateState();
/** @brief Set world frame origin at current GPS position */
void setLocalOriginAtCurrentGPSPosition();
/** @brief Set local position setpoint */ /** @brief Set local position setpoint */
void setLocalPositionSetpoint(float x, float y, float z, float yaw); void setLocalPositionSetpoint(float x, float y, float z, float yaw);
/** @brief Add an offset in body frame to the setpoint */ /** @brief Add an offset in body frame to the setpoint */
......
...@@ -194,6 +194,8 @@ public slots: ...@@ -194,6 +194,8 @@ public slots:
//virtual void requestWaypoints() = 0; //virtual void requestWaypoints() = 0;
/** @brief Clear all existing waypoints on the robot */ /** @brief Clear all existing waypoints on the robot */
//virtual void clearWaypointList() = 0; //virtual void clearWaypointList() = 0;
/** @brief Set world frame origin at current GPS position */
virtual void setLocalOriginAtCurrentGPSPosition() = 0;
/** @brief Request all onboard parameters of all components */ /** @brief Request all onboard parameters of all components */
virtual void requestParameters() = 0; virtual void requestParameters() = 0;
/** @brief Write parameter to permanent storage */ /** @brief Write parameter to permanent storage */
......
...@@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ ...@@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
if(wp->seq == current_wp_id) if(wp->seq == current_wp_id)
{ {
Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2); qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->yaw << wp->autocontinue << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_ACTION) wp->action;
Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2, (MAV_FRAME) wp->frame, (MAV_ACTION) wp->action);
addWaypoint(lwp); addWaypoint(lwp);
//get next waypoint //get next waypoint
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>210</width> <width>328</width>
<height>130</height> <height>357</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" rowstretch="10,10,0,10,10,5,100" columnstretch="0,0,10,10,10,0"> <layout class="QGridLayout" name="gridLayout" rowstretch="10,10,0,10,10,10,10,100" columnstretch="0,10,5,5,10,0">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0" rowspan="6"> <item row="0" column="0" rowspan="7">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<widget class="QPushButton" name="liftoffButton"> <widget class="QPushButton" name="liftoffButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>60</width>
<height>12</height> <height>12</height>
</size> </size>
</property> </property>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<widget class="QPushButton" name="landButton"> <widget class="QPushButton" name="landButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>60</width>
<height>12</height> <height>12</height>
</size> </size>
</property> </property>
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<widget class="QPushButton" name="shutdownButton"> <widget class="QPushButton" name="shutdownButton">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>60</width>
<height>12</height> <height>12</height>
</size> </size>
</property> </property>
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5" rowspan="6"> <item row="0" column="5" rowspan="7">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1" colspan="4"> <item row="6" column="1" colspan="4">
<widget class="QLabel" name="lastActionLabel"> <widget class="QLabel" name="lastActionLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="6"> <item row="7" column="0" colspan="6">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
...@@ -210,6 +210,23 @@ ...@@ -210,6 +210,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="1" colspan="2">
<widget class="QPushButton" name="setHomeButton">
<property name="minimumSize">
<size>
<width>60</width>
<height>16</height>
</size>
</property>
<property name="text">
<string>Set Origin</string>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/actions/go-home.svg</normaloff>:/images/actions/go-home.svg</iconset>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>
......
...@@ -203,8 +203,6 @@ void WaypointList::add() ...@@ -203,8 +203,6 @@ void WaypointList::add()
Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(), Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(),
0.0, true, true, 0.15, 2000); 0.0, true, true, 0.15, 2000);
uas->getWaypointManager().addWaypoint(wp); uas->getWaypointManager().addWaypoint(wp);
} }
} }
} }
......
...@@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL); m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL);
m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL); m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL);
// defaults
changedAction(0);
changedFrame(wp->getFrame());
// Read values and set user interface // Read values and set user interface
updateValues(); updateValues();
// defaults
//changedAction(wp->getAction());
//changedFrame(wp->getFrame());
connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double))); connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double)));
connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double))); connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double)));
connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double))); connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double)));
...@@ -133,7 +133,7 @@ void WaypointView::changedAction(int index) ...@@ -133,7 +133,7 @@ void WaypointView::changedAction(int index)
m_ui->holdTimeSpinBox->hide(); m_ui->holdTimeSpinBox->hide();
// set waypoint action // set waypoint action
MAV_ACTION action = (MAV_ACTION)m_ui->comboBox_action->itemData(index).toUInt(); MAV_ACTION action = (MAV_ACTION) m_ui->comboBox_action->itemData(index).toUInt();
wp->setAction(action); wp->setAction(action);
// expose ui based on action // expose ui based on action
...@@ -206,7 +206,8 @@ void WaypointView::updateValues() ...@@ -206,7 +206,8 @@ void WaypointView::updateValues()
{ {
// update frame // update frame
MAV_FRAME frame = wp->getFrame(); MAV_FRAME frame = wp->getFrame();
changedFrame(m_ui->comboBox_frame->findData(frame)); int frame_index = m_ui->comboBox_frame->findData(frame);
m_ui->comboBox_frame->setCurrentIndex(frame_index);
switch(frame) switch(frame)
{ {
case(MAV_FRAME_LOCAL): case(MAV_FRAME_LOCAL):
...@@ -220,11 +221,12 @@ void WaypointView::updateValues() ...@@ -220,11 +221,12 @@ void WaypointView::updateValues()
m_ui->altSpinBox->setValue(wp->getZ()); m_ui->altSpinBox->setValue(wp->getZ());
break; break;
} }
changedFrame(frame_index);
// update action // update action
MAV_ACTION action = wp->getAction(); MAV_ACTION action = wp->getAction();
changedFrame(m_ui->comboBox_frame->findData(frame)); int action_index = m_ui->comboBox_action->findData(action);
changedAction(m_ui->comboBox_action->findData(action)); m_ui->comboBox_action->setCurrentIndex(action_index);
switch(action) switch(action)
{ {
case MAV_ACTION_TAKEOFF: case MAV_ACTION_TAKEOFF:
...@@ -238,6 +240,7 @@ void WaypointView::updateValues() ...@@ -238,6 +240,7 @@ void WaypointView::updateValues()
default: default:
std::cerr << "unknown action" << std::endl; std::cerr << "unknown action" << std::endl;
} }
changedAction(action_index);
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());
......
...@@ -18,6 +18,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : ...@@ -18,6 +18,7 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
updateTimer(new QTimer(this)), updateTimer(new QTimer(this)),
mav(NULL), mav(NULL),
followCamera(true), followCamera(true),
trailEnabled(true),
#if (defined Q_OS_MAC) #if (defined Q_OS_MAC)
webViewMac(new QWebView(this)), webViewMac(new QWebView(this)),
#endif #endif
...@@ -51,6 +52,14 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : ...@@ -51,6 +52,14 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
updateTimer->start(200); updateTimer->start(200);
#endif #endif
// Follow checkbox
ui->followAirplaneCheckbox->setChecked(followCamera);
connect(ui->followAirplaneCheckbox, SIGNAL(toggled(bool)), this, SLOT(follow(bool)));
// Trail checkbox
ui->trailCheckbox->setChecked(trailEnabled);
connect(ui->trailCheckbox, SIGNAL(toggled(bool)), this, SLOT(showTrail(bool)));
// Get list of available 3D models // Get list of available 3D models
// Load HTML file // Load HTML file
...@@ -70,19 +79,19 @@ void QGCGoogleEarthView::setActiveUAS(UASInterface* uas) ...@@ -70,19 +79,19 @@ void QGCGoogleEarthView::setActiveUAS(UASInterface* uas)
mav = uas; mav = uas;
} }
void QGCGoogleEarthView::showTrail(int state) void QGCGoogleEarthView::showTrail(bool state)
{ {
} }
void QGCGoogleEarthView::showWaypoints(int state) void QGCGoogleEarthView::showWaypoints(bool state)
{ {
} }
void QGCGoogleEarthView::follow(bool follow) void QGCGoogleEarthView::follow(bool follow)
{ {
followCamera = follow;
} }
void QGCGoogleEarthView::updateState() void QGCGoogleEarthView::updateState()
......
...@@ -57,9 +57,9 @@ public slots: ...@@ -57,9 +57,9 @@ public slots:
/** @brief Set the currently selected UAS */ /** @brief Set the currently selected UAS */
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
/** @brief Show the vehicle trail */ /** @brief Show the vehicle trail */
void showTrail(int state); void showTrail(bool state);
/** @brief Show the waypoints */ /** @brief Show the waypoints */
void showWaypoints(int state); void showWaypoints(bool state);
/** @brief Follow the aircraft during flight */ /** @brief Follow the aircraft during flight */
void follow(bool follow); void follow(bool follow);
...@@ -68,6 +68,7 @@ protected: ...@@ -68,6 +68,7 @@ protected:
QTimer* updateTimer; QTimer* updateTimer;
UASInterface* mav; UASInterface* mav;
bool followCamera; bool followCamera;
bool trailEnabled;
#if (defined Q_OS_WIN) && !(defined __MINGW32__) #if (defined Q_OS_WIN) && !(defined __MINGW32__)
WebAxWidget* webViewWin; WebAxWidget* webViewWin;
#endif #endif
......
...@@ -95,6 +95,7 @@ void UASControlWidget::setUAS(UASInterface* uas) ...@@ -95,6 +95,7 @@ void UASControlWidget::setUAS(UASInterface* uas)
disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch())); disconnect(ui.liftoffButton, SIGNAL(clicked()), oldUAS, SLOT(launch()));
disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home())); disconnect(ui.landButton, SIGNAL(clicked()), oldUAS, SLOT(home()));
disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown())); disconnect(ui.shutdownButton, SIGNAL(clicked()), oldUAS, SLOT(shutdown()));
connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition()));
disconnect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); disconnect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
disconnect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); disconnect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int)));
} }
...@@ -104,6 +105,7 @@ void UASControlWidget::setUAS(UASInterface* uas) ...@@ -104,6 +105,7 @@ void UASControlWidget::setUAS(UASInterface* uas)
connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch()));
connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home())); connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home()));
connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown()));
connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition()));
connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int)));
......
...@@ -229,7 +229,27 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) ...@@ -229,7 +229,27 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType)
m_ui->typeButton->setIcon(QIcon(":/images/mavs/helicopter.svg")); m_ui->typeButton->setIcon(QIcon(":/images/mavs/helicopter.svg"));
break; break;
case 5: case 5:
m_ui->typeButton->setIcon(QIcon(":/images/mavs/unknown.svg"));
break;
case 6:
{
// A groundstation is a special system type, update widget
QString result;
m_ui->nameLabel->setText(tr("OCU ") + result.sprintf("%03d", uas->getUASID()));
m_ui->waypointLabel->setText("");
m_ui->timeRemainingLabel->setText("Online:");
m_ui->batteryBar->hide();
m_ui->thrustBar->hide();
m_ui->stateLabel->hide();
m_ui->statusTextLabel->hide();
m_ui->waypointLabel->hide();
m_ui->liftoffButton->hide();
m_ui->haltButton->hide();
m_ui->landButton->hide();
m_ui->shutdownButton->hide();
m_ui->abortButton->hide();
m_ui->typeButton->setIcon(QIcon(":/images/mavs/groundstation.svg")); m_ui->typeButton->setIcon(QIcon(":/images/mavs/groundstation.svg"));
}
break; break;
default: default:
m_ui->typeButton->setIcon(QIcon(":/images/mavs/unknown.svg")); m_ui->typeButton->setIcon(QIcon(":/images/mavs/unknown.svg"));
......
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