Commit 406c262b authored by Lorenz Meier's avatar Lorenz Meier

Added PX4 calibration widget, switched HIL from FlightGear to XPlane, bringing up HIL

parent 21827374
[PX4%20Calibration%20Tool]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_DESCRIPTION=Reboot (only in standby)
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_BUTTONTEXT=REBOOT
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_COMMANDID=246
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\2\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_BUTTONTEXT=MAG
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM2=1
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\3\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_DESCRIPTION=Accelerometer calibration
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_BUTTONTEXT=ACCEL
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM5=1
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\4\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_BUTTONTEXT=GYRO
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\size=4
[PX4%20Calibration%20Tool]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_DESCRIPTION=Reboot (only in standby)
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_BUTTONTEXT=REBOOT
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_COMMANDID=246
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\2\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_BUTTONTEXT=MAG
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM2=1
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\3\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_DESCRIPTION=Accelerometer calibration
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_BUTTONTEXT=ACCEL
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM1=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM5=1
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\4\TYPE=COMMANDBUTTON
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_DESCRIPTION=Gyroscope calibration
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_BUTTONTEXT=GYRO
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_COMMANDID=241
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAMS_VISIBLE=false
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM1=1
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM2=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM3=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM4=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM5=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM6=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_COMMAND_BUTTON_PARAM7=0
QGC_TOOL_WIDGET_ITEMS\size=4
...@@ -252,6 +252,7 @@ HEADERS += src/MG.h \ ...@@ -252,6 +252,7 @@ HEADERS += src/MG.h \
src/comm/ProtocolInterface.h \ src/comm/ProtocolInterface.h \
src/comm/MAVLinkProtocol.h \ src/comm/MAVLinkProtocol.h \
src/comm/QGCFlightGearLink.h \ src/comm/QGCFlightGearLink.h \
src/comm/QGCXPlaneLink.h \
src/ui/CommConfigurationWindow.h \ src/ui/CommConfigurationWindow.h \
src/ui/SerialConfigurationWindow.h \ src/ui/SerialConfigurationWindow.h \
src/ui/MainWindow.h \ src/ui/MainWindow.h \
...@@ -358,7 +359,8 @@ HEADERS += src/MG.h \ ...@@ -358,7 +359,8 @@ HEADERS += src/MG.h \
src/ui/mission/QGCMissionNavSweep.h \ src/ui/mission/QGCMissionNavSweep.h \
src/ui/mission/QGCMissionDoStartSearch.h \ src/ui/mission/QGCMissionDoStartSearch.h \
src/ui/mission/QGCMissionDoFinishSearch.h \ src/ui/mission/QGCMissionDoFinishSearch.h \
src/ui/QGCVehicleConfig.h src/ui/QGCVehicleConfig.h \
src/comm/QGCHilLink.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
...@@ -412,6 +414,7 @@ SOURCES += src/main.cc \ ...@@ -412,6 +414,7 @@ SOURCES += src/main.cc \
src/comm/SerialLink.cc \ src/comm/SerialLink.cc \
src/comm/MAVLinkProtocol.cc \ src/comm/MAVLinkProtocol.cc \
src/comm/QGCFlightGearLink.cc \ src/comm/QGCFlightGearLink.cc \
src/comm/QGCXPlaneLink.cc \
src/ui/CommConfigurationWindow.cc \ src/ui/CommConfigurationWindow.cc \
src/ui/SerialConfigurationWindow.cc \ src/ui/SerialConfigurationWindow.cc \
src/ui/MainWindow.cc \ src/ui/MainWindow.cc \
...@@ -513,7 +516,8 @@ SOURCES += src/main.cc \ ...@@ -513,7 +516,8 @@ SOURCES += src/main.cc \
src/ui/mission/QGCMissionNavSweep.cc \ src/ui/mission/QGCMissionNavSweep.cc \
src/ui/mission/QGCMissionDoStartSearch.cc \ src/ui/mission/QGCMissionDoStartSearch.cc \
src/ui/mission/QGCMissionDoFinishSearch.cc \ src/ui/mission/QGCMissionDoFinishSearch.cc \
src/ui/QGCVehicleConfig.cc src/ui/QGCVehicleConfig.cc \
src/comm/QGCHilLink.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc
......
...@@ -304,8 +304,8 @@ bool QGCFlightGearLink::disconnectSimulation() ...@@ -304,8 +304,8 @@ bool QGCFlightGearLink::disconnectSimulation()
connectState = false; connectState = false;
emit flightGearDisconnected(); emit simulationDisconnected();
emit flightGearConnected(false); emit simulationConnected(false);
return !connectState; return !connectState;
} }
...@@ -475,9 +475,9 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -475,9 +475,9 @@ bool QGCFlightGearLink::connectSimulation()
emit flightGearConnected(connectState); emit simulationConnected(connectState);
if (connectState) { if (connectState) {
emit flightGearConnected(); emit simulationConnected();
connectionStartTime = QGC::groundTimeUsecs()/1000; connectionStartTime = QGC::groundTimeUsecs()/1000;
} }
qDebug() << "STARTING SIM"; qDebug() << "STARTING SIM";
......
...@@ -41,8 +41,9 @@ This file is part of the QGROUNDCONTROL project ...@@ -41,8 +41,9 @@ This file is part of the QGROUNDCONTROL project
#include <LinkInterface.h> #include <LinkInterface.h>
#include <configuration.h> #include <configuration.h>
#include "UASInterface.h" #include "UASInterface.h"
#include "QGCHilLink.h"
class QGCFlightGearLink : public QThread class QGCFlightGearLink : public QGCHilLink
{ {
Q_OBJECT Q_OBJECT
//Q_INTERFACES(QGCFlightGearLinkInterface:LinkInterface) //Q_INTERFACES(QGCFlightGearLinkInterface:LinkInterface)
...@@ -114,25 +115,6 @@ protected: ...@@ -114,25 +115,6 @@ protected:
void setName(QString name); void setName(QString name);
signals: signals:
/**
* @brief This signal is emitted instantly when the link is connected
**/
void flightGearConnected();
/**
* @brief This signal is emitted instantly when the link is disconnected
**/
void flightGearDisconnected();
/**
* @brief This signal is emitted instantly when the link status changes
**/
void flightGearConnected(bool connected);
/** @brief State update from FlightGear */
void hilStateChanged(uint64_t time_us, float roll, float pitch, float yaw, float rollspeed,
float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt,
int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc);
}; };
......
#include "QGCHilLink.h"
//QGCHilLink::QGCHilLink(QObject *parent) :
// QThread(parent)
//{
//}
#ifndef QGCHILLINK_H
#define QGCHILLINK_H
#include <QThread>
#include <QProcess>
class QGCHilLink : public QThread
{
Q_OBJECT
public:
virtual bool isConnected() = 0;
virtual qint64 bytesAvailable() = 0;
virtual int getPort() const = 0;
/**
* @brief The human readable port name
*/
virtual QString getName() = 0;
public slots:
virtual void setPort(int port) = 0;
/** @brief Add a new host to broadcast messages to */
virtual void setRemoteHost(const QString& host) = 0;
/** @brief Send new control states to the simulation */
virtual void updateControls(uint64_t time, float rollAilerons, float pitchElevator, float yawRudder, float throttle, uint8_t systemMode, uint8_t navMode) = 0;
virtual void processError(QProcess::ProcessError err) = 0;
virtual void readBytes() = 0;
/**
* @brief Write a number of bytes to the interface.
*
* @param data Pointer to the data byte array
* @param size The size of the bytes array
**/
virtual void writeBytes(const char* data, qint64 length) = 0;
virtual bool connectSimulation() = 0;
virtual bool disconnectSimulation() = 0;
protected:
virtual void setName(QString name) = 0;
signals:
/**
* @brief This signal is emitted instantly when the link is connected
**/
void simulationConnected();
/**
* @brief This signal is emitted instantly when the link is disconnected
**/
void simulationDisconnected();
/**
* @brief This signal is emitted instantly when the link status changes
**/
void simulationConnected(bool connected);
/** @brief State update from FlightGear */
void hilStateChanged(uint64_t time_us, float roll, float pitch, float yaw, float rollspeed,
float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt,
int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc);
};
#endif // QGCHILLINK_H
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file QGCXPlaneLink.h
* @brief X-Plane simulation link
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef QGCXPLANESIMULATIONLINK_H
#define QGCXPLANESIMULATIONLINK_H
#include <QString>
#include <QList>
#include <QMap>
#include <QMutex>
#include <QUdpSocket>
#include <QTimer>
#include <QProcess>
#include <LinkInterface.h>
#include <configuration.h>
#include "UASInterface.h"
#include "QGCHilLink.h"
class QGCXPlaneLink : public QGCHilLink
{
Q_OBJECT
//Q_INTERFACES(QGCXPlaneLinkInterface:LinkInterface)
public:
QGCXPlaneLink(UASInterface* mav, QString remoteHost=QString("127.0.0.1:49000"), QHostAddress host = QHostAddress::Any, quint16 port = 49005);
~QGCXPlaneLink();
bool isConnected();
qint64 bytesAvailable();
int getPort() const {
return port;
}
/**
* @brief The human readable port name
*/
QString getName();
void run();
public slots:
// void setAddress(QString address);
void setPort(int port);
/** @brief Add a new host to broadcast messages to */
void setRemoteHost(const QString& host);
/** @brief Send new control states to the simulation */
void updateControls(uint64_t time, float rollAilerons, float pitchElevator, float yawRudder, float throttle, uint8_t systemMode, uint8_t navMode);
// /** @brief Remove a host from broadcasting messages to */
// void removeHost(const QString& host);
// void readPendingDatagrams();
void processError(QProcess::ProcessError err);
void readBytes();
/**
* @brief Write a number of bytes to the interface.
*
* @param data Pointer to the data byte array
* @param size The size of the bytes array
**/
void writeBytes(const char* data, qint64 length);
bool connectSimulation();
bool disconnectSimulation();
protected:
QString name;
QHostAddress host;
QHostAddress currentHost;
quint16 currentPort;
quint16 port;
int id;
QUdpSocket* socket;
bool connectState;
quint64 bitsSentTotal;
quint64 bitsSentCurrent;
quint64 bitsSentMax;
quint64 bitsReceivedTotal;
quint64 bitsReceivedCurrent;
quint64 bitsReceivedMax;
quint64 connectionStartTime;
QMutex statisticsMutex;
QMutex dataMutex;
QTimer refreshTimer;
UASInterface* mav;
QProcess* process;
QProcess* terraSync;
void setName(QString name);
signals:
/**
* @brief This signal is emitted instantly when the link is connected
**/
void flightGearConnected();
/**
* @brief This signal is emitted instantly when the link is disconnected
**/
void flightGearDisconnected();
/**
* @brief This signal is emitted instantly when the link status changes
**/
void flightGearConnected(bool connected);
/** @brief State update from FlightGear */
void hilStateChanged(uint64_t time_us, float roll, float pitch, float yaw, float rollspeed,
float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt,
int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc);
};
#endif // QGCXPLANESIMULATIONLINK_H
...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramManager(NULL), paramManager(NULL),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
simulation(new QGCFlightGearLink(this)), simulation(new QGCXPlaneLink(this)),
isLocalPositionKnown(false), isLocalPositionKnown(false),
isGlobalPositionKnown(false), isGlobalPositionKnown(false),
systemIsArmed(false), systemIsArmed(false),
...@@ -2516,9 +2516,20 @@ void UAS::sendHilState(uint64_t time_us, float roll, float pitch, float yaw, flo ...@@ -2516,9 +2516,20 @@ void UAS::sendHilState(uint64_t time_us, float roll, float pitch, float yaw, flo
float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt,
int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc) int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
{ {
mavlink_message_t msg; if (this->mode & MAV_MODE_FLAG_HIL_ENABLED)
mavlink_msg_hil_state_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, time_us, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc); {
sendMessage(msg); mavlink_message_t msg;
mavlink_msg_hil_state_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, time_us, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, vx, vy, vz, xacc, yacc, zacc);
sendMessage(msg);
}
else
{
// Attempt to set HIL mode
mavlink_message_t msg;
mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode | MAV_MODE_FLAG_HIL_ENABLED, navMode);
sendMessage(msg);
qDebug() << __FILE__ << __LINE__ << "HIL is onboard not enabled, trying to enable.";
}
} }
/** /**
......
...@@ -36,7 +36,9 @@ This file is part of the QGROUNDCONTROL project ...@@ -36,7 +36,9 @@ This file is part of the QGROUNDCONTROL project
#include <MAVLinkProtocol.h> #include <MAVLinkProtocol.h>
#include <QVector3D> #include <QVector3D>
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGCHilLink.h"
#include "QGCFlightGearLink.h" #include "QGCFlightGearLink.h"
#include "QGCXPlaneLink.h"
/** /**
* @brief A generic MAVLINK-connected MAV/UAV * @brief A generic MAVLINK-connected MAV/UAV
...@@ -330,7 +332,7 @@ protected: //COMMENTS FOR TEST UNIT ...@@ -330,7 +332,7 @@ protected: //COMMENTS FOR TEST UNIT
QString shortModeText; ///< Short textual mode description QString shortModeText; ///< Short textual mode description
bool attitudeStamped; ///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV bool attitudeStamped; ///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV
quint64 lastAttitude; ///< Timestamp of last attitude measurement quint64 lastAttitude; ///< Timestamp of last attitude measurement
QGCFlightGearLink* simulation; ///< Hardware in the loop simulation link QGCHilLink* simulation; ///< Hardware in the loop simulation link
bool isLocalPositionKnown; ///< If the local position has been received for this MAV bool isLocalPositionKnown; ///< If the local position has been received for this MAV
bool isGlobalPositionKnown; ///< If the global position has been received for this MAV bool isGlobalPositionKnown; ///< If the global position has been received for this MAV
bool systemIsArmed; ///< If the system is armed bool systemIsArmed; ///< If the system is armed
......
...@@ -68,7 +68,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -68,7 +68,8 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
removeAction(new QAction("Delete this system", this)), removeAction(new QAction("Delete this system", this)),
renameAction(new QAction("Rename..", this)), renameAction(new QAction("Rename..", this)),
selectAction(new QAction("Control this system", this )), selectAction(new QAction("Control this system", this )),
hilAction(new QAction("Enable Hardware-in-the-Loop Simulation", this )), hilAction(new QAction("Enable Flightgear Hardware-in-the-Loop Simulation", this )),
hilXAction(new QAction("Enable X-Plane Hardware-in-the-Loop Simulation", this )),
selectAirframeAction(new QAction("Choose Airframe", this)), selectAirframeAction(new QAction("Choose Airframe", this)),
setBatterySpecsAction(new QAction("Set Battery Options", this)), setBatterySpecsAction(new QAction("Set Battery Options", this)),
lowPowerModeEnabled(true), lowPowerModeEnabled(true),
...@@ -80,6 +81,9 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -80,6 +81,9 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
lowPowerModeEnabled = MainWindow::instance()->lowPowerModeEnabled(); lowPowerModeEnabled = MainWindow::instance()->lowPowerModeEnabled();
hilAction->setCheckable(true); hilAction->setCheckable(true);
// Flightgear is not ready for prime time
hilAction->setEnabled(false);
hilXAction->setCheckable(true);
m_ui->setupUi(this); m_ui->setupUi(this);
...@@ -119,6 +123,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -119,6 +123,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect(renameAction, SIGNAL(triggered()), this, SLOT(rename())); connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected())); connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected()));
connect(hilAction, SIGNAL(triggered(bool)), uas, SLOT(enableHil(bool))); connect(hilAction, SIGNAL(triggered(bool)), uas, SLOT(enableHil(bool)));
connect(hilXAction, SIGNAL(triggered(bool)), uas, SLOT(enableHil(bool)));
connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe())); connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe()));
connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs())); connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs()));
connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater())); connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater()));
...@@ -464,7 +469,8 @@ void UASView::contextMenuEvent (QContextMenuEvent* event) ...@@ -464,7 +469,8 @@ void UASView::contextMenuEvent (QContextMenuEvent* event)
{ {
menu.addAction(removeAction); menu.addAction(removeAction);
} }
menu.addAction(hilAction); menu.addAction(hilXAction);
// XXX Re-enable later menu.addAction(hilXAction);
menu.addAction(selectAirframeAction); menu.addAction(selectAirframeAction);
menu.addAction(setBatterySpecsAction); menu.addAction(setBatterySpecsAction);
menu.exec(event->globalPos()); menu.exec(event->globalPos());
......
...@@ -122,6 +122,7 @@ protected: ...@@ -122,6 +122,7 @@ protected:
QAction* renameAction; QAction* renameAction;
QAction* selectAction; QAction* selectAction;
QAction* hilAction; QAction* hilAction;
QAction* hilXAction;
QAction* selectAirframeAction; QAction* selectAirframeAction;
QAction* setBatterySpecsAction; QAction* setBatterySpecsAction;
static const int updateInterval = 800; static const int updateInterval = 800;
......
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