Commit 19e8d0ea authored by lm's avatar lm

Merge branch 'experimental' of github.com:pixhawk/qgroundcontrol into experimental

parents 7bb6dc15 b9863c56
...@@ -368,11 +368,13 @@ namespace qmapcontrol ...@@ -368,11 +368,13 @@ namespace qmapcontrol
layermanager->zoomIn(); layermanager->zoomIn();
update(); update();
} }
void MapControl::zoomOut() void MapControl::zoomOut()
{ {
layermanager->zoomOut(); layermanager->zoomOut();
update(); update();
} }
void MapControl::setZoom(int zoomlevel) void MapControl::setZoom(int zoomlevel)
{ {
layermanager->setZoom(zoomlevel); layermanager->setZoom(zoomlevel);
......
#include "SlugsMavUnitTest.h" #include "SlugsMavUnitTest.h"
SlugsMavUnitTest::SlugsMavUnitTest() SlugsMavUnitTest::SlugsMavUnitTest()
{ {
} }
void SlugsMavUnitTest::initTestCase() void SlugsMavUnitTest::initTestCase()
{ {
mav = new MAVLinkProtocol();
} slugsMav = new SlugsMAV(mav, UASID);
}
void SlugsMavUnitTest::cleanupTestCase()
{ void SlugsMavUnitTest::cleanupTestCase()
{
} delete slugsMav;
delete mav;
void SlugsMavUnitTest::first_test() }
{
QCOMPARE(1,2); void SlugsMavUnitTest::first_test()
} {
QCOMPARE(1,1);
}
void SlugsMavUnitTest::getPwmCommands_test()
{
mavlink_pwm_commands_t* k = slugsMav->getPwmCommands();
k->aux1=80;
mavlink_pwm_commands_t* k2 = slugsMav->getPwmCommands();
k2->aux1=81;
QCOMPARE(k->aux1, k2->aux1);
}
#ifndef SLUGSMAVUNITTEST_H #ifndef SLUGSMAVUNITTEST_H
#define SLUGSMAVUNITTEST_H #define SLUGSMAVUNITTEST_H
#include <QObject> #include <QObject>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include "UAS.h"
#include "MAVLinkProtocol.h" #include "UAS.h"
#include "UASInterface.h" #include "MAVLinkProtocol.h"
#include "AutoTest.h" #include "UASInterface.h"
#include "AutoTest.h"
class SlugsMavUnitTest : public QObject #include "SlugsMAV.h"
{
Q_OBJECT class SlugsMavUnitTest : public QObject
public: {
SlugsMavUnitTest(); Q_OBJECT
signals: public:
#define UASID 5
private slots: MAVLinkProtocol* mav;
void initTestCase(); SlugsMAV* slugsMav;
void cleanupTestCase(); SlugsMavUnitTest();
void first_test(); signals:
};
private slots:
DECLARE_TEST(SlugsMavUnitTest) void initTestCase();
void cleanupTestCase();
#endif // SLUGSMAVUNITTEST_H void first_test();
void getPwmCommands_test();
};
DECLARE_TEST(SlugsMavUnitTest)
#endif // SLUGSMAVUNITTEST_H
This diff is collapsed.
...@@ -4,51 +4,63 @@ ...@@ -4,51 +4,63 @@
#include <QObject> #include <QObject>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtTest/QtTest> #include <QtTest/QtTest>
#include <QApplication>
#include "UAS.h" #include "UAS.h"
#include "MAVLinkProtocol.h" #include "MAVLinkProtocol.h"
#include "SerialLink.h" #include "SerialLink.h"
#include "UASInterface.h" #include "UASInterface.h"
#include "AutoTest.h" #include "AutoTest.h"
#include "LinkManager.h"
#include "UASWaypointManager.h"
#include "SerialLink.h"
#include "LinkInterface.h"
class UASUnitTest : public QObject class UASUnitTest : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
#define UASID 50 #define UASID 100
MAVLinkProtocol* mav; MAVLinkProtocol* mav;
UAS* uas; UAS* uas;
SerialLink* link; UASUnitTest();
UASUnitTest();
signals: signals:
private slots: private slots:
void initTestCase(); void initTestCase();
void cleanupTestCase(); void cleanupTestCase();
void getUASID_test();
void getUASName_test();
void getUpTime_test(); void getUASID_test();
void getCommunicationStatus_test(); void getUASName_test();
void filterVoltage_test(); void getUpTime_test();
void getAutopilotType_test(); void getCommunicationStatus_test();
void setAutopilotType_test(); void filterVoltage_test();
void getStatusForCode_test(); void getAutopilotType_test();
void getLocalX_test(); void setAutopilotType_test();
void getLocalY_test(); void getStatusForCode_test();
void getLocalZ_test(); void getLocalX_test();
void getLatitude_test(); void getLocalY_test();
void getLongitude_test(); void getLocalZ_test();
void getAltitude_test(); void getLatitude_test();
void getRoll_test(); void getLongitude_test();
void getPitch_test(); void getAltitude_test();
void getYaw_test(); void getRoll_test();
void attitudeLimitsZero_test(); void getPitch_test();
void attitudeLimitsPi_test(); void getYaw_test();
void attitudeLimitsMinusPi_test();
void attitudeLimitsTwoPi_test(); void getSelected_test();
void attitudeLimitsMinusTwoPi_test(); void getSystemType_test();
void attitudeLimitsTwoPiOne_test(); void getAirframe_test();
void attitudeLimitsMinusTwoPiOne_test();
void getWaypointList_test();
void getWaypoint_test();
void signalWayPoint_test();
void signalUASLink_test();
void signalIdUASLink_test();
protected: protected:
UAS *prueba; UAS *prueba;
......
...@@ -395,7 +395,8 @@ win32-g++ { ...@@ -395,7 +395,8 @@ win32-g++ {
message(Building for Windows Platform (32bit)) message(Building for Windows Platform (32bit))
# Special settings for debug # Special settings for debug
#CONFIG += CONSOLE CONFIG += CONSOLE
OUTPUT += CONSOLE
INCLUDEPATH += $$BASEDIR/lib/sdl/include \ INCLUDEPATH += $$BASEDIR/lib/sdl/include \
$$BASEDIR/lib/opal/include #\ #\ $$BASEDIR/lib/opal/include #\ #\
......
...@@ -146,8 +146,6 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -146,8 +146,6 @@ FORMS += src/ui/MainWindow.ui \
src/ui/map3D/QGCGoogleEarthView.ui \ src/ui/map3D/QGCGoogleEarthView.ui \
src/ui/SlugsDataSensorView.ui \ src/ui/SlugsDataSensorView.ui \
src/ui/SlugsHilSim.ui \ src/ui/SlugsHilSim.ui \
src/ui/SlugsPIDControl.ui \
src/ui/SlugsVideoCamControl.ui \
src/ui/SlugsPadCameraControl.ui \ src/ui/SlugsPadCameraControl.ui \
src/ui/uas/QGCUnconnectedInfoWidget.ui \ src/ui/uas/QGCUnconnectedInfoWidget.ui \
src/ui/designer/QGCToolWidget.ui \ src/ui/designer/QGCToolWidget.ui \
...@@ -159,6 +157,7 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -159,6 +157,7 @@ FORMS += src/ui/MainWindow.ui \
src/ui/mission/QGCCustomWaypointAction.ui \ src/ui/mission/QGCCustomWaypointAction.ui \
src/ui/QGCUDPLinkConfiguration.ui \ src/ui/QGCUDPLinkConfiguration.ui \
src/ui/QGCSettingsWidget.ui \ src/ui/QGCSettingsWidget.ui \
src/ui/UASControlParameters.ui \
src/ui/mission/QGCMissionDoWidget.ui \ src/ui/mission/QGCMissionDoWidget.ui \
src/ui/mission/QGCMissionConditionWidget.ui src/ui/mission/QGCMissionConditionWidget.ui
...@@ -256,8 +255,6 @@ HEADERS += src/MG.h \ ...@@ -256,8 +255,6 @@ HEADERS += src/MG.h \
src/ui/map3D/QGCWebPage.h \ src/ui/map3D/QGCWebPage.h \
src/ui/SlugsDataSensorView.h \ src/ui/SlugsDataSensorView.h \
src/ui/SlugsHilSim.h \ src/ui/SlugsHilSim.h \
src/ui/SlugsPIDControl.h \
src/ui/SlugsVideoCamControl.h \
src/ui/SlugsPadCameraControl.h \ src/ui/SlugsPadCameraControl.h \
src/ui/QGCMainWindowAPConfigurator.h \ src/ui/QGCMainWindowAPConfigurator.h \
src/comm/MAVLinkSwarmSimulationLink.h \ src/comm/MAVLinkSwarmSimulationLink.h \
...@@ -274,6 +271,7 @@ HEADERS += src/MG.h \ ...@@ -274,6 +271,7 @@ HEADERS += src/MG.h \
src/ui/QGCWaypointListMulti.h \ src/ui/QGCWaypointListMulti.h \
src/ui/QGCUDPLinkConfiguration.h \ src/ui/QGCUDPLinkConfiguration.h \
src/ui/QGCSettingsWidget.h \ src/ui/QGCSettingsWidget.h \
src/ui/uas/UASControlParameters.h \
src/ui/mission/QGCMissionDoWidget.h \ src/ui/mission/QGCMissionDoWidget.h \
src/ui/mission/QGCMissionConditionWidget.h \ src/ui/mission/QGCMissionConditionWidget.h \
src/uas/QGCUASParamManager.h src/uas/QGCUASParamManager.h
...@@ -387,8 +385,6 @@ SOURCES += src/main.cc \ ...@@ -387,8 +385,6 @@ SOURCES += src/main.cc \
src/ui/map3D/QGCWebPage.cc \ src/ui/map3D/QGCWebPage.cc \
src/ui/SlugsDataSensorView.cc \ src/ui/SlugsDataSensorView.cc \
src/ui/SlugsHilSim.cc \ src/ui/SlugsHilSim.cc \
src/ui/SlugsPIDControl.cpp \
src/ui/SlugsVideoCamControl.cpp \
src/ui/SlugsPadCameraControl.cpp \ src/ui/SlugsPadCameraControl.cpp \
src/ui/QGCMainWindowAPConfigurator.cc \ src/ui/QGCMainWindowAPConfigurator.cc \
src/comm/MAVLinkSwarmSimulationLink.cc \ src/comm/MAVLinkSwarmSimulationLink.cc \
...@@ -405,6 +401,7 @@ SOURCES += src/main.cc \ ...@@ -405,6 +401,7 @@ SOURCES += src/main.cc \
src/ui/QGCWaypointListMulti.cc \ src/ui/QGCWaypointListMulti.cc \
src/ui/QGCUDPLinkConfiguration.cc \ src/ui/QGCUDPLinkConfiguration.cc \
src/ui/QGCSettingsWidget.cc \ src/ui/QGCSettingsWidget.cc \
src/ui/uas/UASControlParameters.cpp \
src/ui/mission/QGCMissionDoWidget.cc \ src/ui/mission/QGCMissionDoWidget.cc \
src/ui/mission/QGCMissionConditionWidget.cc \ src/ui/mission/QGCMissionConditionWidget.cc \
src/uas/QGCUASParamManager.cc src/uas/QGCUASParamManager.cc
...@@ -469,3 +466,6 @@ win32:exists(src/lib/opalrt/OpalApi.h):exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) ...@@ -469,3 +466,6 @@ win32:exists(src/lib/opalrt/OpalApi.h):exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin)
FORMS += src/ui/OpalLinkSettings.ui FORMS += src/ui/OpalLinkSettings.ui
DEFINES += OPAL_RT DEFINES += OPAL_RT
} }
TRANSLATIONS += es-MX.ts \
en-US.ts
...@@ -65,8 +65,11 @@ This file is part of the QGROUNDCONTROL project ...@@ -65,8 +65,11 @@ This file is part of the QGROUNDCONTROL project
* @param argv The string array of parameters * @param argv The string array of parameters
**/ **/
Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
{ {
// Set application name // Set application name
this->setApplicationName(QGC_APPLICATION_NAME); this->setApplicationName(QGC_APPLICATION_NAME);
this->setApplicationVersion(QGC_APPLICATION_VERSION); this->setApplicationVersion(QGC_APPLICATION_VERSION);
......
...@@ -324,6 +324,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -324,6 +324,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
currLossCounter = 0; currLossCounter = 0;
currReceiveCounter = 0; currReceiveCounter = 0;
emit receiveLossChanged(message.sysid, receiveLoss); emit receiveLossChanged(message.sysid, receiveLoss);
//qDebug() << "LOSSCHANGED" << message.sysid<<" "<<receiveLoss;
} }
// The packet is emitted as a whole, as it is only 255 - 261 bytes short // The packet is emitted as a whole, as it is only 255 - 261 bytes short
......
...@@ -161,7 +161,7 @@ void UDPLink::writeBytes(const char* data, qint64 size) ...@@ -161,7 +161,7 @@ void UDPLink::writeBytes(const char* data, qint64 size)
unsigned char v =data[i]; unsigned char v =data[i];
qDebug("%02x ", v); qDebug("%02x ", v);
} }
qDebug("\n"); qDebug() <<"Sent to " << currentHost.toString() << ":" << currentPort;
socket->writeDatagram(data, size, currentHost, currentPort); socket->writeDatagram(data, size, currentHost, currentPort);
} }
......
...@@ -39,6 +39,21 @@ This file is part of the QGROUNDCONTROL project ...@@ -39,6 +39,21 @@ This file is part of the QGROUNDCONTROL project
#undef main #undef main
#endif #endif
// Install a message handler so you do not need
// the MSFT debug tools installed to se
// qDebug(), qWarning(), qCritical and qAbort
#ifdef Q_OS_WIN
void msgHandler( QtMsgType type, const char* msg )
{
const char symbols[] = { 'I', 'E', '!', 'X' };
QString output = QString("[%1] %2").arg( symbols[type] ).arg( msg );
std::cerr << output.toStdString() << std::endl;
if( type == QtFatalMsg ) abort();
}
#endif
/** /**
* @brief Starts the application * @brief Starts the application
* *
...@@ -46,9 +61,15 @@ This file is part of the QGROUNDCONTROL project ...@@ -46,9 +61,15 @@ This file is part of the QGROUNDCONTROL project
* @param argv Commandline arguments * @param argv Commandline arguments
* @return exit code, 0 for normal exit and !=0 for error cases * @return exit code, 0 for normal exit and !=0 for error cases
*/ */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// install the message handler
#ifdef Q_OS_WIN
qInstallMsgHandler( msgHandler );
#endif
Core core(argc, argv); Core core(argc, argv);
return core.exec(); return core.exec();
} }
This diff is collapsed.
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
#ifndef SLUGSMAV_H #ifndef SLUGSMAV_H
#define SLUGSMAV_H #define SLUGSMAV_H
#include "UAS.h" #include "UAS.h"
#include "mavlink.h" #include "mavlink.h"
#include <QTimer> #include <QTimer>
#define SLUGS_UPDATE_RATE 100 // in ms #define SLUGS_UPDATE_RATE 200 // in ms
class SlugsMAV : public UAS class SlugsMAV : public UAS
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(UASInterface) Q_INTERFACES(UASInterface)
public:
SlugsMAV(MAVLinkProtocol* mavlink, int id = 0); enum SLUGS_ACTION {
SLUGS_ACTION_NONE,
public slots: SLUGS_ACTION_SUCCESS,
/** @brief Receive a MAVLink message from this MAV */ SLUGS_ACTION_FAIL,
void receiveMessage(LinkInterface* link, mavlink_message_t message); SLUGS_ACTION_EEPROM,
SLUGS_ACTION_MODE_CHANGE,
void emitSignals (void); SLUGS_ACTION_MODE_REPORT,
SLUGS_ACTION_PT_CHANGE,
#ifdef MAVLINK_ENABLED_SLUGS SLUGS_ACTION_PT_REPORT,
mavlink_pwm_commands_t* getPwmCommands(); SLUGS_ACTION_PID_CHANGE,
#endif SLUGS_ACTION_PID_REPORT,
SLUGS_ACTION_WP_CHANGE,
signals: SLUGS_ACTION_WP_REPORT,
SLUGS_ACTION_MLC_CHANGE,
void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData); SLUGS_ACTION_MLC_REPORT
void slugsGPSCogSog(int uasId, double cog, double sog); };
#ifdef MAVLINK_ENABLED_SLUGS
public:
void slugsCPULoad(int systemId, const mavlink_cpu_load_t& cpuLoad); SlugsMAV(MAVLinkProtocol* mavlink, int id = 0);
void slugsAirData(int systemId, const mavlink_air_data_t& airData);
void slugsSensorBias(int systemId, const mavlink_sensor_bias_t& sensorBias); public slots:
void slugsDiagnostic(int systemId, const mavlink_diagnostic_t& diagnostic); /** @brief Receive a MAVLink message from this MAV */
void slugsPilotConsolePWM(int systemId, const mavlink_pilot_console_t& pilotConsole); void receiveMessage(LinkInterface* link, mavlink_message_t message);
void slugsPWM(int systemId, const mavlink_pwm_commands_t& pwmCommands);
void slugsNavegation(int systemId, const mavlink_slugs_navigation_t& slugsNavigation); void emitSignals (void);
void slugsDataLog(int systemId, const mavlink_data_log_t& dataLog);
void slugsFilteredData(int systemId, const mavlink_filtered_data_t& filteredData); signals:
void slugsGPSDateTime(int systemId, const mavlink_gps_date_time_t& gpsDateTime);
void slugsActionAck(int systemId, const mavlink_action_ack_t& actionAck); void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData);
void slugsGPSCogSog(int uasId, double cog, double sog);
void slugsPidValues(int systemId, const mavlink_pid_t& pidValues);
#ifdef MAVLINK_ENABLED_SLUGS
void slugsBootMsg(int uasId, mavlink_boot_t& boot);
void slugsAttitude(int uasId, mavlink_attitude_t& attitude); void slugsCPULoad(int systemId, const mavlink_cpu_load_t& cpuLoad);
void slugsAirData(int systemId, const mavlink_air_data_t& airData);
void slugsSensorBias(int systemId, const mavlink_sensor_bias_t& sensorBias);
void slugsDiagnostic(int systemId, const mavlink_diagnostic_t& diagnostic);
void slugsNavegation(int systemId, const mavlink_slugs_navigation_t& slugsNavigation);
void slugsDataLog(int systemId, const mavlink_data_log_t& dataLog);
#endif void slugsGPSDateTime(int systemId, const mavlink_gps_date_time_t& gpsDateTime);
void slugsActionAck(int systemId, const mavlink_action_ack_t& actionAck);
protected:
void slugsBootMsg(int uasId, mavlink_boot_t& boot);
typedef struct _mavlink_pid_values_t { void slugsAttitude(int uasId, mavlink_attitude_t& attitude);
float P[11];
float I[11]; void slugsScaled(int uasId, const mavlink_scaled_imu_t& scaled);
float D[11]; void slugsServo(int uasId, const mavlink_servo_output_raw_t& servo);
}mavlink_pid_values_t; void slugsChannels(int uasId, const mavlink_rc_channels_raw_t& channels);
unsigned char updateRoundRobin; #endif
QTimer* widgetTimer;
protected:
unsigned char updateRoundRobin;
mavlink_raw_imu_t mlRawImuData; QTimer* widgetTimer;
mavlink_raw_imu_t mlRawImuData;
#ifdef MAVLINK_ENABLED_SLUGS
mavlink_gps_raw_t mlGpsData; #ifdef MAVLINK_ENABLED_SLUGS
mavlink_attitude_t mlAttitude; mavlink_gps_raw_t mlGpsData;
mavlink_cpu_load_t mlCpuLoadData; mavlink_attitude_t mlAttitude;
mavlink_air_data_t mlAirData; mavlink_cpu_load_t mlCpuLoadData;
mavlink_sensor_bias_t mlSensorBiasData; mavlink_air_data_t mlAirData;
mavlink_diagnostic_t mlDiagnosticData; mavlink_sensor_bias_t mlSensorBiasData;
mavlink_pilot_console_t mlPilotConsoleData; mavlink_diagnostic_t mlDiagnosticData;
mavlink_filtered_data_t mlFilteredData; mavlink_boot_t mlBoot;
mavlink_boot_t mlBoot; mavlink_gps_date_time_t mlGpsDateTime;
mavlink_gps_date_time_t mlGpsDateTime; mavlink_mid_lvl_cmds_t mlMidLevelCommands;
mavlink_mid_lvl_cmds_t mlMidLevelCommands; mavlink_set_mode_t mlApMode;
mavlink_set_mode_t mlApMode;
mavlink_pwm_commands_t mlPwmCommands; mavlink_slugs_navigation_t mlNavigation;
mavlink_pid_values_t mlPidValues; mavlink_data_log_t mlDataLog;
mavlink_pid_t mlSinglePid; mavlink_ctrl_srfc_pt_t mlPassthrough;
mavlink_action_ack_t mlActionAck;
mavlink_slugs_navigation_t mlNavigation;
mavlink_data_log_t mlDataLog; mavlink_slugs_action_t mlAction;
mavlink_ctrl_srfc_pt_t mlPassthrough;
mavlink_action_ack_t mlActionAck; mavlink_scaled_imu_t mlScaled;
mavlink_servo_output_raw_t mlServo;
mavlink_slugs_action_t mlAction; mavlink_rc_channels_raw_t mlChannels;
// Standart messages MAVLINK used by SLUGS
private:
// Standart messages MAVLINK used by SLUGS
private:
void emitGpsSignals (void);
void emitPidSignal(void);
void emitGpsSignals (void);
void emitPidSignal(void); int uasId;
int uasId; #endif // if SLUGS
#endif // if SLUGS };
}; #endif // SLUGSMAV_H
#endif // SLUGSMAV_H
This diff is collapsed.
...@@ -233,6 +233,13 @@ public slots: ...@@ -233,6 +233,13 @@ public slots:
void home(); void home();
void halt(); void halt();
void go(); void go();
/** @brief Places the UAV in Hardware-in-the-Loop simulation status **/
void startHil();
/** @brief Stops the UAV's Hardware-in-the-Loop simulation status **/
void stopHil();
/** @brief Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/ /** @brief Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/
void emergencySTOP(); void emergencySTOP();
...@@ -365,6 +372,9 @@ protected slots: ...@@ -365,6 +372,9 @@ protected slots:
// MESSAGE RECEPTION // MESSAGE RECEPTION
/** @brief Receive a named value message */ /** @brief Receive a named value message */
void receiveMessageNamedValue(const mavlink_message_t& message); void receiveMessageNamedValue(const mavlink_message_t& message);
private:
// unsigned int mode; ///< The current mode of the MAV
}; };
......
...@@ -138,7 +138,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ ...@@ -138,7 +138,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
if(wp->seq == current_wp_id) if(wp->seq == current_wp_id)
{ {
//qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_CMD) wp->command; //qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->param4 << "auto:" << wp->autocontinue << "curr:" << wp->current << wp->param1 << wp->param2 << "Frame:"<< (MAV_FRAME) wp->frame << "Command:" << (MAV_CMD) wp->command;
Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command); Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->param1, wp->param2, wp->param3, wp->param4, wp->autocontinue, wp->current, (MAV_FRAME) wp->frame, (MAV_CMD) wp->command);
addWaypoint(lwp, false); addWaypoint(lwp, false);
...@@ -351,6 +351,7 @@ int UASWaypointManager::removeWaypoint(quint16 seq) ...@@ -351,6 +351,7 @@ int UASWaypointManager::removeWaypoint(quint16 seq)
{ {
waypoints[i]->setId(i); waypoints[i]->setId(i);
} }
emit waypointListChanged(); emit waypointListChanged();
emit waypointListChanged(uas.getUASID()); emit waypointListChanged(uas.getUASID());
return 0; return 0;
......
...@@ -393,29 +393,13 @@ void MainWindow::buildCommonWidgets() ...@@ -393,29 +393,13 @@ void MainWindow::buildCommonWidgets()
addToCentralWidgetsMenu (protocolWidget, "Mavlink Generator", SLOT(showCentralWidget()),CENTRAL_PROTOCOL); addToCentralWidgetsMenu (protocolWidget, "Mavlink Generator", SLOT(showCentralWidget()),CENTRAL_PROTOCOL);
} }
#ifdef MAVLINK_ENABLED_SLUGS
//TODO temporaly debug
if (!slugsHilSimWidget)
{
slugsHilSimWidget = new QDockWidget(tr("Slugs Hil Sim"), this);
slugsHilSimWidget->setWidget( new SlugsHilSim(this));
addToToolsMenu (slugsHilSimWidget, tr("HIL Sim Configuration"), SLOT(showToolWidget(bool)), MENU_SLUGS_HIL, Qt::LeftDockWidgetArea);
}
//TODO temporaly debug
if (!slugsCamControlWidget)
{
slugsCamControlWidget = new QDockWidget(tr("Slugs Video Camera Control"), this);
slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this));
addToToolsMenu (slugsCamControlWidget, tr("Camera Control"), SLOT(showToolWidget(bool)), MENU_SLUGS_CAMERA, Qt::BottomDockWidgetArea);
}
#endif
if (!dataplotWidget) if (!dataplotWidget)
{ {
dataplotWidget = new QGCDataPlot2D(this); dataplotWidget = new QGCDataPlot2D(this);
addToCentralWidgetsMenu (dataplotWidget, "Logfile Plot", SLOT(showCentralWidget()),CENTRAL_DATA_PLOT); addToCentralWidgetsMenu (dataplotWidget, "Logfile Plot", SLOT(showCentralWidget()),CENTRAL_DATA_PLOT);
} }
} }
...@@ -615,6 +599,15 @@ void MainWindow::buildSlugsWidgets() ...@@ -615,6 +599,15 @@ void MainWindow::buildSlugsWidgets()
addToToolsMenu (rcViewDockWidget, tr("Radio Control"), SLOT(showToolWidget(bool)), MENU_RC_VIEW, Qt::BottomDockWidgetArea); addToToolsMenu (rcViewDockWidget, tr("Radio Control"), SLOT(showToolWidget(bool)), MENU_RC_VIEW, Qt::BottomDockWidgetArea);
} }
#if (defined _MSC_VER) | (defined Q_OS_MAC)
if (!gEarthWidget)
{
gEarthWidget = new QGCGoogleEarthView(this);
addToCentralWidgetsMenu(gEarthWidget, tr("Google Earth"), SLOT(showCentralWidget()), CENTRAL_GOOGLE_EARTH);
}
#endif
if (!slugsDataWidget) if (!slugsDataWidget)
{ {
// Dialog widgets // Dialog widgets
...@@ -624,13 +617,6 @@ void MainWindow::buildSlugsWidgets() ...@@ -624,13 +617,6 @@ void MainWindow::buildSlugsWidgets()
addToToolsMenu (slugsDataWidget, tr("Telemetry Data"), SLOT(showToolWidget(bool)), MENU_SLUGS_DATA, Qt::RightDockWidgetArea); addToToolsMenu (slugsDataWidget, tr("Telemetry Data"), SLOT(showToolWidget(bool)), MENU_SLUGS_DATA, Qt::RightDockWidgetArea);
} }
if (!slugsPIDControlWidget)
{
slugsPIDControlWidget = new QDockWidget(tr("Slugs PID Control"), this);
slugsPIDControlWidget->setWidget(new SlugsPIDControl(this));
slugsPIDControlWidget->setObjectName("SLUGS_PID_CONTROL_DOCK_WIDGET");
addToToolsMenu (slugsPIDControlWidget, tr("PID Configuration"), SLOT(showToolWidget(bool)), MENU_SLUGS_PID, Qt::LeftDockWidgetArea);
}
if (!slugsHilSimWidget) if (!slugsHilSimWidget)
{ {
...@@ -640,13 +626,29 @@ void MainWindow::buildSlugsWidgets() ...@@ -640,13 +626,29 @@ void MainWindow::buildSlugsWidgets()
addToToolsMenu (slugsHilSimWidget, tr("HIL Sim Configuration"), SLOT(showToolWidget(bool)), MENU_SLUGS_HIL, Qt::LeftDockWidgetArea); addToToolsMenu (slugsHilSimWidget, tr("HIL Sim Configuration"), SLOT(showToolWidget(bool)), MENU_SLUGS_HIL, Qt::LeftDockWidgetArea);
} }
if (!controlParameterWidget){
controlParameterWidget = new QDockWidget(tr("Control Parameters"), this);
controlParameterWidget->setObjectName("UNMANNED_SYSTEM_CONTROL_PARAMETERWIDGET");
controlParameterWidget->setWidget( new UASControlParameters(this) );
addToToolsMenu (controlParameterWidget, tr("Control Parameters"), SLOT(showToolWidget(bool)), MENU_UAS_CONTROL_PARAM, Qt::LeftDockWidgetArea);
}
if (!parametersDockWidget)
{
parametersDockWidget = new QDockWidget(tr("Calibration and Onboard Parameters"), this);
parametersDockWidget->setWidget( new ParameterInterface(this) );
parametersDockWidget->setObjectName("PARAMETER_INTERFACE_DOCKWIDGET");
addToToolsMenu (parametersDockWidget, tr("Calibration and Parameters"), SLOT(showToolWidget(bool)), MENU_PARAMETERS, Qt::RightDockWidgetArea);
}
if (!slugsCamControlWidget) if (!slugsCamControlWidget)
{ {
slugsCamControlWidget = new QDockWidget(tr("Slugs Video Camera Control"), this); slugsCamControlWidget = new QDockWidget(tr("Camera Control"), this);
slugsCamControlWidget->setWidget(new SlugsVideoCamControl(this)); slugsCamControlWidget->setWidget(new SlugsPadCameraControl(this));
slugsCamControlWidget->setObjectName("SLUGS_CAM_CONTROL_DOCK_WIDGET"); slugsCamControlWidget->setObjectName("SLUGS_CAM_CONTROL_DOCK_WIDGET");
addToToolsMenu (slugsCamControlWidget, tr("Camera Control"), SLOT(showToolWidget(bool)), MENU_SLUGS_CAMERA, Qt::BottomDockWidgetArea); addToToolsMenu (slugsCamControlWidget, tr("Camera Control"), SLOT(showToolWidget(bool)), MENU_SLUGS_CAMERA, Qt::BottomDockWidgetArea);
} }
} }
...@@ -1013,6 +1015,7 @@ void MainWindow::updateLocationSettings (Qt::DockWidgetArea location) ...@@ -1013,6 +1015,7 @@ void MainWindow::updateLocationSettings (Qt::DockWidgetArea location)
} }
} }
/** /**
* Connect the signals and slots of the common window widgets * Connect the signals and slots of the common window widgets
*/ */
...@@ -1027,6 +1030,8 @@ void MainWindow::connectCommonWidgets() ...@@ -1027,6 +1030,8 @@ void MainWindow::connectCommonWidgets()
if (mapWidget && waypointsDockWidget->widget()) if (mapWidget && waypointsDockWidget->widget())
{ {
//
connect(waypointsDockWidget->widget(), SIGNAL(changePointList()), mapWidget, SLOT(clearWaypoints()));
} }
//TODO temporaly debug //TODO temporaly debug
...@@ -1034,6 +1039,8 @@ void MainWindow::connectCommonWidgets() ...@@ -1034,6 +1039,8 @@ void MainWindow::connectCommonWidgets()
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
slugsHilSimWidget->widget(), SLOT(activeUasSet(UASInterface*))); slugsHilSimWidget->widget(), SLOT(activeUasSet(UASInterface*)));
} }
} }
void MainWindow::createCustomWidget() void MainWindow::createCustomWidget()
...@@ -1049,6 +1056,7 @@ void MainWindow::createCustomWidget() ...@@ -1049,6 +1056,7 @@ void MainWindow::createCustomWidget()
QDockWidget* dock = new QDockWidget("Unnamed Tool", this); QDockWidget* dock = new QDockWidget("Unnamed Tool", this);
connect(tool, SIGNAL(destroyed()), dock, SLOT(deleteLater())); connect(tool, SIGNAL(destroyed()), dock, SLOT(deleteLater()));
dock->setWidget(tool); dock->setWidget(tool);
QAction* showAction = new QAction("Show Unnamed Tool", this); QAction* showAction = new QAction("Show Unnamed Tool", this);
showAction->setCheckable(true); showAction->setCheckable(true);
connect(dock, SIGNAL(visibilityChanged(bool)), showAction, SLOT(setChecked(bool))); connect(dock, SIGNAL(visibilityChanged(bool)), showAction, SLOT(setChecked(bool)));
...@@ -1076,7 +1084,15 @@ void MainWindow::connectSlugsWidgets() ...@@ -1076,7 +1084,15 @@ void MainWindow::connectSlugsWidgets()
slugsDataWidget->widget(), SLOT(setActiveUAS(UASInterface*))); slugsDataWidget->widget(), SLOT(setActiveUAS(UASInterface*)));
} }
if (controlParameterWidget && controlParameterWidget->widget()){
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
controlParameterWidget->widget(), SLOT(activeUasSet(UASInterface*)));
}
if(controlDockWidget && controlParameterWidget)
{
connect(controlDockWidget->widget(), SIGNAL(changedMode(int)), controlParameterWidget->widget(), SLOT(changedMode(int)));
}
} }
void MainWindow::arrangeCommonCenterStack() void MainWindow::arrangeCommonCenterStack()
...@@ -1128,6 +1144,10 @@ void MainWindow::arrangeSlugsCenterStack() ...@@ -1128,6 +1144,10 @@ void MainWindow::arrangeSlugsCenterStack()
if (linechartWidget && (centerStack->indexOf(linechartWidget) == -1)) centerStack->addWidget(linechartWidget); if (linechartWidget && (centerStack->indexOf(linechartWidget) == -1)) centerStack->addWidget(linechartWidget);
if (hudWidget && (centerStack->indexOf(hudWidget) == -1)) centerStack->addWidget(hudWidget); if (hudWidget && (centerStack->indexOf(hudWidget) == -1)) centerStack->addWidget(hudWidget);
#if (defined _MSC_VER) | (defined Q_OS_MAC)
if (gEarthWidget && (centerStack->indexOf(gEarthWidget) == -1)) centerStack->addWidget(gEarthWidget);
#endif
} }
void MainWindow::loadSettings() void MainWindow::loadSettings()
...@@ -1706,18 +1726,27 @@ void MainWindow::UASCreated(UASInterface* uas) ...@@ -1706,18 +1726,27 @@ void MainWindow::UASCreated(UASInterface* uas)
// Connect Slugs Actions // Connect Slugs Actions
connectSlugsActions(); connectSlugsActions();
// if(slugsDataWidget)
// {
// SlugsDataSensorView *mm = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
// if(mm)
// {
// mm->addUAS(uas);
// }
// }
// FIXME: This type checking might be redundant // FIXME: This type checking might be redundant
// if (slugsDataWidget) { // // if (slugsDataWidget) {
// SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget()); // // SlugsDataSensorView* dataWidget = dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget());
// if (dataWidget) { // // if (dataWidget) {
// SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas); // // SlugsMAV* mav2 = dynamic_cast<SlugsMAV*>(uas);
// if (mav2) { // // if (mav2) {
(dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget()))->addUAS(uas); // (dynamic_cast<SlugsDataSensorView*>(slugsDataWidget->widget()))->addUAS(uas);
// //loadSlugsView(); // // //loadSlugsView();
// loadGlobalOperatorView(); // // loadGlobalOperatorView();
// } // // }
// } // // }
// } // // }
} }
break; break;
...@@ -1931,6 +1960,8 @@ void MainWindow::presentView() ...@@ -1931,6 +1960,8 @@ void MainWindow::presentView()
// UAS CONTROL // UAS CONTROL
showTheWidget(MENU_UAS_CONTROL, currentView); showTheWidget(MENU_UAS_CONTROL, currentView);
showTheWidget(MENU_UAS_CONTROL_PARAM, currentView);
// UAS LIST // UAS LIST
showTheWidget(MENU_UAS_LIST, currentView); showTheWidget(MENU_UAS_LIST, currentView);
......
...@@ -70,12 +70,10 @@ This file is part of the QGROUNDCONTROL project ...@@ -70,12 +70,10 @@ This file is part of the QGROUNDCONTROL project
#include "SlugsDataSensorView.h" #include "SlugsDataSensorView.h"
#include "LogCompressor.h" #include "LogCompressor.h"
#include "SlugsPIDControl.h"
#include "SlugsHilSim.h" #include "SlugsHilSim.h"
#include "SlugsVideoCamControl.h" #include "SlugsPadCameraControl.h"
#include "UASControlParameters.h"
/** /**
* @brief Main Application Window * @brief Main Application Window
...@@ -121,6 +119,7 @@ public slots: ...@@ -121,6 +119,7 @@ public slots:
void configure(); void configure();
/** @brief Set the currently controlled UAS */ /** @brief Set the currently controlled UAS */
void setActiveUAS(UASInterface* uas); void setActiveUAS(UASInterface* uas);
/** @brief Add a new UAS */ /** @brief Add a new UAS */
void UASCreated(UASInterface* uas); void UASCreated(UASInterface* uas);
/** @brief Update system specs of a UAS */ /** @brief Update system specs of a UAS */
...@@ -211,6 +210,7 @@ protected: ...@@ -211,6 +210,7 @@ protected:
// FIXME: DO NOT PUT CUSTOM VALUES IN THIS ENUM since it is iterated over // FIXME: DO NOT PUT CUSTOM VALUES IN THIS ENUM since it is iterated over
// this will be fixed in a future release. // this will be fixed in a future release.
typedef enum _TOOLS_WIDGET_NAMES { typedef enum _TOOLS_WIDGET_NAMES {
MENU_UAS_CONTROL_PARAM,
MENU_UAS_CONTROL, MENU_UAS_CONTROL,
MENU_UAS_INFO, MENU_UAS_INFO,
MENU_CAMERA, MENU_CAMERA,
...@@ -380,6 +380,7 @@ protected: ...@@ -380,6 +380,7 @@ protected:
#endif #endif
// Dock widgets // Dock widgets
QPointer<QDockWidget> controlDockWidget; QPointer<QDockWidget> controlDockWidget;
QPointer<QDockWidget> controlParameterWidget;
QPointer<QDockWidget> infoDockWidget; QPointer<QDockWidget> infoDockWidget;
QPointer<QDockWidget> cameraDockWidget; QPointer<QDockWidget> cameraDockWidget;
QPointer<QDockWidget> listDockWidget; QPointer<QDockWidget> listDockWidget;
...@@ -400,7 +401,6 @@ protected: ...@@ -400,7 +401,6 @@ protected:
QPointer<QDockWidget> rcViewDockWidget; QPointer<QDockWidget> rcViewDockWidget;
QPointer<QDockWidget> hudDockWidget; QPointer<QDockWidget> hudDockWidget;
QPointer<QDockWidget> slugsDataWidget; QPointer<QDockWidget> slugsDataWidget;
QPointer<QDockWidget> slugsPIDControlWidget;
QPointer<QDockWidget> slugsHilSimWidget; QPointer<QDockWidget> slugsHilSimWidget;
QPointer<QDockWidget> slugsCamControlWidget; QPointer<QDockWidget> slugsCamControlWidget;
......
This diff is collapsed.
...@@ -40,8 +40,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -40,8 +40,7 @@ This file is part of the QGROUNDCONTROL project
#include "QPointF" #include "QPointF"
#include <qmath.h> #include <qmath.h>
#include <QSettings>
class QMenu; class QMenu;
class Waypoint; class Waypoint;
...@@ -76,8 +75,8 @@ public slots: ...@@ -76,8 +75,8 @@ public slots:
void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 usec); void updateAttitude(UASInterface* uas, double roll, double pitch, double yaw, quint64 usec);
void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec); void updateGlobalPosition(UASInterface* uas, double lat, double lon, double alt, quint64 usec);
void updatePosition(float time, double lat, double lon); void updatePosition(float time, double lat, double lon);
void updateCameraPosition(double distance, double bearing, QString dir); //void updateCameraPosition(double distance, double bearing, QString dir);
QPointF getPointxBearing_Range(double lat1, double lon1, double bearing, double distance); //QPointF getPointxBearing_Range(double lat1, double lon1, double bearing, double distance);
/** @brief Clear the waypoints overlay layer */ /** @brief Clear the waypoints overlay layer */
void clearWaypoints(int uas=0); void clearWaypoints(int uas=0);
...@@ -93,7 +92,7 @@ public slots: ...@@ -93,7 +92,7 @@ public slots:
void updateWaypoint(int uas, Waypoint* wp); void updateWaypoint(int uas, Waypoint* wp);
void updateWaypoint(int uas, Waypoint* wp, bool updateView); void updateWaypoint(int uas, Waypoint* wp, bool updateView);
void drawBorderCamAtMap(bool status); //void drawBorderCamAtMap(bool status);
/** @brief Bring up dialog to go to a specific location */ /** @brief Bring up dialog to go to a specific location */
void goTo(); void goTo();
...@@ -118,6 +117,7 @@ protected: ...@@ -118,6 +117,7 @@ protected:
QPushButton* followgps; QPushButton* followgps;
QPushButton* createPath; QPushButton* createPath;
QPushButton* clearTracking; QPushButton* clearTracking;
QPushButton* setHome;
QLabel* gpsposition; QLabel* gpsposition;
QMenu* mapMenu; QMenu* mapMenu;
QPushButton* mapButton; QPushButton* mapButton;
...@@ -128,9 +128,7 @@ protected: ...@@ -128,9 +128,7 @@ protected:
qmapcontrol::Layer* overlay; ///< Street overlay (foreground) qmapcontrol::Layer* overlay; ///< Street overlay (foreground)
qmapcontrol::Layer* tracks; ///< Layer for UAV tracks qmapcontrol::Layer* tracks; ///< Layer for UAV tracks
qmapcontrol::GeometryLayer* geomLayer; ///< Layer for waypoints qmapcontrol::GeometryLayer* geomLayer; ///< Layer for waypoints
qmapcontrol::GeometryLayer* homePosition; ///< Layer for station control
//only for experiment
qmapcontrol::GeometryLayer* camLayer; ///< Layer for camera indicator
int zoomLevel; int zoomLevel;
int detailZoom; ///< Steps zoomed in further than qMapControl allows int detailZoom; ///< Steps zoomed in further than qMapControl allows
...@@ -142,8 +140,6 @@ protected: ...@@ -142,8 +140,6 @@ protected:
QMap<int, qmapcontrol::Point*> uasIcons; QMap<int, qmapcontrol::Point*> uasIcons;
QMap<int, qmapcontrol::LineString*> uasTrails; QMap<int, qmapcontrol::LineString*> uasTrails;
QMap<int, QPen*> mavPens; QMap<int, QPen*> mavPens;
//QMap<int, QList<qmapcontrol::Point*> > mavWps;
//QMap<int, qmapcontrol::LineString*> waypointPaths;
UASInterface* mav; UASInterface* mav;
quint64 lastUpdate; quint64 lastUpdate;
bool initialized; bool initialized;
...@@ -157,20 +153,23 @@ protected: ...@@ -157,20 +153,23 @@ protected:
void captureGeometryDrag(Geometry* geom, QPointF coordinate); void captureGeometryDrag(Geometry* geom, QPointF coordinate);
void captureGeometryEndDrag(Geometry* geom, QPointF coordinate); void captureGeometryEndDrag(Geometry* geom, QPointF coordinate);
void captureGeometryDragHome(Geometry* geom, QPointF coordinate);
void createPathButtonClicked(bool checked); void createPathButtonClicked(bool checked);
/** @brief Create the graphic representation of the waypoint */ /** @brief Create the graphic representation of the waypoint */
void createWaypointGraphAtMap(int id, const QPointF coordinate); void createWaypointGraphAtMap(int id, const QPointF coordinate);
void mapproviderSelected(QAction* action); void mapproviderSelected(QAction* action);
void createHomePosition(const QMouseEvent* event, const QPointF coordinate);
void createHomePosition(const QPointF coordinate);
void createHomePositionClick(bool click);
void loadSettingsMap(int8_t index);
signals: signals:
//void movePoint(QPointF newCoord);
//void captureMapCoordinateClick(const QPointF coordinate); //ROCA
//void createGlobalWP(bool value, QPointF centerCoordinate);
void waypointCreated(Waypoint* wp); void waypointCreated(Waypoint* wp);
void sendGeometryEndDrag(const QPointF coordinate, const int index); void sendGeometryEndDrag(const QPointF coordinate, const int index);
private: private:
Ui::MapWidget *m_ui; Ui::MapWidget *m_ui;
QList<qmapcontrol::Point*> wps; QList<qmapcontrol::Point*> wps;
...@@ -180,14 +179,8 @@ private: ...@@ -180,14 +179,8 @@ private:
QPen* pointPen; QPen* pointPen;
int wpExists(const QPointF coordinate); int wpExists(const QPointF coordinate);
bool waypointIsDrag; bool waypointIsDrag;
QPointF homeCoordinate;
int8_t index;
qmapcontrol::LineString* camLine;
QList<qmapcontrol::Point*> camPoints;
QPointF lastCamBorderPos;
bool drawCamBorder;
int radioCamera;
}; };
#endif // MAPWIDGET_H #endif // MAPWIDGET_H
...@@ -43,33 +43,17 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) : ...@@ -43,33 +43,17 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
uasId(-1), uasId(-1),
rssi(0.0f), rssi(0.0f),
updated(false), updated(false),
channelLayout(new QVBoxLayout()), channelLayout(new QVBoxLayout())//,
ui(new Ui::QGCRemoteControlView) //ui(new Ui::QGCRemoteControlView)
{ {
ui->setupUi(this);
//ui->setupUi(this);
QGridLayout* layout = new QGridLayout(this); QGridLayout* layout = new QGridLayout(this);
layout->addLayout(channelLayout, 1, 0, 1, 2); layout->addLayout(channelLayout, 1, 0, 1, 2);
// Name label
nameLabel = new QLabel(this); nameLabel = new QLabel(this);
nameLabel->setText("No MAV selected yet..");
layout->addWidget(nameLabel, 0, 0, 1, 2); layout->addWidget(nameLabel, 0, 0, 1, 2);
// RSSI bar this->setVisible(false);
// Create new layout //setVisible(false);
QHBoxLayout* rssiLayout = new QHBoxLayout();
rssiLayout->setSpacing(5);
// Add content
rssiLayout->addWidget(new QLabel(tr("Signal"), this));
// Append raw label
// Append progress bar
rssiBar = new QProgressBar(this);
rssiBar->setMinimum(0);
rssiBar->setMaximum(100);
rssiBar->setValue(0);
rssiLayout->addWidget(rssiBar);
layout->addItem(rssiLayout, 2, 0, 1, 2);
setVisible(false);
calibrate = new QPushButton(tr("Calibrate"), this); calibrate = new QPushButton(tr("Calibrate"), this);
QHBoxLayout *calibrateButtonLayout = new QHBoxLayout(); QHBoxLayout *calibrateButtonLayout = new QHBoxLayout();
...@@ -112,10 +96,9 @@ void QGCRemoteControlView::setUASId(int id) ...@@ -112,10 +96,9 @@ void QGCRemoteControlView::setUASId(int id)
nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName())); nameLabel->setText(QString("RC Input of %1").arg(newUAS->getUASName()));
calibrationWindow->setUASId(id); calibrationWindow->setUASId(id);
connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&))); connect(newUAS, SIGNAL(radioCalibrationReceived(const QPointer<RadioCalibrationData>&)), calibrationWindow, SLOT(receive(const QPointer<RadioCalibrationData>&)));
connect(newUAS, SIGNAL(remoteControlRSSIChanged(float)), this, SLOT(setRemoteRSSI(float)));
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)), this, SLOT(setChannelRaw(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelRawChanged(int,float)), calibrationWindow, SLOT(setChannel(int,float)));
connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float))); connect(newUAS, SIGNAL(remoteControlChannelScaledChanged(int,float)), this, SLOT(setChannelScaled(int,float)));
} }
} }
...@@ -127,7 +110,7 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw) ...@@ -127,7 +110,7 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw)
{ {
// This is a new channel, append it // This is a new channel, append it
this->raw.append(raw); this->raw.append(raw);
this->normalized.append(0); //this->normalized.append(0);
appendChannelWidget(channelId); appendChannelWidget(channelId);
} }
else else
...@@ -141,25 +124,25 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw) ...@@ -141,25 +124,25 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw)
redraw(); redraw();
} }
void QGCRemoteControlView::setChannelScaled(int channelId, float normalized) //void QGCRemoteControlView::setChannelScaled(int channelId, float normalized)
{ //{
if (this->raw.size() <= channelId) // using raw vector as size indicator // if (this->raw.size() <= channelId) // using raw vector as size indicator
{ // {
// This is a new channel, append it // // This is a new channel, append it
this->normalized.append(normalized); // this->normalized.append(normalized);
this->raw.append(0); // this->raw.append(0);
appendChannelWidget(channelId); // appendChannelWidget(channelId);
} // }
else // else
{ // {
// This is an existing channel, update it // // This is an existing channel, update it
this->normalized[channelId] = normalized; // this->normalized[channelId] = normalized;
} // }
updated = true; // updated = true;
// FIXME Will be timer based in the future // // FIXME Will be timer based in the future
redraw(); // redraw();
} //}
void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized) void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized)
{ {
...@@ -193,18 +176,26 @@ void QGCRemoteControlView::redraw() ...@@ -193,18 +176,26 @@ void QGCRemoteControlView::redraw()
if(isVisible() && updated) if(isVisible() && updated)
{ {
// Update raw values // Update raw values
for(int i = 0; i < rawLabels.count(); i++) //for(int i = 0; i < rawLabels.count(); i++)
{ //{
rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0'))); //rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0')));
} //}
// Update percent bars // Update percent bars
for(int i = 0; i < progressBars.count(); i++) for(int i = 0; i < progressBars.count(); i++)
{ {
progressBars.at(i)->setValue(normalized.at(i)*100.0f); rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0')));
//int vv = normalized.at(i)*100.0f;
//progressBars.at(i)->setValue(vv);
int vv = raw.at(i)*1.0f;
progressBars.at(i)->setValue(vv);
} }
// Update RSSI // Update RSSI
rssiBar->setValue(rssi*100); if(rssi>0)
{
//rssiBar->setValue(rssi);//*100);
}
updated = false; updated = false;
} }
} }
......
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/** /**
* @file * @file
* @brief Declaration of QGCRemoteControlView * @brief Declaration of QGCRemoteControlView
* @author Lorenz Meier <mail@qgroundcontrol.org> * @author Lorenz Meier <mail@qgroundcontrol.org>
*/ */
#ifndef QGCREMOTECONTROLVIEW_H #ifndef QGCREMOTECONTROLVIEW_H
#define QGCREMOTECONTROLVIEW_H #define QGCREMOTECONTROLVIEW_H
#include <QWidget> #include <QWidget>
#include <QVector> #include <QVector>
#include <QPushButton> #include <QPushButton>
#include "RadioCalibration/RadioCalibrationWindow.h" #include "RadioCalibration/RadioCalibrationWindow.h"
namespace Ui { namespace Ui {
class QGCRemoteControlView; class QGCRemoteControlView;
} }
class QVBoxLayout; class QVBoxLayout;
class QLabel; class QLabel;
class QProgressBar; class QProgressBar;
class QGCRemoteControlView : public QWidget { class QGCRemoteControlView : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
QGCRemoteControlView(QWidget *parent = 0); QGCRemoteControlView(QWidget *parent = 0);
~QGCRemoteControlView(); ~QGCRemoteControlView();
public slots: public slots:
void setUASId(int id); void setUASId(int id);
void setChannelRaw(int channelId, float raw); void setChannelRaw(int channelId, float raw);
void setChannelScaled(int channelId, float normalized); //void setChannelScaled(int channelId, float normalized);
void setRemoteRSSI(float rssiNormalized); void setRemoteRSSI(float rssiNormalized);
void redraw(); void redraw();
protected slots: protected slots:
void appendChannelWidget(int channelId); void appendChannelWidget(int channelId);
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
int uasId; int uasId;
float rssi; float rssi;
bool updated; bool updated;
QVBoxLayout* channelLayout; QVBoxLayout* channelLayout;
QVector<int> raw; QVector<int> raw;
QVector<float> normalized; QVector<float> normalized;
QVector<QLabel*> rawLabels; QVector<QLabel*> rawLabels;
QVector<QProgressBar*> progressBars; QVector<QProgressBar*> progressBars;
QProgressBar* rssiBar; QProgressBar* rssiBar;
QLabel* nameLabel; QLabel* nameLabel;
QPushButton *calibrate; QPushButton *calibrate;
RadioCalibrationWindow *calibrationWindow; RadioCalibrationWindow *calibrationWindow;
private: private:
Ui::QGCRemoteControlView *ui; Ui::QGCRemoteControlView *ui;
}; };
#endif // QGCREMOTECONTROLVIEW_H #endif // QGCREMOTECONTROLVIEW_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef SLUGSPIDCONTROL_H
#define SLUGSPIDCONTROL_H
#include <QWidget>
#include <QGroupBox>
#include "UASInterface.h"
#include "QGCMAVLink.h"
#include "SlugsMAV.h"
#include "mavlink.h"
#include <QTimer>
#include <QMutex>
namespace Ui {
class SlugsPIDControl;
}
class SlugsPIDControl : public QWidget
{
Q_OBJECT
public:
explicit SlugsPIDControl(QWidget *parent = 0);
~SlugsPIDControl();
public slots:
/**
* @brief Called when the a new UAS is set to active.
*
* Called when the a new UAS is set to active.
*
* @param uas The new active UAS
*/
void activeUasSet(UASInterface* uas);
/**
*/
void setRedColorStyle();
/**
* @brief Set color StyleSheet GREEN
*
* @param
*/
void setGreenColorStyle();
/**
* @brief Connect Set pushButtons to change the color GroupBox
*
* @param
*/
void connect_set_pushButtons();
/**
* @brief Connect Set pushButtons to change the color GroupBox
*
* @param
*/
void connect_get_pushButtons();
/**
* @brief Connect Edition Lines for PID Values
*
* @param
*/
void connect_editLinesPDIvalues();
/**
* @brief send a PDI request message to UAS
*
* @param
*/
void sendMessagePIDStatus(int PIDtype);
// Fuctions for Air Speed GroupBox
/**
* @brief Change color style to red when PID values of Air Speed are edited
*
*
* @param
*/
void changeColor_RED_AirSpeed_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Air Speed are send to UAS
*
* @param
*/
void changeColor_GREEN_AirSpeed_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT changeColor_RED_AirSpeed_groupBox()
*
* @param
*/
void connect_AirSpeed_LineEdit();
/**
* @brief get message PID Air Speed(loop index = 0) from UAS
*
* @param
*/
void get_AirSpeed_PID();
// Functions for Pitch Followei GroupBox
/**
* @brief Change color style to red when PID values of Pitch Followei are edited
*
*
* @param
*/
void changeColor_RED_PitchFollowei_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Pitch Followei are send to UAS
*
* @param
*/
void changeColor_GREEN_PitchFollowei_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT PitchFlowei_groupBox
*
* @param
*/
void connect_PitchFollowei_LineEdit();
/**
* @brief get message PID Pitch Followei(loop index = 2) from UAS
*
* @param
*/
void get_PitchFollowei_PID();
// Functions for Roll Control GroupBox
/**
* @brief Change color style to red when PID values of Roll Control are edited
*
*
* @param
*/
void changeColor_RED_RollControl_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Roll Control are send to UAS
*
* @param
*/
void changeColor_GREEN_RollControl_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT RollControl_groupBox
*
* @param
*/
void connect_RollControl_LineEdit();
/**
* @brief get message PID Roll Control(loop index = 4) from UAS
*
* @param
*/
void get_RollControl_PID();
// Functions for Heigth Error GroupBox
/**
* @brief Change color style to red when PID values of Heigth Error are edited
*
*
* @param
*/
void changeColor_RED_HeigthError_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Heigth Error are send to UAS
*
* @param
*/
void changeColor_GREEN_HeigthError_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT HeigthError_groupBox
*
* @param
*/
void connect_HeigthError_LineEdit();
/**
* @brief get message PID Heigth Error(loop index = 1) from UAS
*
* @param
*/
void get_HeigthError_PID();
// Functions for Yaw Damper GroupBox
/**
* @brief Change color style to red when PID values of Yaw Damper are edited
*
*
* @param
*/
void changeColor_RED_YawDamper_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Yaw Damper are send to UAS
*
* @param
*/
void changeColor_GREEN_YawDamper_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT YawDamper_groupBox
*
* @param
*/
void connect_YawDamper_LineEdit();
/**
* @brief get message PID Yaw Damper(loop index = 3) from UAS
*
* @param
*/
void get_YawDamper_PID();
// Functions for Pitch to dT GroupBox
/**
* @brief Change color style to red when PID values of Pitch to dT are edited
*
*
* @param
*/
void changeColor_RED_Pitch2dT_groupBox(QString text);
/**
* @brief Change color style to green when PID values of Pitch to dT are send to UAS
*
* @param
*/
void changeColor_GREEN_Pitch2dT_groupBox();
/**
* @brief Connects the SIGNALS from the editline to SLOT Pitch2dT_groupBox
*
* @param
*/
void connect_Pitch2dT_LineEdit();
/**
* @brief get message PID Pitch2dT(loop index = 8) from UAS
*
* @param
*/
void get_Pitch2dT_PID();
/**
* @brief get and updates the values on widget
*/
void slugsGetGeneral();
/**
* @brief Sent all values to UAS
*/
void slugsSetGeneral();
void slugsTimerStartSet();
void slugsTimerStartGet();
void slugsTimerStop();
//Create, send and get Messages PID
// void createMessagePID();
#ifdef MAVLINK_ENABLED_SLUGS
void recibeMensaje(int systemId, const mavlink_action_ack_t& action);
void receivePidValues(int systemId, const mavlink_pid_t& pidValues);
#endif // MAVLINK_ENABLED_SLUG
private:
Ui::SlugsPIDControl *ui;
UASInterface* activeUAS;
int systemId;
bool change_dT;
//Color Styles
QString REDcolorStyle;
QString GREENcolorStyle;
QString ORIGINcolorStyle;
//SlugsMav Message
#ifdef MAVLINK_ENABLED_SLUGS
mavlink_pid_t pidMessage;
mavlink_slugs_action_t actionSlugs;
#endif
QTimer* refreshTimerSet; ///< The main timer, controls the update view
QTimer* refreshTimerGet; ///< The main timer, controls the update view
int counterRefreshSet;
int counterRefreshGet;
QMutex valuesMutex;
};
#endif // SLUGSPIDCONTROL_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -108,7 +108,7 @@ public slots: ...@@ -108,7 +108,7 @@ public slots:
signals: signals:
void clearPathclicked(); void clearPathclicked();
void createWaypointAtMap(const QPointF coordinate); void createWaypointAtMap(const QPointF coordinate);
void changePointList();
protected: protected:
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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