Commit 6a455039 authored by pixhawk's avatar pixhawk

Merging

parents ac1f90f1 11474203
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- <head> -->
<!-- QGroundControl -->
<title>QGroundControl Google Earth View</title>
<!-- *** Replace the key below below with your own API key, available at http://code.google.com/apis/maps/signup.html *** -->
......
This diff is collapsed.
......@@ -157,7 +157,7 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
**/
Core::~Core()
{
mainWindow->storeSettings();
//mainWindow->storeSettings();
mainWindow->hide();
mainWindow->deleteLater();
// Delete singletons
......
......@@ -32,6 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include <QList>
#include <QApplication>
#include "LinkManager.h"
#include <iostream>
#include <QDebug>
......@@ -65,6 +66,7 @@ LinkManager::~LinkManager()
void LinkManager::add(LinkInterface* link)
{
if(!link) return;
links.append(link);
emit newLink(link);
}
......@@ -73,6 +75,7 @@ void LinkManager::addProtocol(LinkInterface* link, ProtocolInterface* protocol)
{
// Connect link to protocol
// the protocol will receive new bytes from the link
if(!link || !protocol) return;
connect(link, SIGNAL(bytesReceived(LinkInterface*, QByteArray)), protocol, SLOT(receiveBytes(LinkInterface*, QByteArray)));
// Store the connection information in the protocol links map
protocolLinks.insertMulti(protocol, link);
......@@ -91,7 +94,8 @@ bool LinkManager::connectAll()
foreach (LinkInterface* link, links)
{
if(! link->connect()) allConnected = false;
if(!link) {}
else if(!link->connect()) allConnected = false;
}
return allConnected;
......@@ -103,7 +107,9 @@ bool LinkManager::disconnectAll()
foreach (LinkInterface* link, links)
{
if(! link->disconnect()) allDisconnected = false;
//static int i=0;
if(!link){}
else if(!link->disconnect()) allDisconnected = false;
}
return allDisconnected;
......@@ -111,14 +117,32 @@ bool LinkManager::disconnectAll()
bool LinkManager::connectLink(LinkInterface* link)
{
if(!link) return false;
return link->connect();
}
bool LinkManager::disconnectLink(LinkInterface* link)
{
if(!link) return false;
return link->disconnect();
}
bool LinkManager::removeLink(LinkInterface* link)
{
if(link)
{
for (int i=0; i < QList<LinkInterface*>(links).size(); i++)
{
if(link==links.at(i))
{
links.removeAt(i); //remove from link list
}
}
return true;
}
return false;
}
/**
* The access time is linear in the number of links.
*
......
......@@ -67,6 +67,8 @@ public slots:
void add(LinkInterface* link);
void addProtocol(LinkInterface* link, ProtocolInterface* protocol);
bool removeLink(LinkInterface* link);
bool connectAll();
bool connectLink(LinkInterface* link);
......
......@@ -159,7 +159,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
switch (heartbeat.autopilot)
{
case MAV_AUTOPILOT_GENERIC:
uas = new UAS(this, message.sysid);
// Connect this robot to the UAS object
connect(this, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), uas, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
break;
......@@ -202,11 +204,15 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
break;
}
// Set the autopilot type
uas->setAutopilotType((int)heartbeat.autopilot);
// Make UAS aware that this link can be used to communicate with the actual robot
uas->addLink(link);
// Now add UAS to "official" list, which makes the whole application aware of it
UASManager::instance()->addUAS(uas);
}
// Only count message if UAS exists for this message
......
......@@ -660,7 +660,7 @@ qint64 MAVLinkSimulationLink::bytesAvailable()
void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size)
{
qDebug() << "Simulation received " << size << " bytes from groundstation: ";
//qDebug() << "Simulation received " << size << " bytes from groundstation: ";
// Increase write counter
//bitsSentTotal += size * 8;
......@@ -838,9 +838,9 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size)
}
unsigned char v=data[i];
fprintf(stderr,"%02x ", v);
//fprintf(stderr,"%02x ", v);
}
fprintf(stderr,"\n");
//fprintf(stderr,"\n");
readyBufferMutex.lock();
for (int i = 0; i < streampointer; i++)
......
......@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include "LinkManager.h"
#include "QGC.h"
#include <MG.h>
#include <iostream>
#ifdef _WIN32
#include "windows.h"
#endif
......@@ -59,9 +60,18 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
// Load defaults from settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT"))
{
this->porthandle = settings.value("SERIALLINK_COMM_PORT").toString();
}
// *nix (Linux, MacOS tested) serial port support
port = new QextSerialPort(porthandle, QextSerialPort::Polling);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
if (settings.contains("SERIALLINK_COMM_PORT"))
{
setBaudRate(settings.value("SERIALLINK_COMM_BAUD").toInt());
setParityType(settings.value("SERIALLINK_COMM_PARITY").toInt());
setStopBitsType(settings.value("SERIALLINK_COMM_STOPBITS").toInt());
......@@ -76,6 +86,12 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
this->stopBits = stopBits;
this->timeout = 1; ///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
}
port->setTimeout(timeout); // Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port->setBaudRate(baudrate);
port->setFlowControl(flow);
port->setParity(parity);
port->setDataBits(dataBits);
port->setStopBits(stopBits);
// Set the port name
if (porthandle == "")
......@@ -104,15 +120,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
//some other error occurred. Inform user.
}
#else
// *nix (Linux, MacOS tested) serial port support
port = new QextSerialPort(porthandle, QextSerialPort::Polling);
//port = new QextSerialPort(porthandle, QextSerialPort::EventDriven);
port->setTimeout(timeout); // Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port->setBaudRate(baudrate);
port->setFlowControl(flow);
port->setParity(parity);
port->setDataBits(dataBits);
port->setStopBits(stopBits);
#endif
// Link is setup, register it with link manager
......@@ -122,7 +130,7 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
SerialLink::~SerialLink()
{
disconnect();
delete port;
if(port) delete port;
port = NULL;
}
......@@ -186,7 +194,7 @@ void SerialLink::writeBytes(const char* data, qint64 size)
{
unsigned char v=data[i];
fprintf(stderr,"%02x ", v);
//fprintf(stderr,"%02x ", v);
}
}
}
......@@ -255,6 +263,8 @@ bool SerialLink::disconnect()
port->close();
dataMutex.unlock();
if(this->isRunning()) this->terminate(); //stop running the thread, restart it upon connect
bool closed = true;
//port->isOpen();
......@@ -298,15 +308,6 @@ bool SerialLink::connect()
**/
bool SerialLink::hardwareConnect()
{
// Store settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.setValue("SERIALLINK_COMM_PORT", this->porthandle);
settings.setValue("SERIALLINK_COMM_BAUD", this->baudrate);
settings.setValue("SERIALLINK_COMM_PARITY", this->parity);
settings.setValue("SERIALLINK_COMM_STOPBITS", this->stopBits);
settings.setValue("SERIALLINK_COMM_DATABITS", this->dataBits);
settings.sync();
QObject::connect(port, SIGNAL(aboutToClose()), this, SIGNAL(disconnected()));
port->open(QIODevice::ReadWrite);
......@@ -323,6 +324,15 @@ bool SerialLink::hardwareConnect()
if(connectionUp) {
emit connected();
emit connected(true);
// Store settings
QSettings settings(QGC::COMPANYNAME, QGC::APPNAME);
settings.setValue("SERIALLINK_COMM_PORT", this->porthandle);
settings.setValue("SERIALLINK_COMM_BAUD", getBaudRate());
settings.setValue("SERIALLINK_COMM_PARITY", getParityType());
settings.setValue("SERIALLINK_COMM_STOPBITS", getStopBitsType());
settings.setValue("SERIALLINK_COMM_DATABITS", getDataBitsType());
settings.sync();
}
return connectionUp;
......@@ -336,7 +346,14 @@ bool SerialLink::hardwareConnect()
**/
bool SerialLink::isConnected()
{
return port->isOpen();
if (port)
{
return port->isOpen();
}
else
{
return false;
}
}
int SerialLink::getId()
......@@ -541,7 +558,7 @@ bool SerialLink::setPortName(QString portName)
this->porthandle = "\\\\.\\" + this->porthandle;
}
#endif
delete port;
if(port) delete port;
port = new QextSerialPort(porthandle, QextSerialPort::Polling);
port->setBaudRate(baudrate);
......@@ -732,9 +749,16 @@ bool SerialLink::setBaudRate(int rate)
break;
}
port->setBaudRate(this->baudrate);
if(reconnect) connect();
return accepted;
if (port)
{
port->setBaudRate(this->baudrate);
if(reconnect) connect();
return accepted;
}
else
{
return false;
}
}
bool SerialLink::setFlowType(int flow)
......
......@@ -169,10 +169,16 @@ void SlugsMAV::emitSignals (void){
case 2:
emit slugsAirData(uasId, mlAirData);
emit slugsDiagnostic(uasId,mlDiagnosticData);
break;
case 3:
emit slugsPilotConsolePWM(uasId,mlPilotConsoleData);
emit remoteControlChannelScaledChanged(0,(mlPilotConsoleData.de- 1000.0f)/1000.0f);
emit remoteControlChannelScaledChanged(1,(mlPilotConsoleData.dla- 1000.0f)/1000.0f);
emit remoteControlChannelScaledChanged(2,(mlPilotConsoleData.dr- 1000.0f)/1000.0f);
emit remoteControlChannelScaledChanged(3,(mlPilotConsoleData.dra- 1000.0f)/1000.0f);
emit remoteControlChannelScaledChanged(0,(mlPilotConsoleData.dt- 1000.0f)/1000.0f);
emit slugsPWM(uasId, mlPwmCommands);
break;
......@@ -184,11 +190,13 @@ void SlugsMAV::emitSignals (void){
case 5:
emit slugsFilteredData(uasId,mlFilteredData);
emit slugsGPSDateTime(uasId, mlGpsDateTime);
break;
case 6:
emit slugsActionAck(uasId,mlActionAck);
emit emitGpsSignals();
break;
}
......@@ -212,20 +220,30 @@ void SlugsMAV::emitSignals (void){
#ifdef MAVLINK_ENABLED_SLUGS
void SlugsMAV::emitGpsSignals (void){
if (mlGpsData.fix_type > 0){
qDebug()<<"After Emit GPS Signal"<<mlGpsData.fix_type;
//ToDo Uncomment if. it was comment only to test
// if (mlGpsData.fix_type > 0){
emit globalPositionChanged(this,
mlGpsData.lon,
mlGpsData.lat,
mlGpsData.alt,
0.0);
// Smaller than threshold and not NaN
if (mlGpsData.v < 1000000 && mlGpsData.v == mlGpsData.v){
emit speedChanged(this, (double)mlGpsData.v, 0.0, 0.0, 0.0);
} else {
emit textMessageReceived(uasId, uasId, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(mlGpsData.v));
}
}
emit slugsGPSCogSog(uasId,mlGpsData.hdg, mlGpsData.v);
// // Smaller than threshold and not NaN
// if (mlGpsData.v < 1000000 && mlGpsData.v == mlGpsData.v){
// // emit speedChanged(this, (double)mlGpsData.v, 0.0, 0.0, 0.0);
// }
// else {
// emit textMessageReceived(uasId, uasId, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(mlGpsData.v));
// }
//}
}
void SlugsMAV::emitPidSignal()
......
......@@ -47,6 +47,7 @@ public slots:
signals:
void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData);
void slugsGPSCogSog(int uasId, double cog, double sog);
#ifdef MAVLINK_ENABLED_SLUGS
......@@ -67,6 +68,8 @@ signals:
void slugsBootMsg(int uasId, mavlink_boot_t& boot);
void slugsAttitude(int uasId, mavlink_attitude_t& attitude);
#endif
protected:
......
......@@ -43,12 +43,16 @@ This file is part of the QGROUNDCONTROL project
#include "GAudioOutput.h"
#include "MAVLinkProtocol.h"
#include "QGCMAVLink.h"
#include "LinkManager.h"
#include "SerialLink.h"
UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
uasId(id),
startTime(MG::TIME::getGroundTimeNow()),
commStatus(COMM_DISCONNECTED),
name(""),
autopilot(-1),
links(new QList<LinkInterface*>()),
unknownPackets(),
mavlink(protocol),
......@@ -93,6 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
UAS::~UAS()
{
delete links;
links=NULL;
}
int UAS::getUASID() const
......@@ -124,6 +129,7 @@ void UAS::setSelected()
void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
if (!link) return;
if (!links->contains(link))
{
addLink(link);
......@@ -149,8 +155,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if (this->type != mavlink_msg_heartbeat_get_type(&message))
{
this->type = mavlink_msg_heartbeat_get_type(&message);
this->autopilot = mavlink_msg_heartbeat_get_autopilot(&message);
emit systemTypeSet(this, type);
}
break;
case MAVLINK_MSG_ID_BOOT:
getStatusForCode((int)MAV_STATE_BOOT, uasState, stateDescription);
......@@ -328,6 +336,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit valueChanged(uasId, "Vz", pos.vz, time);
emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
emit speedChanged(this, pos.vx, pos.vy, pos.vz, time);
// qDebug()<<"Local Position = "<<pos.x<<" - "<<pos.y<<" - "<<pos.z;
// qDebug()<<"Speed Local Position = "<<pos.vx<<" - "<<pos.vy<<" - "<<pos.vz;
//emit attitudeChanged(this, pos.roll, pos.pitch, pos.yaw, time);
// Set internal state
if (!positionLock)
......@@ -363,12 +375,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
GAudioOutput::instance()->notifyPositive();
}
positionLock = true;
// Send to patch antenna
// FIXME Message re-routing should be implemented differently
//mavlink_message_t msg;
//mavlink_msg_global_position_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, pos.usec, pos.lat, pos.lon, pos.alt, pos.vx, pos.vy, pos.vz);
//sendMessage(msg);
//TODO fix this hack for forwarding of global position for patch antenna tracking
forwardMessage(message);
}
break;
case MAVLINK_MSG_ID_GPS_RAW:
......@@ -830,8 +838,31 @@ void UAS::sendMessage(mavlink_message_t message)
}
}
void UAS::forwardMessage(mavlink_message_t message)
{
// Emit message on all links that are currently connected
QList<LinkInterface*>link_list = LinkManager::instance()->getLinksForProtocol(mavlink);
foreach(LinkInterface* link, link_list)
{
SerialLink* serial = dynamic_cast<SerialLink*>(link);
if(serial != 0)
{
for(int i=0;i<links->size();i++)
{
if(serial != links->at(i))
{
qDebug()<<"Forwarding Over link: "<<serial->getName()<<" "<<serial;
sendMessage(serial, message);
}
}
}
}
}
void UAS::sendMessage(LinkInterface* link, mavlink_message_t message)
{
if(!link) return;
// Create buffer
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
// Write message into buffer, prepending start sign
......@@ -1501,7 +1532,7 @@ void UAS::addLink(LinkInterface* link)
links->append(link);
}
//links->append(link);
//qDebug() << " ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK";
qDebug() << link<<" ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK ADDED LINK";
}
/**
......
......@@ -79,25 +79,26 @@ public:
/** @brief Get the links associated with this robot */
QList<LinkInterface*>* getLinks();
double getLocalX() const { return localX; };
double getLocalY() const { return localY; };
double getLocalZ() const { return localZ; };
double getLatitude() const { return latitude; };
double getLongitude() const { return longitude; };
double getAltitude() const { return altitude; };
double getLocalX() const { return localX; }
double getLocalY() const { return localY; }
double getLocalZ() const { return localZ; }
double getLatitude() const { return latitude; }
double getLongitude() const { return longitude; }
double getAltitude() const { return altitude; }
double getRoll() const { return roll; };
double getPitch() const { return pitch; };
double getYaw() const { return yaw; };
double getRoll() const { return roll; }
double getPitch() const { return pitch; }
double getYaw() const { return yaw; }
friend class UASWaypointManager;
protected:
int uasId; ///< Unique system ID
int type; ///< UAS type (from type enum)
unsigned char type; ///< UAS type (from type enum)
quint64 startTime; ///< The time the UAS was switched on
CommStatus commStatus; ///< Communication status
QString name; ///< Human-friendly name of the vehicle, e.g. bravo
int autopilot; ///< Type of the Autopilot: -1: None, 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
QList<LinkInterface*>* links; ///< List of links this UAS can be reached by
QList<int> unknownPackets; ///< Packet IDs which are unknown and have been received
MAVLinkProtocol* mavlink; ///< Reference to the MAVLink instance
......@@ -164,6 +165,8 @@ protected:
public:
UASWaypointManager &getWaypointManager(void) { return waypointManager; }
int getSystemType();
int getAutopilotType() {return autopilot;}
void setAutopilotType(int apType) { autopilot = apType;}
public slots:
/** @brief Launches the system **/
......@@ -215,6 +218,9 @@ public slots:
/** @brief Send a message over all links this UAS can be reached with (!= all links) */
void sendMessage(mavlink_message_t message);
/** @brief Temporary Hack for sending packets to patch Antenna. Send a message over all serial links except for this UAS's */
void forwardMessage(mavlink_message_t message);
/** @brief Set this UAS as the system currently in focus, e.g. in the main display widgets */
void setSelected();
......
......@@ -157,6 +157,9 @@ public:
return color;
}
virtual int getAutopilotType() = 0;
virtual void setAutopilotType(int apType)= 0;
public slots:
/** @brief Launches the system/Liftof **/
......@@ -241,6 +244,8 @@ public slots:
virtual void startGyroscopeCalibration() = 0;
virtual void startPressureCalibration() = 0;
protected:
QColor color;
......
......@@ -85,6 +85,11 @@ void UASManager::addUAS(UASInterface* uas)
}
}
QList<UASInterface*> UASManager::getUASList()
{
return systems.values();
}
UASInterface* UASManager::getActiveUAS()
{
if(!activeUAS)
......@@ -96,6 +101,11 @@ UASInterface* UASManager::getActiveUAS()
return activeUAS; ///< Return zero pointer if no UAS has been loaded
}
UASInterface* UASManager::silentGetActiveUAS()
{
return activeUAS; ///< Return zero pointer if no UAS has been loaded
}
bool UASManager::launchActiveUAS()
{
// If the active UAS is set, execute command
......
......@@ -57,6 +57,7 @@ public:
* @return NULL pointer if no UAS exists, active UAS else
**/
UASInterface* getActiveUAS();
UASInterface* silentGetActiveUAS();
/**
* @brief Get the UAS with this id
*
......@@ -68,6 +69,8 @@ public:
**/
UASInterface* getUASForId(int id);
QList<UASInterface*> getUASList();
public slots:
......
......@@ -47,6 +47,7 @@ This file is part of the QGROUNDCONTROL project
#endif
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
#include "LinkManager.h"
CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolInterface* protocol, QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags)
{
......@@ -58,6 +59,10 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn
// add link types
ui.linkType->addItem("Serial",QGC_LINK_SERIAL);
ui.linkType->addItem("UDP",QGC_LINK_UDP);
ui.linkType->addItem("Simulation",QGC_LINK_SIMULATION);
ui.linkType->addItem("Serial Forwarding",QGC_LINK_FORWARDING);
ui.connectionType->addItem("MAVLink", QGC_PROTOCOL_MAVLINK);
// Create action to open this menu
// Create configuration action for this link
......@@ -195,11 +200,20 @@ void CommConfigurationWindow::setLinkName(QString name)
void CommConfigurationWindow::remove()
{
link->disconnect();
//delete link;
//delete action;
if(action) delete action; //delete action first since it has a pointer to link
action=NULL;
if(link)
{
LinkManager::instance()->removeLink(link); //remove link from LinkManager list
link->disconnect(); //disconnect port, and also calls terminate() to stop the thread
if (link->isRunning()) link->terminate(); // terminate() the serial thread just in case it is still running
link->wait(); // wait() until thread is stoped before deleting
delete link;
}
link=NULL;
this->window()->close();
qDebug() << "TODO: Link cannot be deleted: CommConfigurationWindow::remove() NOT IMPLEMENTED!";
}
void CommConfigurationWindow::connectionState(bool connect)
......
......@@ -42,7 +42,14 @@ This file is part of the QGROUNDCONTROL project
enum qgc_link_t
{
QGC_LINK_SERIAL,
QGC_LINK_UDP
QGC_LINK_UDP,
QGC_LINK_SIMULATION,
QGC_LINK_FORWARDING
};
enum qgc_protocol_t
{
QGC_PROTOCOL_MAVLINK
};
#ifdef OPAL_RT
......
......@@ -43,23 +43,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="linkType">
<item>
<property name="text">
<string>Serial Link</string>
</property>
</item>
<item>
<property name="text">
<string>UDP</string>
</property>
</item>
<item>
<property name="text">
<string>Simulation</string>
</property>
</item>
</widget>
<widget class="QComboBox" name="linkType"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
......@@ -71,13 +55,8 @@
<item row="1" column="1">
<widget class="QComboBox" name="connectionType">
<property name="currentIndex">
<number>0</number>
<number>-1</number>
</property>
<item>
<property name="text">
<string>MAVLink</string>
</property>
</item>
</widget>
</item>
</layout>
......
This diff is collapsed.
......@@ -87,8 +87,8 @@ public:
~MainWindow();
public slots:
/** @brief Store the mainwindow settings */
void storeSettings();
// /** @brief Store the mainwindow settings */
// void storeSettings();
/**
* @brief Shows a status message on the bottom status bar
......@@ -122,22 +122,8 @@ public slots:
void loadEngineerView();
/** @brief Load view for operator */
void loadOperatorView();
/** @brief Load 3D view */
void load3DView();
/** @brief Load 3D Google Earth view */
void loadGoogleEarthView();
/** @brief Load 3D map view */
void load3DMapView();
/** @brief Load view with all widgets */
void loadAllView();
/** @brief Load MAVLink XML generator view */
void loadMAVLinkView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Load view for global operator, allowing to flight on earth */
void loadGlobalOperatorView();
/** @brief Show the online help for users */
void showHelp();
......@@ -146,25 +132,200 @@ public slots:
/** @brief Show the project roadmap */
void showRoadMap();
// Fixme find a nicer solution that scales to more AP types
void loadSlugsView();
void loadPixhawkView();
/** @brief Shows the widgets based on configuration and current view and autopilot */
void presentView();
/** @brief Reload the CSS style sheet */
void reloadStylesheet();
/*
==========================================================
Potentially Deprecated
==========================================================
*/
void loadPixhawkEngineerView();
/** @brief Load view with all widgets */
void loadAllView();
void loadWidgets();
/** @brief Load data view, allowing to plot flight data */
void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Load 3D map view */
void load3DMapView();
/** @brief Load 3D Google Earth view */
void loadGoogleEarthView();
/** @brief Load 3D view */
void load3DView();
/**
* @brief Shows a Docked Widget based on the action sender
*
* This slot is written to be used in conjunction with the addToToolsMenu function
* It shows the QDockedWidget based on the action sender
*
*/
void showToolWidget();
/**
* @brief Shows a Widget from the center stack based on the action sender
*
* This slot is written to be used in conjunction with the addToCentralWidgetsMenu function
* It shows the Widget based on the action sender
*
*/
void showCentralWidget();
/** @brief Updates a QDockWidget's checked status based on its visibility */
void updateVisibilitySettings (bool vis);
/** @brief Updates a QDockWidget's location */
void updateLocationSettings (Qt::DockWidgetArea location);
protected:
// These defines are used to save the settings when selecting with
// which widgets populate the views
// FIXME: DO NOT PUT CUSTOM VALUES IN THIS ENUM since it is iterated over
// this will be fixed in a future release.
typedef enum _TOOLS_WIDGET_NAMES {
MENU_UAS_CONTROL,
MENU_UAS_INFO,
MENU_CAMERA,
MENU_UAS_LIST,
MENU_WAYPOINTS,
MENU_STATUS,
MENU_DETECTION,
MENU_DEBUG_CONSOLE,
MENU_PARAMETERS,
MENU_HDD_1,
MENU_HDD_2,
MENU_WATCHDOG,
MENU_HUD,
MENU_HSI,
MENU_RC_VIEW,
MENU_SLUGS_DATA,
MENU_SLUGS_PID,
MENU_SLUGS_HIL,
MENU_SLUGS_CAMERA,
CENTRAL_SEPARATOR= 255, // do not change
CENTRAL_LINECHART,
CENTRAL_PROTOCOL,
CENTRAL_MAP,
CENTRAL_3D_LOCAL,
CENTRAL_3D_MAP,
CENTRAL_OSGEARTH,
CENTRAL_GOOGLE_EARTH,
CENTRAL_HUD,
CENTRAL_DATA_PLOT,
}TOOLS_WIDGET_NAMES;
typedef enum _SETTINGS_SECTIONS {
SECTION_MENU,
SUB_SECTION_CHECKED,
SUB_SECTION_LOCATION,
} SETTINGS_SECTIONS;
typedef enum _VIEW_SECTIONS {
VIEW_ENGINEER,
VIEW_OPERATOR,
VIEW_PILOT,
VIEW_MAVLINK,
} VIEW_SECTIONS;
QHash<int, QAction*> toolsMenuActions; // Holds ptr to the Menu Actions
QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
QHash<int, Qt::DockWidgetArea> dockWidgetLocations; // Holds the location
/**
* @brief Adds an already instantiated QDockedWidget to the Tools Menu
*
* This function does all the hosekeeping to have a QDockedWidget added to the
* tools menu and connects the QMenuAction to a slot that shows the widget and
* checks/unchecks the tools menu item
*
* @param widget The QDockedWidget being added
* @param title The entry that will appear in the Menu and in the QDockedWidget title bar
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param tool The ENUM defined in MainWindow.h that is associated to the widget
* @param location The default location for the QDockedWidget in case there is no previous key in the settings
*/
void addToToolsMenu (QWidget* widget, const QString title, const char * slotName, TOOLS_WIDGET_NAMES tool, Qt::DockWidgetArea location);
/**
* @brief Determines if a QDockWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param widget The QDockWidget requested to be shown
* @param view The view for which the QDockWidget is requested
*/
void showTheWidget (TOOLS_WIDGET_NAMES widget, VIEW_SECTIONS view = VIEW_MAVLINK);
/**
* @brief Adds an already instantiated QWidget to the center stack
*
* This function does all the hosekeeping to have a QWidget added to the tools menu
* tools menu and connects the QMenuAction to a slot that shows the widget and
* checks/unchecks the tools menu item. This is used for all the central widgets (those in
* the center stack.
*
* @param widget The QWidget being added
* @param title The entry that will appear in the Menu
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param centralWidget The ENUM defined in MainWindow.h that is associated to the widget
*/
void addToCentralWidgetsMenu ( QWidget* widget, const QString title,const char * slotName, TOOLS_WIDGET_NAMES centralWidget);
/**
* @brief Determines if a QWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param centralWidget The QWidget requested to be shown
* @param view The view for which the QWidget is requested
*/
void showTheCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SECTIONS view);
/** @brief Keeps track of the current view */
VIEW_SECTIONS currentView;
QStatusBar* statusBar;
QStatusBar* createStatusBar();
void loadWidgets();
void connectActions();
void clearView();
void buildWidgets();
void connectWidgets();
void arrangeCenterStack();
void configureWindowName();
QMenu* createCenterWidgetMenu();
QMenu* createDockWidgetMenu();
void buildCommonWidgets();
void buildPxWidgets();
void buildSlugsWidgets();
void connectCommonWidgets();
void connectPxWidgets();
void connectSlugsWidgets();
void arrangeCommonCenterStack();
void arrangePxCenterStack();
void arrangeSlugsCenterStack();
void connectCommonActions();
void connectPxActions();
void connectSlugsActions();
void configureWindowName();
// TODO Should be moved elsewhere, as the protocol does not belong to the UI
MAVLinkProtocol* mavlink;
......@@ -174,13 +335,13 @@ protected:
LinkInterface* udpLink;
QSettings settings;
// Widget lists
QList<QPointer<QWidget> > centerWidgets;
QList<QPointer<QDockWidget> > dockWidgets;
QStackedWidget *centerStack;
// Center widgets
QPointer<Linecharts> linechartWidget;
QPointer<HUD> hudWidget;
QPointer<MapWidget> mapWidget;
QPointer<XMLCommProtocolWidget> protocolWidget;
QPointer<QGCDataPlot2D> dataplotWidget;
......@@ -203,7 +364,9 @@ protected:
QPointer<QDockWidget> headDown1DockWidget;
QPointer<QDockWidget> headDown2DockWidget;
QPointer<QDockWidget> watchdogControlDockWidget;
QPointer<QDockWidget> headUpDockWidget;
QPointer<QDockWidget> hsiDockWidget;
QPointer<QDockWidget> rcViewDockWidget;
QPointer<QDockWidget> hudDockWidget;
......@@ -227,6 +390,7 @@ protected:
QAction* killUASAct;
QAction* simulateUASAct;
LogCompressor* comp;
QString screenFileName;
QTimer* videoTimer;
......@@ -234,6 +398,8 @@ protected:
private:
Ui::MainWindow ui;
QString buildMenuKey (SETTINGS_SECTIONS section , TOOLS_WIDGET_NAMES tool, VIEW_SECTIONS view);
};
#endif /* _MAINWINDOW_H_ */
......@@ -38,19 +38,17 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuUnmanned_System">
<widget class="QMenu" name="menuMGround">
<property name="title">
<string>Unmanned System</string>
<string>File</string>
</property>
<addaction name="actionLiftoff"/>
<addaction name="actionLand"/>
<addaction name="actionEmergency_Land"/>
<addaction name="actionEmergency_Kill"/>
<addaction name="actionJoystick_Settings"/>
<addaction name="actionSimulate"/>
<addaction name="separator"/>
<addaction name="actionConfiguration"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuNetwork">
<property name="title">
......@@ -59,61 +57,58 @@
<addaction name="actionAdd_Link"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuWindow">
<widget class="QMenu" name="menuConnected_Systems">
<property name="title">
<string>Select System</string>
</property>
</widget>
<widget class="QMenu" name="menuUnmanned_System">
<property name="title">
<string>Window</string>
<string>Unmanned System</string>
</property>
<property name="separatorsCollapsible">
<bool>false</bool>
</property>
<addaction name="actionEngineerView"/>
<addaction name="actionPilotView"/>
<addaction name="actionOperatorView"/>
<addaction name="action3DMapView"/>
<addaction name="action3DView"/>
<addaction name="actionGoogleEarthView"/>
<addaction name="actionGlobalOperatorView"/>
<addaction name="actionLiftoff"/>
<addaction name="actionLand"/>
<addaction name="actionEmergency_Land"/>
<addaction name="actionEmergency_Kill"/>
<addaction name="separator"/>
<addaction name="actionShow_MAVLink_view"/>
<addaction name="actionShow_data_analysis_view"/>
<addaction name="actionShow_full_view"/>
<addaction name="actionStyleConfig"/>
<addaction name="actionShow_Slugs_View"/>
<addaction name="actionConfiguration"/>
</widget>
<widget class="QMenu" name="menuHelp">
<widget class="QMenu" name="menuTools">
<property name="title">
<string>Help</string>
<string>Tools</string>
</property>
<addaction name="actionOnline_documentation"/>
<addaction name="actionProject_Roadmap"/>
<addaction name="actionCredits_Developers"/>
</widget>
<widget class="QMenu" name="menuConnected_Systems">
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Select System</string>
<string>Help</string>
</property>
<addaction name="actionOnline_Documentation"/>
<addaction name="actionProject_Roadmap_2"/>
<addaction name="actionDeveloper_Credits"/>
</widget>
<widget class="QMenu" name="menuMGround">
<widget class="QMenu" name="menuPerspectives">
<property name="title">
<string>File</string>
<string>Perspectives</string>
</property>
<addaction name="actionJoystickSettings"/>
<addaction name="actionSimulate"/>
<addaction name="actionOperatorsView"/>
<addaction name="actionEngineersView"/>
<addaction name="actionPilotsView"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
<addaction name="actionMavlinkView"/>
<addaction name="actionReloadStyle"/>
</widget>
<addaction name="menuMGround"/>
<addaction name="menuNetwork"/>
<addaction name="menuConnected_Systems"/>
<addaction name="menuUnmanned_System"/>
<addaction name="menuWindow"/>
<addaction name="menuTools"/>
<addaction name="menuPerspectives"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionExit">
<property name="icon">
......@@ -218,6 +213,9 @@
<property name="text">
<string>Joystick settings</string>
</property>
<property name="visible">
<bool>true</bool>
</property>
</action>
<action name="actionOperatorView">
<property name="icon">
......@@ -348,6 +346,90 @@
<string>Show Slugs View</string>
</property>
</action>
<action name="actionJoystick_Settings">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/input-gaming.svg</normaloff>:/images/devices/input-gaming.svg</iconset>
</property>
<property name="text">
<string>Joystick Settings</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="actionOnline_Documentation">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Online Documentation</string>
</property>
</action>
<action name="actionProject_Roadmap_2">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/software-update-available.svg</normaloff>:/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
<string>Project Roadmap</string>
</property>
</action>
<action name="actionDeveloper_Credits">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/preferences-system.svg</normaloff>:/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
<string>Developer Credits</string>
</property>
</action>
<action name="actionOperatorsView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset>
</property>
<property name="text">
<string>Operator</string>
</property>
</action>
<action name="actionEngineersView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Engineer</string>
</property>
</action>
<action name="actionMavlinkView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset>
</property>
<property name="text">
<string>Mavlink</string>
</property>
</action>
<action name="actionReloadStyle">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Reload Style</string>
</property>
</action>
<action name="actionPilotsView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset>
</property>
<property name="text">
<string>Pilot</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
......@@ -372,3 +454,5 @@
</connection>
</connections>
</ui>
......@@ -562,6 +562,7 @@ void MapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lon,
// Icon
QPen* pointpen = new QPen(uasColor);
qDebug() << uas->getUASName();
MAV2DIcon* p = new MAV2DIcon(lat, lon, 20, uas->getUASName(), qmapcontrol::Point::Middle, pointpen);
uasIcons.insert(uas->getUASID(), p);
geomLayer->addGeometry(p);
......
......@@ -51,6 +51,15 @@ ParameterInterface::ParameterInterface(QWidget *parent) :
// Setup UI connections
connect(m_ui->vehicleComboBox, SIGNAL(activated(int)), this, SLOT(selectUAS(int)));
// Get current MAV list
QList<UASInterface*> systems = UASManager::instance()->getUASList();
// Add each of them
foreach (UASInterface* sys, systems)
{
addUAS(sys);
}
// Setup MAV connections
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(addUAS(UASInterface*)));
this->setVisible(false);
......
......@@ -115,10 +115,10 @@ void QGCRemoteControlView::setUASId(int id)
connect(newUAS, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), this, SLOT(setChannelRaw(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannelRaw(int,float)));
// connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannelRaw(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), calibrationWindow, SLOT(setChannelScaled(int,float)));
// connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), calibrationWindow, SLOT(setChannelScaled(int,float)));
}
}
......
......@@ -510,12 +510,3 @@ void SerialConfigurationWindow::setLinkName(QString name)
setWindowTitle(tr("Configuration of ") + link->getName());
}
void SerialConfigurationWindow::remove()
{
link->disconnect();
//delete link;
//delete action;
this->window()->close();
qDebug() << "TODO: Link cannot be deleted: SerialConfigurationWindow::remove() NOT IMPLEMENTED!";
}
......@@ -60,12 +60,6 @@ public slots:
void setParityEven();
void setPortName(QString port);
void setLinkName(QString name);
/**
* @brief Remove this link
*
* Disconnects the associated link, removes it from all menus and closes the window.
*/
void remove();
void setupPortList();
protected slots:
......
......@@ -41,10 +41,12 @@ void SlugsDataSensorView::addUAS(UASInterface* uas)
connect(slugsMav, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugSpeedLocalPositionChanged(UASInterface*,double,double,double,quint64)));
connect(slugsMav, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugAttitudeChanged(UASInterface*,double,double,double,quint64)));
connect(slugsMav, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugsGlobalPositionChanged(UASInterface*,double,double,double,quint64)));
connect(slugsMav,SIGNAL(slugsGPSCogSog(int,double,double)),this,SLOT(slugsGPSCogSog(int,double,double)));
//connect slugs especial messages
//connect slugs especial messages
connect(slugsMav, SIGNAL(slugsSensorBias(int,const mavlink_sensor_bias_t&)), this, SLOT(slugsSensorBiasChanged(int,const mavlink_sensor_bias_t&)));
connect(slugsMav, SIGNAL(slugsDiagnostic(int,const mavlink_diagnostic_t&)), this, SLOT(slugsDiagnosticMessageChanged(int,const mavlink_diagnostic_t&)));
connect(slugsMav, SIGNAL(slugsCPULoad(int,const mavlink_cpu_load_t&)), this, SLOT(slugsCpuLoadChanged(int,const mavlink_cpu_load_t&)));
......@@ -53,6 +55,8 @@ void SlugsDataSensorView::addUAS(UASInterface* uas)
connect(slugsMav, SIGNAL(slugsPWM(int,const mavlink_pwm_commands_t&)),this,SLOT(slugsPWMChanged(int,const mavlink_pwm_commands_t&)));
connect(slugsMav, SIGNAL(slugsFilteredData(int,const mavlink_filtered_data_t&)),this,SLOT(slugsFilteredDataChanged(int,const mavlink_filtered_data_t&)));
connect(slugsMav, SIGNAL(slugsGPSDateTime(int,const mavlink_gps_date_time_t&)),this,SLOT(slugsGPSDateTimeChanged(int,const mavlink_gps_date_time_t&)));
connect(slugsMav,SIGNAL(slugsAirData(int, const mavlink_air_data_t&)),this,SLOT(slugsAirDataChanged(int, const mavlink_air_data_t&)));
#endif // MAVLINK_ENABLED_SLUGS
// Set this UAS as active if it is the first one
......@@ -69,6 +73,15 @@ void SlugsDataSensorView::slugRawDataChanged(int uasId, const mavlink_raw_imu_t
ui->m_Axr->setText(QString::number(rawData.xacc));
ui->m_Ayr->setText(QString::number(rawData.yacc));
ui->m_Azr->setText(QString::number(rawData.zacc));
ui->m_Mxr->setText(QString::number(rawData.xmag));
ui->m_Myr->setText(QString::number(rawData.ymag));
ui->m_Mzr->setText(QString::number(rawData.zmag));
ui->m_Gxr->setText(QString::number(rawData.xgyro));
ui->m_Gyr->setText(QString::number(rawData.ygyro));
ui->m_Gzr->setText(QString::number(rawData.zgyro));
}
void SlugsDataSensorView::setActiveUAS(UASInterface* uas){
......@@ -85,9 +98,13 @@ void SlugsDataSensorView::slugsGlobalPositionChanged(UASInterface *uas,
Q_UNUSED(uas);
Q_UNUSED(time);
ui->m_GpsLatitude->setText(QString::number(lat));
ui->m_GpsLongitude->setText(QString::number(lon));
ui->m_GpsHeight->setText(QString::number(alt));
qDebug()<<"GPS Position = "<<lat<<" - "<<lon<<" - "<<alt;
}
......@@ -103,6 +120,8 @@ void SlugsDataSensorView::slugLocalPositionChanged(UASInterface* uas,
ui->ed_y->setPlainText(QString::number(y));
ui->ed_z->setPlainText(QString::number(z));
//qDebug()<<"Local Position = "<<x<<" - "<<y<<" - "<<z;
}
void SlugsDataSensorView::slugSpeedLocalPositionChanged(UASInterface* uas,
......@@ -117,6 +136,9 @@ void SlugsDataSensorView::slugSpeedLocalPositionChanged(UASInterface* uas,
ui->ed_vy->setPlainText(QString::number(vy));
ui->ed_vz->setPlainText(QString::number(vz));
//qDebug()<<"Speed Local Position = "<<vx<<" - "<<vy<<" - "<<vz;
}
void SlugsDataSensorView::slugAttitudeChanged(UASInterface* uas,
......@@ -132,6 +154,8 @@ void SlugsDataSensorView::slugAttitudeChanged(UASInterface* uas,
ui->m_Pitch->setPlainText(QString::number(slugpitch));
ui->m_Yaw->setPlainText(QString::number(slugyaw));
qDebug()<<"Attitude change = "<<slugroll<<" - "<<slugpitch<<" - "<<slugyaw;
}
......@@ -148,6 +172,7 @@ void SlugsDataSensorView::slugsSensorBiasChanged(int systemId,
}
void SlugsDataSensorView::slugsDiagnosticMessageChanged(int systemId,
const mavlink_diagnostic_t& diagnostic){
Q_UNUSED(systemId);
......@@ -229,17 +254,75 @@ void SlugsDataSensorView::slugsFilteredDataChanged(int systemId,
void SlugsDataSensorView::slugsGPSDateTimeChanged(int systemId,
const mavlink_gps_date_time_t& gpsDateTime){
Q_UNUSED(systemId);
ui->m_GpsDate->setText(QString::number(gpsDateTime.month) + "/" +
QString::number(gpsDateTime.day) + "/" +
QString month, day;
month = QString::number(gpsDateTime.month);
day = QString::number(gpsDateTime.day);
if(gpsDateTime.month < 10) month = "0" + QString::number(gpsDateTime.month);
if(gpsDateTime.day < 10) day = "0" + QString::number(gpsDateTime.day);
ui->m_GpsDate->setText(day + "/" +
month + "/" +
QString::number(gpsDateTime.year));
ui->m_GpsTime->setText(QString::number(gpsDateTime.hour) + ":" +
QString::number(gpsDateTime.min) + ":" +
QString::number(gpsDateTime.sec));
QString hour, min, sec;
hour = QString::number(gpsDateTime.hour);
min = QString::number(gpsDateTime.min);
sec = QString::number(gpsDateTime.sec);
if(gpsDateTime.hour < 10) hour = "0" + QString::number(gpsDateTime.hour);
if(gpsDateTime.min < 10) min = "0" + QString::number(gpsDateTime.min);
if(gpsDateTime.sec < 10) sec = "0" + QString::number(gpsDateTime.sec);
ui->m_GpsTime->setText(hour + ":" +
min + ":" +
sec);
ui->m_GpsSat->setText(QString::number(gpsDateTime.visSat));
}
/**
* @brief Updates the air data widget - 171
*/
void SlugsDataSensorView::slugsAirDataChanged(int systemId, const mavlink_air_data_t &airData)
{
Q_UNUSED(systemId);
ui->ed_dynamic->setText(QString::number(airData.dynamicPressure));
ui->ed_static->setText(QString::number(airData.staticPressure));
ui->ed_temp->setText(QString::number(airData.temperature));
// qDebug()<<"Air Data = "<<airData.dynamicPressure<<" - "
// <<airData.staticPressure<<" - "
// <<airData.temperature;
}
/**
* @brief set COG and SOG values
*
* COG and SOG GPS display on the Widgets
*/
void SlugsDataSensorView::slugsGPSCogSog(int systemId,
double cog,
double sog)
{
Q_UNUSED(systemId);
ui->m_GpsCog->setText(QString::number(cog));
ui->m_GpsSog->setText(QString::number(sog));
}
#endif // MAVLINK_ENABLED_SLUGS
......@@ -70,6 +70,9 @@ public slots:
void setActiveUAS(UASInterface* uas);
/**
* @brief Updates the Raw Data widget
*/
void slugRawDataChanged (int uasId, const mavlink_raw_imu_t& rawData);
#ifdef MAVLINK_ENABLED_SLUGS
......@@ -114,58 +117,79 @@ public slots:
double lon,
double alt,
quint64 time);
/**
* @brief Updates the sensor bias widget
* @brief set COG and SOG values
*
* COG and SOG GPS display on the Widgets
*/
void slugsGPSCogSog(int systemId,
double cog,
double sog);
/**
* @brief Updates the CPU load widget - 170
*/
void slugsCpuLoadChanged(int systemId,
const mavlink_cpu_load_t& cpuLoad);
/**
* @brief Updates the air data widget - 171
*/
void slugsAirDataChanged(int systemId,
const mavlink_air_data_t& airData);
/**
* @brief Updates the sensor bias widget - 172
*/
void slugsSensorBiasChanged(int systemId,
const mavlink_sensor_bias_t& sensorBias);
/**
* @brief Updates the diagnostic widget
* @brief Updates the diagnostic widget - 173
*/
void slugsDiagnosticMessageChanged(int systemId,
const mavlink_diagnostic_t& diagnostic);
/**
* @brief Updates the CPU load widget
*/
void slugsCpuLoadChanged(int systemId,
const mavlink_cpu_load_t& cpuLoad);
/**
* @brief Updates the Navigation widget
* @brief Updates the Navigation widget - 176
*/
void slugsNavegationChanged(int systemId,
const mavlink_slugs_navigation_t& slugsNavigation);
/**
* @brief Updates the Data Log widget
* @brief Updates the Data Log widget - 177
*/
void slugsDataLogChanged(int systemId,
const mavlink_data_log_t& dataLog);
/**
* @brief Updates the PWM Commands widget
* @brief Updates the PWM Commands widget - 175
*/
void slugsPWMChanged(int systemId,
const mavlink_pwm_commands_t& pwmCommands);
/**
* @brief Updates the filtered sensor measurements widget
* @brief Updates the filtered sensor measurements widget - 178
*/
void slugsFilteredDataChanged(int systemId,
const mavlink_filtered_data_t& filteredData);
/**
* @brief Updates the gps Date Time widget
* @brief Updates the gps Date Time widget - 179
*/
void slugsGPSDateTimeChanged(int systemId,
const mavlink_gps_date_time_t& gpsDateTime);
#endif // MAVLINK_ENABLED_SLUGS
protected:
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>399</width>
<height>667</height>
<height>604</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -24,18 +24,18 @@
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
<width>399</width>
<height>604</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<layout class="QGridLayout" name="gridLayout_23">
<item row="0" column="0">
<widget class="QTabWidget" name="SlugsSensorView_tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
......@@ -989,7 +989,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>13</height>
<height>5</height>
</size>
</property>
</spacer>
......@@ -1791,8 +1791,8 @@
<attribute name="title">
<string>Tab 2</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QGroupBox" name="gpsData_groupBox">
......@@ -4483,11 +4483,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 4</string>
</attribute>
</widget>
</widget>
</item>
</layout>
......
......@@ -55,6 +55,7 @@ void SlugsPIDControl::activeUasSet(UASInterface* uas)
connect(slugsMav,SIGNAL(slugsPidValues(int,mavlink_pid_t)),this, SLOT(receivePidValues(int,mavlink_pid_t)) );
connect(ui->setGeneral_pushButton,SIGNAL(clicked()),this,SLOT(slugsTimerStartSet()));
connect(ui->getGeneral_pushButton,SIGNAL(clicked()),this,SLOT(slugsTimerStartGet()));
}
#endif // MAVLINK_ENABLED_SLUG
......@@ -473,9 +474,9 @@ void SlugsPIDControl::changeColor_GREEN_Pitch2dT_groupBox()
//create the packet
pidMessage.target = activeUAS->getUASID();
pidMessage.idx = 8;
pidMessage.pVal = ui->dR_P_set->text().toFloat();
pidMessage.iVal = ui->dR_I_set->text().toFloat();
pidMessage.dVal = ui->dR_D_set->text().toFloat();
pidMessage.pVal = ui->P2dT_FF_set->text().toFloat();
pidMessage.iVal = 0;//ui->dR_I_set->text().toFloat();
pidMessage.dVal = 0;//ui->dR_D_set->text().toFloat();
mavlink_message_t msg;
......@@ -543,6 +544,7 @@ void SlugsPIDControl::receivePidValues(int systemId, const mavlink_pid_t &pidVal
break;
case 8:
ui->P2dT_FF_get->setText(QString::number(pidValues.pVal));
break;
default:
......
......@@ -283,10 +283,10 @@ private:
#endif
QTimer* refreshTimerSet; ///< The main timer, controls the update view
QTimer* refreshTimerGet; ///< The main timer, controls the update view
QTimer* refreshTimerGet; ///< The main timer, controls the update view
int counterRefreshSet;
int counterRefreshGet;
QMutex valuesMutex;
QMutex valuesMutex;
};
#endif // SLUGSPIDCONTROL_H
......@@ -121,13 +121,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="recepcion_label">
<property name="text">
<string>Recepcion</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
......@@ -956,6 +949,13 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="recepcion_label">
<property name="text">
<string>Recepcion</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......
......@@ -13,6 +13,9 @@ SlugsPadCameraControl::SlugsPadCameraControl(QWidget *parent) :
ui->setupUi(this);
x1= 0;
y1 = 0;
bearingPad = 0;
distancePad = 0;
directionPad = "no";
}
......@@ -23,13 +26,25 @@ SlugsPadCameraControl::~SlugsPadCameraControl()
void SlugsPadCameraControl::mouseMoveEvent(QMouseEvent *event)
{
emit mouseMoveCoord(event->x(),event->y());
//emit mouseMoveCoord(event->x(),event->y());
if(dragging)
{
if(abs(x1-event->x())>20 || abs(y1-event->y())>20)
{
getDeltaPositionPad(event->x(), event->y());
x1 = event->x();
y1 = event->y();
}
}
}
void SlugsPadCameraControl::mousePressEvent(QMouseEvent *event)
{
emit mousePressCoord(event->x(),event->y());
//emit mousePressCoord(event->x(),event->y());
dragging = true;
x1 = event->x();
y1 = event->y();
......@@ -37,8 +52,13 @@ void SlugsPadCameraControl::mousePressEvent(QMouseEvent *event)
void SlugsPadCameraControl::mouseReleaseEvent(QMouseEvent *event)
{
emit mouseReleaseCoord(event->x(),event->y());
getDeltaPositionPad(event->x(), event->y());
dragging = false;
//emit mouseReleaseCoord(event->x(),event->y());
//getDeltaPositionPad(event->x(), event->y());
xFin = event->x();
yFin = event->y();
}
......@@ -59,6 +79,13 @@ void SlugsPadCameraControl::paintEvent(QPaintEvent *pe)
painter.drawLine(QPoint(ui->frame->geometry().topLeft().x(),ui->frame->height()/2),
QPoint(ui->frame->geometry().bottomRight().x(),ui->frame->height()/2));
painter.setPen(Qt::white);
//QPointF coordTemp = getPointBy_BearingDistance(ui->frame->width()/2,ui->frame->height()/2,bearingPad,distancePad);
painter.drawLine(QPoint(ui->frame->width()/2,ui->frame->height()/2),
QPoint(xFin,yFin));
// painter.drawLine(QPoint());
//painter.drawLines(padLines);
......@@ -92,7 +119,7 @@ void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2)
{
emit dirCursorText("right up");
//bearing = 315;
dir = "riht up";
dir = "right up";
}
else
{
......@@ -100,7 +127,7 @@ void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2)
{
emit dirCursorText("right");
//bearing = 315;
dir = "riht";
dir = "right";
}
else
{
......@@ -108,7 +135,7 @@ void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2)
{
emit dirCursorText("right down");
//bearing = 315;
dir = "riht down";
dir = "right down";
}
else
{
......@@ -158,8 +185,15 @@ void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2)
}
bearingPad = bearing;
distancePad = dist;
directionPad = dir;
emit changeCursorPosition(bearing, dist, dir);
update();
}
double SlugsPadCameraControl::getDistPixel(int x1, int y1, int x2, int y2)
......@@ -229,3 +263,19 @@ QPointF SlugsPadCameraControl::ObtenerMarcacionDistanciaPixel(double lon1, doubl
return QPointF(marcacion,distancia);
}
QPointF SlugsPadCameraControl::getPointBy_BearingDistance(double lat1, double lon1, double rumbo, double distancia)
{
double lon2 = 0;
double lat2 = 0;
double rad= M_PI/180;
rumbo = rumbo*rad;
lon2=(lon1 + ((distancia/60) * (sin(rumbo))));
lat2=(lat1 + ((distancia/60) * (cos(rumbo))));
return QPointF(lon2,lat2);
}
......@@ -21,6 +21,9 @@ public slots:
void getDeltaPositionPad(int x, int y);
double getDistPixel(int x1, int y1, int x2, int y2);
QPointF ObtenerMarcacionDistanciaPixel(double lon1, double lat1, double lon2, double lat2);
QPointF getPointBy_BearingDistance(double lat1, double lon1, double rumbo, double distancia);
signals:
void mouseMoveCoord(int x, int y);
......@@ -36,11 +39,17 @@ protected:
void mouseMoveEvent(QMouseEvent* event);
void paintEvent(QPaintEvent *pe);
private:
Ui::SlugsPadCameraControl *ui;
bool dragging;
int x1;
int y1;
int xFin;
int yFin;
double bearingPad;
double distancePad;
QString directionPad;
};
......
......@@ -20,29 +20,12 @@
SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsVideoCamControl)
//dragging(0)
{
ui->setupUi(this);
// x1= 0;
// y1 = 0;
connect(ui->viewCamBordeatMap_checkBox,SIGNAL(clicked(bool)),this,SLOT(changeViewCamBorderAtMapStatus(bool)));
// tL = ui->padCamContro_frame->frameGeometry().topLeft();
// bR = ui->padCamContro_frame->frameGeometry().bottomRight();
//ui->padCamContro_frame->setVisible(true);
// // create a layout for camera pad
// QGridLayout* padCameraLayout = new QGridLayout(this);
// padCameraLayout->setSpacing(2);
// padCameraLayout->setMargin(0);
// padCameraLayout->setAlignment(Qt::AlignTop);
//ui->padCamContro_frame->setLayout(padCameraLayout);
// create a camera pad widget
//test = new QPushButton(QIcon(":/images/actions/list-add.svg"), "", this);
//test->setMaximumWidth(50);
//ui->gridLayout->addWidget(test, 0,0);
connect(ui->viewCamBordeatMap_checkBox,SIGNAL(clicked(bool)),this,SLOT(changeViewCamBorderAtMapStatus(bool)));
padCamera = new SlugsPadCameraControl(this);
ui->gridLayout->addWidget(padCamera);
......@@ -53,28 +36,6 @@ SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
connect(padCamera,SIGNAL(changeCursorPosition(double,double,QString)),this,SLOT(getDeltaPositionPad(double,double,QString)));
//padCamera->setVisible(true);
// padCameraLayout->addWidget(padCamera);
// QGraphicsScene *scene = new QGraphicsScene(ui->CamControlPanel_graphicsView);
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
// scene->setSceneRect(-200, -200, 400, 400);
// setScene(scene);
// setCacheMode(CacheBackground);
// setViewportUpdateMode(BoundingRectViewportUpdate);
// setRenderHint(QPainter::Antialiasing);
// setTransformationAnchor(AnchorUnderMouse);
// setResizeAnchor(AnchorViewCenter);
// ui->CamControlPanel_graphicsView->installEventFilter(this);
// ui->label_x->installEventFilter(this);
}
SlugsVideoCamControl::~SlugsVideoCamControl()
......@@ -82,41 +43,41 @@ SlugsVideoCamControl::~SlugsVideoCamControl()
delete ui;
}
void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event)
{
Q_UNUSED(event);
//void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event)
//{
// Q_UNUSED(event);
}
//}
void SlugsVideoCamControl::mousePressEvent(QMouseEvent *evnt)
{
Q_UNUSED(evnt);
//void SlugsVideoCamControl::mousePressEvent(QMouseEvent *evnt)
//{
// Q_UNUSED(evnt);
}
//}
void SlugsVideoCamControl::mouseReleaseEvent(QMouseEvent *evnt)
{
Q_UNUSED(evnt);
//void SlugsVideoCamControl::mouseReleaseEvent(QMouseEvent *evnt)
//{
// Q_UNUSED(evnt);
}
//}
void SlugsVideoCamControl::mousePadMoveEvent(int x, int y)
{
//void SlugsVideoCamControl::mousePadMoveEvent(int x, int y)
//{
}
//}
void SlugsVideoCamControl::mousePadPressEvent(int x, int y)
{
//void SlugsVideoCamControl::mousePadPressEvent(int x, int y)
//{
}
//}
void SlugsVideoCamControl::mousePadReleaseEvent(int x, int y)
{
//void SlugsVideoCamControl::mousePadReleaseEvent(int x, int y)
//{
}
//}
void SlugsVideoCamControl::changeViewCamBorderAtMapStatus(bool status)
{
......
......@@ -27,22 +27,43 @@ public:
~SlugsVideoCamControl();
public slots:
/**
* @brief status = true: emit signal to draw a border cam over the map
*/
void changeViewCamBorderAtMapStatus(bool status);
void getDeltaPositionPad(double dir, double dist, QString dirText);
void mousePadPressEvent(int x, int y);
void mousePadReleaseEvent(int x, int y);
void mousePadMoveEvent(int x, int y);
/**
* @brief show the values of mousepad on ui (labels) and emit a changeCamPosition(signal)
* with values:
* bearing and distance from mouse over the pad
* dirText: direction of mouse movement in text format (up, right,right up,right down,
* left, left up, left down, down)
*/
void getDeltaPositionPad(double bearing, double distance, QString dirText);
// /**
// * @brief
// */
// void mousePadPressEvent(int x, int y);
// void mousePadReleaseEvent(int x, int y);
// void mousePadMoveEvent(int x, int y);
signals:
void changeCamPosition(double dist, double dir, QString textDir);
/**
* @brief emit values from mousepad:
* bearing and distance from mouse over the pad
* dirText: direction of mouse movement in text format (up, right,right up,right down,
* left, left up, left down, down)
*/
void changeCamPosition(double distance, double bearing, QString textDir);
/**
* @brief emit signal to draw a border cam over the map if status is true
*/
void viewCamBorderAtMap(bool status);
protected:
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
// void mousePressEvent(QMouseEvent* event);
// void mouseReleaseEvent(QMouseEvent* event);
// void mouseMoveEvent(QMouseEvent* event);
......
......@@ -153,7 +153,7 @@ void WaypointList::loadWaypoints()
QString fileName = QFileDialog::getOpenFileName(this, tr("Load File"), ".", tr("Waypoint File (*.txt)"));
uas->getWaypointManager().loadWaypoints(fileName);
}
}
}
void WaypointList::transmit()
......@@ -474,14 +474,14 @@ void WaypointList::on_clearWPListButton_clicked()
if (uas)
{
emit clearPathclicked();
emit clearPathclicked();
const QVector<Waypoint *> &waypoints = uas->getWaypointManager().getWaypointList();
while(!waypoints.isEmpty())//for(int i = 0; i <= waypoints.size(); i++)
{
WaypointView* widget = wpViews.find(waypoints[0]).value();
widget->remove();
}
}
}
else
{
// if(isGlobalWP)
......
......@@ -146,6 +146,7 @@ void WaypointView::changedAction(int index)
break;
case MAV_ACTION_NAVIGATE:
m_ui->autoContinue->show();
m_ui->orbitSpinBox->show();
break;
case MAV_ACTION_LOITER:
m_ui->orbitSpinBox->show();
......
......@@ -56,7 +56,7 @@ maxInterval(MAX_STORAGE_INTERVAL),
timeScaleStep(DEFAULT_SCALE_INTERVAL), // 10 seconds
automaticScrollActive(false),
m_active(true),
m_groundTime(false),
m_groundTime(true),
d_data(NULL),
d_curve(NULL)
{
......
#include "Linecharts.h"
#include "UASManager.h"
Linecharts::Linecharts(QWidget *parent) :
QStackedWidget(parent),
......@@ -6,6 +7,18 @@ Linecharts::Linecharts(QWidget *parent) :
active(true)
{
this->setVisible(false);
// Get current MAV list
QList<UASInterface*> systems = UASManager::instance()->getUASList();
// Add each of them
foreach (UASInterface* sys, systems)
{
addSystem(sys);
}
connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)),
this, SLOT(addSystem(UASInterface*)));
connect(UASManager::instance(), SIGNAL(activeUASSet(int)),
this, SLOT(selectSystem(int)));
}
......
......@@ -30,6 +30,7 @@ This file is part of the QGROUNDCONTROL project
*/
#include "GCManipulator.h"
#include <osg/Version>
GCManipulator::GCManipulator()
{
......@@ -254,7 +255,7 @@ GCManipulator::calcMovement(void)
if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON)
{
// rotate camera
#ifdef __APPLE__
#if ((OPENSCENEGRAPH_MAJOR_VERSION == 2) & (OPENSCENEGRAPH_MINOR_VERSION > 8)) | (OPENSCENEGRAPH_MAJOR_VERSION > 2)
osg::Vec3d axis;
#else
osg::Vec3 axis;
......
......@@ -38,8 +38,13 @@ This file is part of the QGROUNDCONTROL project
QMap3D::QMap3D(QWidget * parent, const char * name, WindowFlags f) :
QWidget(parent,f)
{
Q_UNUSED(name);
setupUi(this);
#if ((OPENSCENEGRAPH_MAJOR_VERSION == 2) & (OPENSCENEGRAPH_MINOR_VERSION > 8)) | (OPENSCENEGRAPH_MAJOR_VERSION > 2)
graphicsView->setCameraManipulator(new osgEarth::Util::EarthManipulator);
#else
graphicsView->setCameraManipulator(new osgEarthUtil::EarthManipulator);
#endif
graphicsView->setSceneData(new osg::Group);
graphicsView->updateCamera();
show();
......
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