From 9d8d4c5be9c348e67527444e943bbe1d9e0b245e Mon Sep 17 00:00:00 2001 From: Bryant Date: Tue, 22 Jul 2014 22:13:59 -0700 Subject: [PATCH 1/8] Removing all SLUGS autopilot-specific code. SLUGS has maintained their patches out-of-tree for a long while now. These will eventually get merged back in, but it'll be easier to evaluate them as fresh commits instead of modifications to this old & dead code, so we'll delete this for now. --- qgroundcontrol.pro | 11 - src/comm/MAVLinkProtocol.cc | 1 - src/uas/QGCMAVLinkUASFactory.cc | 14 - src/uas/QGCMAVLinkUASFactory.h | 1 - src/uas/SlugsMAV.cc | 235 --- src/uas/SlugsMAV.h | 131 -- src/ui/MainWindow.cc | 1 - src/ui/MainWindow.h | 7 - src/ui/SlugsDataSensorView.cc | 352 ---- src/ui/SlugsDataSensorView.h | 213 --- src/ui/SlugsDataSensorView.ui | 3140 ----------------------------------- src/ui/SlugsHilSim.cc | 364 ---- src/ui/SlugsHilSim.h | 158 -- src/ui/SlugsHilSim.ui | 369 ---- src/ui/SlugsPadCameraControl.cpp | 179 -- src/ui/SlugsPadCameraControl.h | 69 - src/ui/SlugsPadCameraControl.ui | 94 -- src/ui/SlugsVideoCamControl.cpp | 95 -- src/ui/uas/UASControlParameters.cpp | 75 - src/ui/uas/UASControlParameters.h | 5 - 20 files changed, 5514 deletions(-) delete mode 100644 src/uas/SlugsMAV.cc delete mode 100644 src/uas/SlugsMAV.h delete mode 100644 src/ui/SlugsDataSensorView.cc delete mode 100644 src/ui/SlugsDataSensorView.h delete mode 100644 src/ui/SlugsDataSensorView.ui delete mode 100644 src/ui/SlugsHilSim.cc delete mode 100644 src/ui/SlugsHilSim.h delete mode 100644 src/ui/SlugsHilSim.ui delete mode 100644 src/ui/SlugsPadCameraControl.cpp delete mode 100644 src/ui/SlugsPadCameraControl.h delete mode 100644 src/ui/SlugsPadCameraControl.ui delete mode 100644 src/ui/SlugsVideoCamControl.cpp diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index dbd2461..72b71f5 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -269,9 +269,6 @@ FORMS += \ src/ui/QMap3D.ui \ src/ui/QGCWebView.ui \ src/ui/map3D/QGCGoogleEarthView.ui \ - src/ui/SlugsDataSensorView.ui \ - src/ui/SlugsHilSim.ui \ - src/ui/SlugsPadCameraControl.ui \ src/ui/uas/QGCUnconnectedInfoWidget.ui \ src/ui/designer/QGCToolWidget.ui \ src/ui/designer/QGCParamSlider.ui \ @@ -407,7 +404,6 @@ HEADERS += \ src/ui/QGCParamWidget.h \ src/ui/QGCSensorSettingsWidget.h \ src/ui/linechart/Linecharts.h \ - src/uas/SlugsMAV.h \ src/uas/PxQuadMAV.h \ src/uas/ArduPilotMegaMAV.h \ src/uas/senseSoarMAV.h \ @@ -431,9 +427,6 @@ HEADERS += \ src/comm/QGCMAVLink.h \ src/ui/QGCWebView.h \ src/ui/map3D/QGCWebPage.h \ - src/ui/SlugsDataSensorView.h \ - src/ui/SlugsHilSim.h \ - src/ui/SlugsPadCameraControl.h \ src/ui/QGCMainWindowAPConfigurator.h \ src/comm/MAVLinkSwarmSimulationLink.h \ src/ui/uas/QGCUnconnectedInfoWidget.h \ @@ -601,7 +594,6 @@ SOURCES += \ src/ui/QGCParamWidget.cc \ src/ui/QGCSensorSettingsWidget.cc \ src/ui/linechart/Linecharts.cc \ - src/uas/SlugsMAV.cc \ src/uas/PxQuadMAV.cc \ src/uas/ArduPilotMegaMAV.cc \ src/uas/senseSoarMAV.cpp \ @@ -624,9 +616,6 @@ SOURCES += \ src/ui/RadioCalibration/RadioCalibrationData.cc \ src/ui/QGCWebView.cc \ src/ui/map3D/QGCWebPage.cc \ - src/ui/SlugsDataSensorView.cc \ - src/ui/SlugsHilSim.cc \ - src/ui/SlugsPadCameraControl.cpp \ src/ui/QGCMainWindowAPConfigurator.cc \ src/comm/MAVLinkSwarmSimulationLink.cc \ src/ui/uas/QGCUnconnectedInfoWidget.cc \ diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index ae16ed1..72b1d04 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -24,7 +24,6 @@ #include "UASManager.h" #include "UASInterface.h" #include "UAS.h" -#include "SlugsMAV.h" #include "PxQuadMAV.h" #include "ArduPilotMegaMAV.h" #include "configuration.h" diff --git a/src/uas/QGCMAVLinkUASFactory.cc b/src/uas/QGCMAVLinkUASFactory.cc index ccf4c06..f1a1b90 100644 --- a/src/uas/QGCMAVLinkUASFactory.cc +++ b/src/uas/QGCMAVLinkUASFactory.cc @@ -73,20 +73,6 @@ UASInterface* QGCMAVLinkUASFactory::createUAS(MAVLinkProtocol* mavlink, LinkInte uas = px4; } break; - case MAV_AUTOPILOT_SLUGS: - { - SlugsMAV* mav = new SlugsMAV(mavlink, worker, sysid); - // Set the system type - mav->setSystemType((int)heartbeat->type); - - // Connect this robot to the UAS object - // it is IMPORTANT here to use the right object type, - // else the slot of the parent object is called (and thus the special - // packets never reach their goal) - connect(mavlink, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), mav, SLOT(receiveMessage(LinkInterface*, mavlink_message_t))); - uas = mav; - } - break; case MAV_AUTOPILOT_ARDUPILOTMEGA: { ArduPilotMegaMAV* mav = new ArduPilotMegaMAV(mavlink, worker, sysid); diff --git a/src/uas/QGCMAVLinkUASFactory.h b/src/uas/QGCMAVLinkUASFactory.h index 3c864a6..d050a33 100644 --- a/src/uas/QGCMAVLinkUASFactory.h +++ b/src/uas/QGCMAVLinkUASFactory.h @@ -10,7 +10,6 @@ // INCLUDE ALL MAV/UAS CLASSES USING MAVLINK #include "UAS.h" -#include "SlugsMAV.h" #include "PxQuadMAV.h" #include "senseSoarMAV.h" #include "ArduPilotMegaMAV.h" diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc deleted file mode 100644 index 6928979..0000000 --- a/src/uas/SlugsMAV.cc +++ /dev/null @@ -1,235 +0,0 @@ -#include "SlugsMAV.h" - -#include - -SlugsMAV::SlugsMAV(MAVLinkProtocol* mavlink, QThread* thread, int id) : - UAS(mavlink, thread, id) -{ - widgetTimer = new QTimer (this); - widgetTimer->setInterval(SLUGS_UPDATE_RATE); - - connect (widgetTimer, SIGNAL(timeout()), this, SLOT(emitSignals())); - widgetTimer->start(); - memset(&mlRawImuData ,0, sizeof(mavlink_raw_imu_t));// clear all the state structures - -#ifdef MAVLINK_ENABLED_SLUGS - - - memset(&mlGpsData, 0, sizeof(mavlink_gps_raw_t)); - memset(&mlCpuLoadData, 0, sizeof(mavlink_cpu_load_t)); - memset(&mlAirData, 0, sizeof(mavlink_air_data_t)); - memset(&mlSensorBiasData, 0, sizeof(mavlink_sensor_bias_t)); - memset(&mlDiagnosticData, 0, sizeof(mavlink_diagnostic_t)); - memset(&mlBoot ,0, sizeof(mavlink_boot_t)); - memset(&mlGpsDateTime ,0, sizeof(mavlink_gps_date_time_t)); - memset(&mlApMode ,0, sizeof(mavlink_set_mode_t)); - memset(&mlNavigation ,0, sizeof(mavlink_slugs_navigation_t)); - memset(&mlDataLog ,0, sizeof(mavlink_data_log_t)); - memset(&mlPassthrough ,0, sizeof(mavlink_ctrl_srfc_pt_t)); - memset(&mlActionAck,0, sizeof(mavlink_action_ack_t)); - memset(&mlAction ,0, sizeof(mavlink_slugs_action_t)); - - memset(&mlScaled ,0, sizeof(mavlink_scaled_imu_t)); - memset(&mlServo ,0, sizeof(mavlink_servo_output_raw_t)); - memset(&mlChannels ,0, sizeof(mavlink_rc_channels_raw_t)); - - updateRoundRobin = 0; - uasId = id; -#endif -} - -/** - * This function is called by MAVLink once a complete, uncorrupted (CRC check valid) - * mavlink packet is received. - * - * @param link Hardware link the message came from (e.g. /dev/ttyUSB0 or UDP port). - * messages can be sent back to the system via this link - * @param message MAVLink message, as received from the MAVLink protocol stack - */ -void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message) -{ - UAS::receiveMessage(link, message);// Let UAS handle the default message set - - if (message.sysid == uasId) { -#ifdef MAVLINK_ENABLED_SLUGS// Handle your special messages mavlink_message_t* msg = &message; - - switch (message.msgid) { - case MAVLINK_MSG_ID_RAW_IMU: - mavlink_msg_raw_imu_decode(&message, &mlRawImuData); - break; - - case MAVLINK_MSG_ID_BOOT: - mavlink_msg_boot_decode(&message,&mlBoot); - emit slugsBootMsg(uasId, mlBoot); - break; - - case MAVLINK_MSG_ID_ATTITUDE: - mavlink_msg_attitude_decode(&message, &mlAttitude); - break; - - case MAVLINK_MSG_ID_GPS_RAW: - mavlink_msg_gps_raw_decode(&message, &mlGpsData); - break; - - case MAVLINK_MSG_ID_CPU_LOAD: //170 - mavlink_msg_cpu_load_decode(&message,&mlCpuLoadData); - break; - - case MAVLINK_MSG_ID_AIR_DATA: //171 - mavlink_msg_air_data_decode(&message,&mlAirData); - break; - - case MAVLINK_MSG_ID_SENSOR_BIAS: //172 - mavlink_msg_sensor_bias_decode(&message,&mlSensorBiasData); - break; - - case MAVLINK_MSG_ID_DIAGNOSTIC: //173 - mavlink_msg_diagnostic_decode(&message,&mlDiagnosticData); - break; - - case MAVLINK_MSG_ID_SLUGS_NAVIGATION://176 - mavlink_msg_slugs_navigation_decode(&message,&mlNavigation); - break; - - case MAVLINK_MSG_ID_DATA_LOG: //177 - mavlink_msg_data_log_decode(&message,&mlDataLog); - break; - - case MAVLINK_MSG_ID_GPS_DATE_TIME: //179 - mavlink_msg_gps_date_time_decode(&message,&mlGpsDateTime); - break; - - case MAVLINK_MSG_ID_MID_LVL_CMDS: //180 - mavlink_msg_mid_lvl_cmds_decode(&message, &mlMidLevelCommands); - break; - - case MAVLINK_MSG_ID_CTRL_SRFC_PT: //181 - mavlink_msg_ctrl_srfc_pt_decode(&message, &mlPassthrough); - break; - - case MAVLINK_MSG_ID_SLUGS_ACTION: //183 - mavlink_msg_slugs_action_decode(&message, &mlAction); - break; - - case MAVLINK_MSG_ID_SCALED_IMU: - mavlink_msg_scaled_imu_decode(&message, &mlScaled); - break; - - case MAVLINK_MSG_ID_SERVO_OUTPUT_RAW: - mavlink_msg_servo_output_raw_decode(&message, &mlServo); - break; - - case MAVLINK_MSG_ID_RC_CHANNELS_RAW: - mavlink_msg_rc_channels_raw_decode(&message, &mlChannels); - break; - - switch (mlAction.actionId) { - case SLUGS_ACTION_EEPROM: - if (mlAction.actionVal == SLUGS_ACTION_FAIL) { - emit textMessageReceived(message.sysid, message.compid, MAV_SEVERITY_ERROR, "EEPROM Write Fail, Data was not saved in Memory!"); - } - break; - - case SLUGS_ACTION_PT_CHANGE: - if (mlAction.actionVal == SLUGS_ACTION_SUCCESS) { - emit textMessageReceived(message.sysid, message.compid, MAV_SEVERITY_INFO, "Passthrough Succesfully Changed"); - } - break; - - case SLUGS_ACTION_MLC_CHANGE: - if (mlAction.actionVal == SLUGS_ACTION_SUCCESS) { - emit textMessageReceived(message.sysid, message.compid, MAV_SEVERITY_INFO, "Mid-level Commands Succesfully Changed"); - } - break; - } - - //break; - - default: - // qDebug() << "\nSLUGS RECEIVED MESSAGE WITH ID" << message.msgid; - break; - } -#endif - } -} - - - -void SlugsMAV::emitSignals (void) -{ -#ifdef MAVLINK_ENABLED_SLUGS - switch(updateRoundRobin) { - case 1: - emit slugsCPULoad(uasId, mlCpuLoadData); - emit slugsSensorBias(uasId,mlSensorBiasData); - break; - - case 2: - emit slugsAirData(uasId, mlAirData); - emit slugsDiagnostic(uasId,mlDiagnosticData); - - break; - - case 3: - emit slugsNavegation(uasId, mlNavigation); - emit slugsDataLog(uasId, mlDataLog); - break; - - case 4: - emit slugsGPSDateTime(uasId, mlGpsDateTime); - - break; - - case 5: - emit slugsActionAck(uasId,mlActionAck); - emit emitGpsSignals(); - break; - - case 6: - emit slugsChannels(uasId, mlChannels); - emit slugsServo(uasId, mlServo); - emit slugsScaled(uasId, mlScaled); - - break; - } - - emit slugsAttitude(uasId, mlAttitude); - emit attitudeChanged(this, - mlAttitude.roll, - mlAttitude.pitch, - mlAttitude.yaw, - 0.0); -#endif - - emit slugsRawImu(uasId, mlRawImuData); - - - // wrap around - updateRoundRobin = updateRoundRobin > 10? 1: updateRoundRobin + 1; - - -} - -#ifdef MAVLINK_ENABLED_SLUGS -void SlugsMAV::emitGpsSignals (void) -{ - - // qDebug()<<"After Emit GPS Signal"< 0){ - emit globalPositionChanged(this, - mlGpsData.lon, - mlGpsData.lat, - mlGpsData.alt, - 0.0); - - emit slugsGPSCogSog(uasId,mlGpsData.hdg, mlGpsData.v); - -} - - - -#endif // MAVLINK_ENABLED_SLUGS diff --git a/src/uas/SlugsMAV.h b/src/uas/SlugsMAV.h deleted file mode 100644 index da88cbe..0000000 --- a/src/uas/SlugsMAV.h +++ /dev/null @@ -1,131 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -#ifndef SLUGSMAV_H -#define SLUGSMAV_H - -#include "UAS.h" -#include "mavlink.h" -#include - -#define SLUGS_UPDATE_RATE 200 // in ms -class SlugsMAV : public UAS -{ - Q_OBJECT - Q_INTERFACES(UASInterface) - - enum SLUGS_ACTION { - SLUGS_ACTION_NONE, - SLUGS_ACTION_SUCCESS, - SLUGS_ACTION_FAIL, - SLUGS_ACTION_EEPROM, - SLUGS_ACTION_MODE_CHANGE, - SLUGS_ACTION_MODE_REPORT, - SLUGS_ACTION_PT_CHANGE, - SLUGS_ACTION_PT_REPORT, - SLUGS_ACTION_PID_CHANGE, - SLUGS_ACTION_PID_REPORT, - SLUGS_ACTION_WP_CHANGE, - SLUGS_ACTION_WP_REPORT, - SLUGS_ACTION_MLC_CHANGE, - SLUGS_ACTION_MLC_REPORT - }; - - -public: - SlugsMAV(MAVLinkProtocol* mavlink, QThread* thread, int id = 0); - -public slots: - /** @brief Receive a MAVLink message from this MAV */ - void receiveMessage(LinkInterface* link, mavlink_message_t message); - - void emitSignals (void); - -signals: - - void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData); - void slugsGPSCogSog(int uasId, double cog, double sog); - -#ifdef MAVLINK_ENABLED_SLUGS - - 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); - void slugsGPSDateTime(int systemId, const mavlink_gps_date_time_t& gpsDateTime); - void slugsActionAck(int systemId, const mavlink_action_ack_t& actionAck); - - void slugsBootMsg(int uasId, mavlink_boot_t& boot); - void slugsAttitude(int uasId, mavlink_attitude_t& attitude); - - void slugsScaled(int uasId, const mavlink_scaled_imu_t& scaled); - void slugsServo(int uasId, const mavlink_servo_output_raw_t& servo); - void slugsChannels(int uasId, const mavlink_rc_channels_raw_t& channels); - -#endif - -protected: - unsigned char updateRoundRobin; - QTimer* widgetTimer; - mavlink_raw_imu_t mlRawImuData; - -#ifdef MAVLINK_ENABLED_SLUGS - mavlink_gps_raw_t mlGpsData; - mavlink_attitude_t mlAttitude; - mavlink_cpu_load_t mlCpuLoadData; - mavlink_air_data_t mlAirData; - mavlink_sensor_bias_t mlSensorBiasData; - mavlink_diagnostic_t mlDiagnosticData; - mavlink_boot_t mlBoot; - mavlink_gps_date_time_t mlGpsDateTime; - mavlink_mid_lvl_cmds_t mlMidLevelCommands; - mavlink_set_mode_t mlApMode; - - mavlink_slugs_navigation_t mlNavigation; - mavlink_data_log_t mlDataLog; - mavlink_ctrl_srfc_pt_t mlPassthrough; - mavlink_action_ack_t mlActionAck; - - mavlink_slugs_action_t mlAction; - - mavlink_scaled_imu_t mlScaled; - mavlink_servo_output_raw_t mlServo; - mavlink_rc_channels_raw_t mlChannels; - - - // Standart messages MAVLINK used by SLUGS -private: - - - void emitGpsSignals (void); - void emitPidSignal(void); - - int uasId; - -#endif // if SLUGS - -}; - -#endif // SLUGSMAV_H diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 2f37f7c..c60851c 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -85,7 +85,6 @@ This file is part of the QGROUNDCONTROL project // FIXME Move #include "PxQuadMAV.h" -#include "SlugsMAV.h" #include "LogCompressor.h" diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 9605b8f..c1694c3 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -65,12 +65,8 @@ This file is part of the QGROUNDCONTROL project #include "QGCGoogleEarthView.h" #endif #include "QGCToolBar.h" -#include "SlugsDataSensorView.h" #include "LogCompressor.h" -#include "SlugsHilSim.h" - -#include "SlugsPadCameraControl.h" #include "UASControlParameters.h" #include "QGCMAVLinkInspector.h" #include "QGCMAVLinkLogPlayer.h" @@ -463,9 +459,6 @@ protected: QPointer hsiDockWidget; QPointer rcViewDockWidget; QPointer hudDockWidget; - QPointer slugsDataWidget; - QPointer slugsHilSimWidget; - QPointer slugsCamControlWidget; QPointer toolBar; QPointer customStatusBar; diff --git a/src/ui/SlugsDataSensorView.cc b/src/ui/SlugsDataSensorView.cc deleted file mode 100644 index c414df0..0000000 --- a/src/ui/SlugsDataSensorView.cc +++ /dev/null @@ -1,352 +0,0 @@ -#include "SlugsDataSensorView.h" -#include "ui_SlugsDataSensorView.h" - -#include -#include "SlugsMAV.h" - -#include - -SlugsDataSensorView::SlugsDataSensorView(QWidget *parent) : - QWidget(parent), - ui(new Ui::SlugsDataSensorView) -{ - ui->setupUi(this); - - activeUAS = NULL; - - this->setVisible(false); - - - - -} - -SlugsDataSensorView::~SlugsDataSensorView() -{ - delete ui; -} - -void SlugsDataSensorView::addUAS(UASInterface* uas) -{ - SlugsMAV* slugsMav = qobject_cast(uas); - - if (slugsMav != NULL) { - - connect(slugsMav, SIGNAL(slugsRawImu(int, const mavlink_raw_imu_t&)), this, SLOT(slugRawDataChanged(int, const mavlink_raw_imu_t&))); - -#ifdef MAVLINK_ENABLED_SLUGS - - //connect standar messages - connect(slugsMav, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(slugLocalPositionChanged(UASInterface*,double,double,double,quint64))); - connect(slugsMav, SIGNAL(velocityChanged_NED(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(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&))); - - connect(slugsMav, SIGNAL(slugsNavegation(int,const mavlink_slugs_navigation_t&)),this,SLOT(slugsNavegationChanged(int,const mavlink_slugs_navigation_t&))); - connect(slugsMav, SIGNAL(slugsDataLog(int,const mavlink_data_log_t&)), this, SLOT(slugsDataLogChanged(int,const mavlink_data_log_t&))); -// 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&))); - - - connect(slugsMav, SIGNAL(slugsChannels(int, const mavlink_rc_channels_raw_t&)), this, SLOT(slugsRCRawChannels(int, const mavlink_rc_channels_raw_t&))); - connect(slugsMav, SIGNAL(slugsServo(int, const mavlink_servo_output_raw_t&)), this, SLOT(slugsRCServo(int,const mavlink_servo_output_raw_t&))); - connect(slugsMav, SIGNAL(slugsScaled(int, const mavlink_scaled_imu_t&)), this, SLOT(slugsFilteredDataChanged(int, const mavlink_scaled_imu_t&))); - -#endif // MAVLINK_ENABLED_SLUGS - // Set this UAS as active if it is the first one - if(activeUAS == 0) { - activeUAS = uas; - } - - } -} - -void SlugsDataSensorView::slugRawDataChanged(int uasId, const mavlink_raw_imu_t &rawData) -{ - Q_UNUSED(uasId); - - 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)); - -} - -#ifdef MAVLINK_ENABLED_SLUGS -void SlugsDataSensorView::slugsRCRawChannels(int systemId, const mavlink_rc_channels_raw_t &gpsDateTime) -{ - Q_UNUSED(systemId); - - ui->tbRCThrottle->setText(QString::number(gpsDateTime.chan1_raw)); - ui->tbRCAileron->setText(QString::number(gpsDateTime.chan2_raw)); - ui->tbRCRudder->setText(QString::number(gpsDateTime.chan3_raw)); - ui->tbRCElevator->setText(QString::number(gpsDateTime.chan4_raw)); -} - -void SlugsDataSensorView::slugsRCServo(int systemId, const mavlink_servo_output_raw_t &gpsDateTime) -{ - Q_UNUSED(systemId); - - ui->m_pwmThro->setText(QString::number(gpsDateTime.servo1_raw)); - ui->m_pwmAile->setText(QString::number(gpsDateTime.servo2_raw)); - ui->m_pwmRudd->setText(QString::number(gpsDateTime.servo3_raw)); - ui->m_pwmElev->setText(QString::number(gpsDateTime.servo4_raw)); - - ui->m_pwmThroTrim->setText(QString::number(gpsDateTime.servo5_raw)); - ui->m_pwmAileTrim->setText(QString::number(gpsDateTime.servo6_raw)); - ui->m_pwmRuddTrim->setText(QString::number(gpsDateTime.servo7_raw)); - ui->m_pwmElevTrim->setText(QString::number(gpsDateTime.servo8_raw)); -} -#endif - -void SlugsDataSensorView::setActiveUAS(UASInterface* uas) -{ - activeUAS = uas; - addUAS(activeUAS); -} - -#ifdef MAVLINK_ENABLED_SLUGS - -void SlugsDataSensorView::slugsGlobalPositionChanged(UASInterface *uas, - double lat, - double lon, - double alt, - quint64 time) -{ - 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 = "<ed_x->setText(QString::number(x)); - ui->ed_y->setText(QString::number(y)); - ui->ed_z->setText(QString::number(z)); - -} - -void SlugsDataSensorView::slugSpeedLocalPositionChanged(UASInterface* uas, - double vx, - double vy, - double vz, - quint64 time) -{ - Q_UNUSED( uas); - Q_UNUSED(time); - - ui->ed_vx->setText(QString::number(vx)); - ui->ed_vy->setText(QString::number(vy)); - ui->ed_vz->setText(QString::number(vz)); - - //qDebug()<<"Speed Local Position = "<m_Roll->setText(QString::number(slugroll)); - ui->m_Pitch->setText(QString::number(slugpitch)); - ui->m_Yaw->setText(QString::number(slugyaw)); - - // qDebug()<<"Attitude change = "<m_AxBiases->setText(QString::number(sensorBias.axBias)); - ui->m_AyBiases->setText(QString::number(sensorBias.ayBias)); - ui->m_AzBiases->setText(QString::number(sensorBias.azBias)); - ui->m_GxBiases->setText(QString::number(sensorBias.gxBias)); - ui->m_GyBiases->setText(QString::number(sensorBias.gyBias)); - ui->m_GzBiases->setText(QString::number(sensorBias.gzBias)); - -} - - -void SlugsDataSensorView::slugsDiagnosticMessageChanged(int systemId, - const mavlink_diagnostic_t& diagnostic) -{ - Q_UNUSED(systemId); - - ui->m_Fl1->setText(QString::number(diagnostic.diagFl1)); - ui->m_Fl2->setText(QString::number(diagnostic.diagFl2)); - ui->m_Fl3->setText(QString::number(diagnostic.diagFl2)); - - ui->m_Sh1->setText(QString::number(diagnostic.diagSh1)); - ui->m_Sh2->setText(QString::number(diagnostic.diagSh2)); - ui->m_Sh3->setText(QString::number(diagnostic.diagSh3)); -} - - -void SlugsDataSensorView::slugsCpuLoadChanged(int systemId, - const mavlink_cpu_load_t& cpuLoad) -{ - Q_UNUSED(systemId); - ui->ed_sens->setText(QString::number(cpuLoad.sensLoad)); - ui->ed_control->setText(QString::number(cpuLoad.ctrlLoad)); - ui->ed_batvolt->setText(QString::number(cpuLoad.batVolt)); -} - -void SlugsDataSensorView::slugsNavegationChanged(int systemId, - const mavlink_slugs_navigation_t& slugsNavigation) -{ - Q_UNUSED(systemId); - ui->m_Um->setText(QString::number(slugsNavigation.u_m)); - ui->m_PhiC->setText(QString::number(slugsNavigation.phi_c)); - ui->m_PitchC->setText(QString::number(slugsNavigation.theta_c)); - ui->m_PsidC->setText(QString::number(slugsNavigation.psiDot_c)); - ui->m_AyBody->setText(QString::number(slugsNavigation.ay_body)); - ui->m_TotRun->setText(QString::number(slugsNavigation.totalDist)); - ui->m_DistToGo->setText(QString::number(slugsNavigation.dist2Go)); - ui->m_FromWP->setText(QString::number(slugsNavigation.fromWP)); - ui->m_ToWP->setText(QString::number(slugsNavigation.toWP)); -} - - - -void SlugsDataSensorView::slugsDataLogChanged(int systemId, - const mavlink_data_log_t& dataLog) -{ - Q_UNUSED(systemId); - ui->m_logFl1->setText(QString::number(dataLog.fl_1)); - ui->m_logFl2->setText(QString::number(dataLog.fl_2)); - ui->m_logFl3->setText(QString::number(dataLog.fl_3)); - ui->m_logFl4->setText(QString::number(dataLog.fl_4)); - ui->m_logFl5->setText(QString::number(dataLog.fl_5)); - ui->m_logFl6->setText(QString::number(dataLog.fl_6)); -} - -//void SlugsDataSensorView::slugsPWMChanged(int systemId, -// const mavlink_servo_output_raw_t& pwmCommands){ -// Q_UNUSED(systemId); -// ui->m_pwmThro->setText(QString::number(pwmCommands.servo1_raw));//.dt_c)); -// ui->m_pwmAile->setText(QString::number(pwmCommands.servo2_raw));//dla_c)); -// ui->m_pwmElev->setText(QString::number(pwmCommands.servo4_raw));//dle_c)); -// ui->m_pwmRudd->setText(QString::number(pwmCommands.servo3_raw));//dr_c)); - -// ui->m_pwmThroTrim->setText(QString::number(pwmCommands.servo5_raw));//dre_c)); -// ui->m_pwmAileTrim->setText(QString::number(pwmCommands.servo6_raw));//dlf_c)); -// ui->m_pwmElevTrim->setText(QString::number(pwmCommands.servo8_raw));//drf_c)); -// ui->m_pwmRuddTrim->setText(QString::number(pwmCommands.servo7_raw));//aux1)); - -//} - -void SlugsDataSensorView::slugsFilteredDataChanged(int systemId, - const mavlink_scaled_imu_t& filteredData) -{ - Q_UNUSED(systemId); - ui->m_Axf->setText(QString::number(filteredData.xacc/1000.0f)); - ui->m_Ayf->setText(QString::number(filteredData.yacc/1000.0f)); - ui->m_Azf->setText(QString::number(filteredData.zacc/1000.0f)); - ui->m_Gxf->setText(QString::number(filteredData.xgyro/1000.0f)); - ui->m_Gyf->setText(QString::number(filteredData.ygyro/1000.0f)); - ui->m_Gzf->setText(QString::number(filteredData.zgyro/1000.0f)); - ui->m_Mxf->setText(QString::number(filteredData.xmag/1000.0f)); - ui->m_Myf->setText(QString::number(filteredData.ymag/1000.0f)); - ui->m_Mzf->setText(QString::number(filteredData.zmag/1000.0f)); -} - -void SlugsDataSensorView::slugsGPSDateTimeChanged(int systemId, - const mavlink_gps_date_time_t& gpsDateTime) -{ - Q_UNUSED(systemId); - - 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)); - - 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)); -} - -/** - * @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 diff --git a/src/ui/SlugsDataSensorView.h b/src/ui/SlugsDataSensorView.h deleted file mode 100644 index 628f6e2..0000000 --- a/src/ui/SlugsDataSensorView.h +++ /dev/null @@ -1,213 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Grpahical presentation of SLUGS generated data - * - * @author Juan F. Robles - * - */ - -#ifndef SLUGSDATASENSORVIEW_H -#define SLUGSDATASENSORVIEW_H - -#include - -#include "UASInterface.h" -#include "SlugsMAV.h" -#include "mavlink.h" - - -namespace Ui -{ -class SlugsDataSensorView; -} - -class SlugsDataSensorView : public QWidget -{ - Q_OBJECT - -public: - explicit SlugsDataSensorView(QWidget *parent = 0); - ~SlugsDataSensorView(); - -public slots: - /** - * @brief Adds the UAS for data display - * - * Adds the UAS and makes all the correct connections for data display on the Widgets. If - * there is no current UAS active, it sets it as active. - - * @param uas The UAS being added - */ - void addUAS(UASInterface* uas); - - /** - * @brief Sets the UAS as active - * - * @param uas The UAS being set as active - */ - void setActiveUAS(UASInterface* uas); - - - /** - * @brief Updates the Raw Data widget - */ - void slugRawDataChanged (int uasId, const mavlink_raw_imu_t& rawData); - -#ifdef MAVLINK_ENABLED_SLUGS - /** - * @brief Adds the UAS for data display - * - * Adds the UAS and makes all the correct connections for data display on the Widgets - */ - void slugLocalPositionChanged(UASInterface* uas, - double x, - double y, - double z, - quint64 time); - /** - * @brief Adds the UAS for data display - * - * Adds the UAS and makes all the correct connections for data display on the Widgets - */ - void slugSpeedLocalPositionChanged(UASInterface* uas, - double vx, - double vy, - double vz, - quint64 time); - /** - * @brief Adds the UAS for data display - * - * Adds the UAS and makes all the correct connections for data display on the Widgets - */ - void slugAttitudeChanged(UASInterface* uas, - double slugroll, - double slugpitch, - double slugyaw, - quint64 time); - - /** - * @brief Adds the UAS for data display - * - * Adds the UAS and makes all the correct connections for data display on the Widgets - */ - void slugsGlobalPositionChanged(UASInterface* uas, - double lat, - double lon, - double alt, - quint64 time); - - /** - * @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 - 173 - */ - void slugsDiagnosticMessageChanged(int systemId, - const mavlink_diagnostic_t& diagnostic); - - - /** - * @brief Updates the Navigation widget - 176 - */ - void slugsNavegationChanged(int systemId, - const mavlink_slugs_navigation_t& slugsNavigation); - - /** - * @brief Updates the Data Log widget - 177 - */ - void slugsDataLogChanged(int systemId, - const mavlink_data_log_t& dataLog); - -// /** -// * @brief Updates the PWM Commands widget - 175 -// */ -// void slugsPWMChanged(int systemId, -// const mavlink_servo_output_raw_t& pwmCommands); - - /** - * @brief Updates the filtered sensor measurements widget - 178 - */ - void slugsFilteredDataChanged(int systemId, - const mavlink_scaled_imu_t& filteredData); - - - /** - * @brief Updates the gps Date Time widget - 179 - */ - void slugsGPSDateTimeChanged(int systemId, - const mavlink_gps_date_time_t& gpsDateTime); - - - void slugsRCRawChannels(int systemId, - const mavlink_rc_channels_raw_t& gpsDateTime); - - void slugsRCServo(int systemId, - const mavlink_servo_output_raw_t& gpsDateTime); - - -#endif // MAVLINK_ENABLED_SLUGS - -protected: - UASInterface* activeUAS; - -private: - Ui::SlugsDataSensorView *ui; - - - - - - - -}; - -#endif // SLUGSDATASENSORVIEW_H diff --git a/src/ui/SlugsDataSensorView.ui b/src/ui/SlugsDataSensorView.ui deleted file mode 100644 index fbe5309..0000000 --- a/src/ui/SlugsDataSensorView.ui +++ /dev/null @@ -1,3140 +0,0 @@ - - - SlugsDataSensorView - - - - 0 - 0 - 495 - 671 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Form - - - - - - 1 - - - - Navigation - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 50 - false - - - - Position - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - QFrame::NoFrame - - - X - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Y - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - QFrame::NoFrame - - - Z - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Vx - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Vy - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Vz - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 50 - false - - - - Attitude - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Roll - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Pitch - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Yaw - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 50 - false - - - - Navigation - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - U_m - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Pitch C - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Psi_d C - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Phi C - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ay body - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - From WP - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - To WP - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 17 - 13 - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Tot Run - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Dist to G - - - - - - - - - - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Attitude - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - Sensor Biases - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Axb - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ayb - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Azb - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gxb - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gyb - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gzb - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 311 - 171 - - - - - 10 - - - - PWM Commands - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Thro - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Aile - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Elev - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Rudd - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Thro Trim - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Aile Trim - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Elev Trim - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Rudd Trim - - - - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - 60 - 18 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - - - - - - - - - GPS Data - - - - - - - - - - - 10 - 75 - true - - - - Throttle - - - - - - - - 10 - 75 - true - - - - Aileron - - - - - - - - 10 - 75 - true - - - - Rudder - - - - - - - - 10 - 75 - true - - - - Elevator - - - - - - - - 10 - 75 - true - - - - SOG - - - - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - 10 - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - 10 - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - 10 - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - 10 - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - 10 - - - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Sensor - - - - - - - - GPS Data - - - - - - - - - 10 - 75 - true - - - - Date - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - Time - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - # Sats - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - COG - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - SOG - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - - - - - 10 - 75 - true - - - - Latitude - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - Longitude - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - - 10 - 75 - true - - - - Height - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Raw Data - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ax - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ay - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Az - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Mx - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - My - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Mz - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gx - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gy - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Filtered Data - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ax - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Ay - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Az - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Mx - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - My - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Mz - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gx - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gy - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Gz - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 132123 - 123123 - - - - CPU Load - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Sensor - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Control - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Batt Volt - - - - - - - - - - - - - - - - 0 - 0 - - - - - 132123 - 123123 - - - - Air Data - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Dynamic - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Static - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 75 - true - - - - Temperature - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Messages - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 50 - false - - - - Diagnostic Messages - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Fl1 - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Sh1 - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Fl2 - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Sh2 - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Fl3 - - - - - - - - - - - 0 - 0 - - - - - 10 - 75 - true - - - - Sh3 - - - - - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - 50 - false - - - - Log Messages - - - - - - - - - 10 - 75 - true - - - - Fl1 - - - - - - - - - - - 10 - 75 - true - - - - Fl4 - - - - - - - - - - - 10 - 75 - true - - - - Fl2 - - - - - - - - - - - 10 - 75 - true - - - - Fl5 - - - - - - - - - - - 10 - 75 - true - - - - Fl3 - - - - - - - - - - - 10 - 75 - true - - - - Fl6 - - - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - diff --git a/src/ui/SlugsHilSim.cc b/src/ui/SlugsHilSim.cc deleted file mode 100644 index d88d53b..0000000 --- a/src/ui/SlugsHilSim.cc +++ /dev/null @@ -1,364 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Configuration Window for Slugs' HIL Simulator - * @author Mariano Lizarraga - * @author Alejandro Molina - */ - - -#include "SlugsHilSim.h" -#include "ui_SlugsHilSim.h" - - -SlugsHilSim::SlugsHilSim(QWidget *parent) : - QWidget(parent), - ui(new Ui::SlugsHilSim) -{ - ui->setupUi(this); - - rxSocket = new QUdpSocket(this); - txSocket = new QUdpSocket(this); - - hilLink = NULL; - - connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addToCombo(LinkInterface*))); - connect(ui->cb_mavlinkLinks, SIGNAL(currentIndexChanged(int)), this, SLOT(linkSelected(int))); - connect(ui->bt_startHil, SIGNAL(clicked()), this, SLOT(putInHilMode())); - connect(rxSocket, SIGNAL(readyRead()), this, SLOT(readDatagram())); - - linksAvailable.clear(); - -#ifdef MAVLINK_ENABLED_SLUGS - memset(&tmpAirData, 0, sizeof(mavlink_air_data_t)); - memset(&tmpAttitudeData, 0, sizeof(mavlink_attitude_t)); - memset(&tmpGpsData, 0, sizeof(mavlink_gps_raw_t)); - memset(&tmpGpsTime, 0, sizeof(mavlink_gps_date_time_t)); - memset(&tmpLocalPositionData, 0, sizeof(mavlink_sensor_bias_t)); - memset(&tmpRawImuData, 0, sizeof(mavlink_raw_imu_t)); -#endif - - foreach (LinkInterface* link, LinkManager::instance()->getLinks()) { - addToCombo(link); - } -} - -SlugsHilSim::~SlugsHilSim() -{ - rxSocket->disconnectFromHost(); - delete ui; -} - -void SlugsHilSim::addToCombo(LinkInterface* theLink) -{ - - linksAvailable.insert(ui->cb_mavlinkLinks->count(),theLink); - ui->cb_mavlinkLinks->addItem(theLink->getName()); - - if (hilLink == NULL) { - hilLink = theLink; - } - -} - -void SlugsHilSim::putInHilMode(void) -{ - - bool sw_enableControls = !(ui->bt_startHil->isChecked()); - QString buttonCaption= ui->bt_startHil->isChecked()? "Stop Slugs HIL Mode": "Set Slugs in HIL Mode"; - - if (ui->bt_startHil->isChecked()) { - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Critical); - msgBox.setText("You are about to put SLUGS in HIL Mode."); - msgBox.setInformativeText("It will stop reading the actual sensor readings. Do you wish to continue?"); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - - if(msgBox.exec() == QMessageBox::Yes) { - rxSocket->disconnectFromHost(); - rxSocket->bind(QHostAddress::Any, ui->ed_rxPort->text().toInt()); - //txSocket->bind(QHostAddress::Broadcast, ui->ed_txPort->text().toInt()); - - ui->ed_ipAdress->setEnabled(sw_enableControls); - ui->ed_rxPort->setEnabled(sw_enableControls); - ui->ed_txPort->setEnabled(sw_enableControls); - ui->cb_mavlinkLinks->setEnabled(sw_enableControls); - - ui->bt_startHil->setText(buttonCaption); - - activeUas->startHil(); - - } else { - ui->bt_startHil->setChecked(false); - } - } else { - ui->ed_ipAdress->setEnabled(sw_enableControls); - ui->ed_rxPort->setEnabled(sw_enableControls); - ui->ed_txPort->setEnabled(sw_enableControls); - ui->cb_mavlinkLinks->setEnabled(sw_enableControls); - - ui->bt_startHil->setText(buttonCaption); - - rxSocket->disconnectFromHost(); - activeUas->stopHil(); - } -} - -void SlugsHilSim::readDatagram(void) -{ - static int count = 0; - while (rxSocket->hasPendingDatagrams()) { - QByteArray datagram; - datagram.resize(rxSocket->pendingDatagramSize()); - QHostAddress sender; - quint16 senderPort; - - rxSocket->readDatagram(datagram.data(), datagram.size(), - &sender, &senderPort); - - if (datagram.size() == 113) { - processHilDatagram(&datagram); - - sendMessageToSlugs(); - - commandDatagramToSimulink(); - } - - ui->ed_count->setText(QString::number(count++)); - } -} - - -void SlugsHilSim::activeUasSet(UASInterface* uas) -{ - - if (uas != NULL) { - activeUas = static_cast (uas); - } -} - - -void SlugsHilSim::processHilDatagram(const QByteArray* datagram) -{ -#ifdef MAVLINK_ENABLED_SLUGS - unsigned char i = 0; - - - tmpGpsTime.year = datagram->at(i++); - tmpGpsTime.month = datagram->at(i++); - tmpGpsTime.day = datagram->at(i++); - tmpGpsTime.hour = datagram->at(i++); - tmpGpsTime.min = datagram->at(i++); - tmpGpsTime.sec = datagram->at(i++); - - tmpGpsData.lat = getFloatFromDatagram(datagram, &i); - tmpGpsData.lon = getFloatFromDatagram(datagram, &i); - tmpGpsData.alt = getFloatFromDatagram(datagram, &i); - - tmpGpsData.hdg = getUint16FromDatagram(datagram, &i); - tmpGpsData.v = getUint16FromDatagram(datagram, &i); - - tmpGpsData.eph = getUint16FromDatagram(datagram, &i); - tmpGpsData.fix_type = datagram->at(i++); - tmpGpsTime.visSat = datagram->at(i++); - i++; - - tmpAirData.dynamicPressure= getFloatFromDatagram(datagram, &i); - tmpAirData.staticPressure= getFloatFromDatagram(datagram, &i); - tmpAirData.temperature= getUint16FromDatagram(datagram, &i); - - // TODO Salto en el Datagrama - i=i+8; - - tmpRawImuData.xgyro = getUint16FromDatagram(datagram, &i); - tmpRawImuData.ygyro = getUint16FromDatagram(datagram, &i); - tmpRawImuData.zgyro = getUint16FromDatagram(datagram, &i); - tmpRawImuData.xacc = getUint16FromDatagram(datagram, &i); - tmpRawImuData.yacc = getUint16FromDatagram(datagram, &i); - tmpRawImuData.zacc = getUint16FromDatagram(datagram, &i); - tmpRawImuData.xmag = getUint16FromDatagram(datagram, &i); - tmpRawImuData.ymag = getUint16FromDatagram(datagram, &i); - tmpRawImuData.zmag = getUint16FromDatagram(datagram, &i); - - tmpAttitudeData.roll = getFloatFromDatagram(datagram, &i); - tmpAttitudeData.pitch = getFloatFromDatagram(datagram, &i); - tmpAttitudeData.yaw = getFloatFromDatagram(datagram, &i); - - tmpAttitudeData.rollspeed = getFloatFromDatagram(datagram, &i); - tmpAttitudeData.pitchspeed = getFloatFromDatagram(datagram, &i); - tmpAttitudeData.yawspeed = getFloatFromDatagram(datagram, &i); - - // TODO Crear Paquete SYNC TIME - i=i+2; - - tmpLocalPositionData.x = getFloatFromDatagram(datagram, &i); - tmpLocalPositionData.y = getFloatFromDatagram(datagram, &i); - tmpLocalPositionData.z = getFloatFromDatagram(datagram, &i); - tmpLocalPositionData.vx = getFloatFromDatagram(datagram, &i); - tmpLocalPositionData.vy = getFloatFromDatagram(datagram, &i); - tmpLocalPositionData.vz = getFloatFromDatagram(datagram, &i); - - // TODO: this is legacy of old HIL datagram. Need to remove from Simulink model - i++; - - ui->ed_1->setText(QString::number(tmpRawImuData.xacc)); - ui->ed_2->setText(QString::number(tmpRawImuData.yacc)); - ui->ed_3->setText(QString::number(tmpRawImuData.zacc)); - - ui->tbA->setText(QString::number(tmpRawImuData.xgyro)); - ui->tbB->setText(QString::number(tmpRawImuData.ygyro)); - ui->tbC->setText(QString::number(tmpRawImuData.zgyro)); - -#else - Q_UNUSED(datagram); -#endif -} - -float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned char * i) -{ - tFloatToChar tmpF2C; - - tmpF2C.chData[0] = datagram->at((*i)++); - tmpF2C.chData[1] = datagram->at((*i)++); - tmpF2C.chData[2] = datagram->at((*i)++); - tmpF2C.chData[3] = datagram->at((*i)++); - - return tmpF2C.flData; -} - -uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigned char * i) -{ - tUint16ToChar tmpU2C; - - tmpU2C.chData[0] = datagram->at((*i)++); - tmpU2C.chData[1] = datagram->at((*i)++); - - return tmpU2C.uiData; - -} - -void SlugsHilSim::linkSelected(int cbIndex) -{ -#ifdef MAVLINK_ENABLED_SLUGS - // HIL code to go here... - //hilLink = linksAvailable - // FIXME Mariano - - hilLink =linksAvailable.value(cbIndex); - -#else - Q_UNUSED(cbIndex) -#endif -} - -void SlugsHilSim::sendMessageToSlugs() -{ -#ifdef MAVLINK_ENABLED_SLUGS - mavlink_message_t msg; - - mavlink_msg_local_position_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpLocalPositionData); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); - - mavlink_msg_attitude_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpAttitudeData); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); - - mavlink_msg_raw_imu_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpRawImuData); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); - - mavlink_msg_air_data_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpAirData); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); - - mavlink_msg_gps_raw_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpGpsData); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); - - mavlink_msg_gps_date_time_encode(MG::SYSTEM::ID, - MG::SYSTEM::COMPID, - &msg, - &tmpGpsTime); - activeUas->sendMessage(hilLink, msg); - memset(&msg, 0, sizeof(mavlink_message_t)); -#endif -} - - -void SlugsHilSim::commandDatagramToSimulink() -{ -#ifdef MAVLINK_ENABLED_SLUGS - //mavlink_pwm_commands_t* pwdC = (static_cast(activeUas))->getPwmCommands(); - - //mavlink_pwm_commands_t* pwdC; - -// if(pwdC != NULL){ -// } - - QByteArray data; - data.resize(22); - - unsigned char i=0; - setUInt16ToDatagram(data, &i, 1);//pwdC->dt_c); - setUInt16ToDatagram(data, &i, 2);//pwdC->dla_c); - setUInt16ToDatagram(data, &i, 3);//pwdC->dra_c); - setUInt16ToDatagram(data, &i, 4);//pwdC->dr_c); - setUInt16ToDatagram(data, &i, 5);//pwdC->dle_c); - setUInt16ToDatagram(data, &i, 6);//pwdC->dre_c); - setUInt16ToDatagram(data, &i, 7);//pwdC->dlf_c); - setUInt16ToDatagram(data, &i, 8);//pwdC->drf_c); - setUInt16ToDatagram(data, &i, 9);//pwdC->aux1); - setUInt16ToDatagram(data, &i, 10);//pwdC->aux2); - setUInt16ToDatagram(data, &i, 11);//value default - - txSocket->writeDatagram(data, QHostAddress::Broadcast, ui->ed_txPort->text().toInt()); -#endif -} - -void SlugsHilSim::setUInt16ToDatagram(QByteArray& datagram, unsigned char* pos, uint16_t value) -{ - tUint16ToChar tmpUnion; - tmpUnion.uiData= value; - - datagram[(*pos)++]= tmpUnion.chData[0]; - datagram[(*pos)++]= tmpUnion.chData[1]; -} diff --git a/src/ui/SlugsHilSim.h b/src/ui/SlugsHilSim.h deleted file mode 100644 index 22c2e93..0000000 --- a/src/ui/SlugsHilSim.h +++ /dev/null @@ -1,158 +0,0 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - -======================================================================*/ - -/** - * @file - * @brief Definition of the configuration Window for Slugs' HIL Simulator - * @author Mariano Lizarraga - */ - -#ifndef SLUGSHILSIM_H -#define SLUGSHILSIM_H - -#include - -#include -#include -#include -#include -#include - - -#include "LinkInterface.h" -#include "UAS.h" -#include "LinkManager.h" -#include "SlugsMAV.h" - - -namespace Ui -{ -class SlugsHilSim; -} - -class SlugsHilSim : public QWidget -{ - Q_OBJECT - -public: - explicit SlugsHilSim(QWidget *parent = 0); - ~SlugsHilSim(); - - - -protected: - LinkInterface* hilLink; - QHostAddress* simulinkIp; - QUdpSocket* txSocket; - QUdpSocket* rxSocket; - UAS* activeUas; - - mavlink_local_position_ned_t tmpLocalPositionData; - mavlink_attitude_t tmpAttitudeData; - mavlink_raw_imu_t tmpRawImuData; -#ifdef MAVLINK_ENABLED_SLUGS - mavlink_air_data_t tmpAirData; -#endif - mavlink_gps_raw_int_t tmpGpsData; -#ifdef MAVLINK_ENABLED_SLUGS - mavlink_gps_date_time_t tmpGpsTime; -#endif - -public slots: - - /** - * @brief Adds a link to the combo box listing so the user can select a link - * - * Populates the Combo box that allows the user to select the link with which Slugs will - * receive the simulated sensor data from Simulink - * - * @param theLink the link that is being added to the combo box - */ - void addToCombo(LinkInterface* theLink); - - /** - * @brief Puts Slugs in HIL Mode - * - * Sends the required messages through the main communication link to set Slugs in HIL Mode - * - */ - void putInHilMode(void); - - /** - * @brief Receives a datagram from Simulink containing the sensor data. - * - * Receives a datagram from Simulink containing the simulated sensor data. This data is then - * forwarded to Slugs to use as input to the attitude estimation and navigation algorithms. - * - */ - void readDatagram(void); - - /** - * @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); - - /** - * @brief Called when the Link combobox selects a new link. - * - * @param uas The new index of the selected link - */ - void linkSelected (int cbIndex); - -public slots: - - - -private: - - typedef union _tFloatToChar { - unsigned char chData[4]; - float flData; - } tFloatToChar; - - typedef union _tUint16ToChar { - unsigned char chData[2]; - uint16_t uiData; - } tUint16ToChar; - - Ui::SlugsHilSim *ui; - - QHash linksAvailable; - - void processHilDatagram (const QByteArray* datagram); - float getFloatFromDatagram (const QByteArray* datagram, unsigned char * i); - uint16_t getUint16FromDatagram (const QByteArray* datagram, unsigned char * i); - void setUInt16ToDatagram(QByteArray& datagram, unsigned char* pos, uint16_t value); - - - void sendMessageToSlugs(); - - void commandDatagramToSimulink(); - -}; - -#endif // SLUGSHILSIM_H diff --git a/src/ui/SlugsHilSim.ui b/src/ui/SlugsHilSim.ui deleted file mode 100644 index 7edcb1e..0000000 --- a/src/ui/SlugsHilSim.ui +++ /dev/null @@ -1,369 +0,0 @@ - - - SlugsHilSim - - - - 0 - 0 - 337 - 278 - - - - - 320 - 252 - - - - - 450 - 278 - - - - - 10 - - - - Form - - - - - - - - - - - 10 - 75 - true - - - - Qt::LeftToRight - - - IP Address - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - 10 - 75 - true - - - - Qt::LeftToRight - - - Receive Port - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - - - - - 10 - 75 - true - - - - Qt::LeftToRight - - - Send Port - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 10 - 75 - true - - - - Qt::RightToLeft - - - Slugs HIL Link - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 171 - 26 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Set Slugs in HIL Mode - - - true - - - - - - - - - - - - 10 - 75 - true - - - - Qt::LeftToRight - - - Count - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - true - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - true - - - - - - - - 60 - 18 - - - - - 80 - 18 - - - - true - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ui/SlugsPadCameraControl.cpp b/src/ui/SlugsPadCameraControl.cpp deleted file mode 100644 index 3fe1191..0000000 --- a/src/ui/SlugsPadCameraControl.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "SlugsPadCameraControl.h" -#include "ui_SlugsPadCameraControl.h" - -SlugsPadCameraControl::SlugsPadCameraControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::SlugsPadCameraControl), - dragging(0) -{ - ui->setupUi(this); - x1= 0; - y1 = 0; - motion = NONE; -} - -SlugsPadCameraControl::~SlugsPadCameraControl() -{ - delete ui; -} - -void SlugsPadCameraControl::activeUasSet(UASInterface *uas) -{ - if(uas) { - this->activeUAS= uas; - } -} - -void SlugsPadCameraControl::mouseMoveEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - - if(dragging) { - getDeltaPositionPad(event->x(), event->y()); - } -} - -void SlugsPadCameraControl::mousePressEvent(QMouseEvent *event) -{ - if(!dragging) { - dragging = true; - x1 = event->x(); - y1 = event->y(); - } -} - -void SlugsPadCameraControl::mouseReleaseEvent(QMouseEvent *event) -{ - if(dragging) { - dragging = false; - getDeltaPositionPad(event->x(), event->y()); - - xFin = event->x(); - yFin = event->y(); - } -} - -void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2) -{ - QPointF localMeasures = ObtenerMarcacionDistanciaPixel(y1,x1,y2,x2); - - if(localMeasures.y()>10) { - QString dir = "nd"; - - double bearing = localMeasures.x(); - - bearing = bearing +90; - - if(bearing>= 360) { - bearing = bearing - 360; - } - - if(bearing >337.5 || bearing <=22.5) { - motion= UP; - movePad = QPoint(0, 1); - dir = "UP"; - } else if(bearing >22.5 && bearing <=67.5) { - motion= RIGHT_UP; - movePad = QPoint(1, 1); - dir = "RIGHT UP"; - } else if(bearing >67.5 && bearing <=112.5) { - motion= RIGHT; - movePad = QPoint(1, 0); - dir = "RIGHT"; - } else if(bearing >112.5 && bearing <= 157.5) { - motion= RIGHT_DOWN; - movePad = QPoint(1, -1); - dir = "RIGHT DOWN"; - } else if(bearing >157.5 && bearing <=202.5) { - motion= DOWN; - movePad = QPoint(0, -1); - dir = "DOWN"; - } else if(bearing >202.5 && bearing <=247.5) { - motion= LEFT_DOWN; - movePad = QPoint(-1, -1); - dir = "LEFT DOWN"; - } else if(bearing >247.5 && bearing <=292.5) { - motion= LEFT; - movePad = QPoint(-1, 0); - dir = "LEFT"; - } else if(bearing >292.5 && bearing <=337.5) { - motion= LEFT_UP; - movePad = QPoint(-1, 1); - dir = "LEFT UP"; - } - - emit changeMotionCamera(motion); - - ui->lbPixel->setText(QString::number(localMeasures.y())); - ui->lbDirection->setText(dir); - - //qDebug()< lon2)) //primer cuadrante - marcacion = 360 -((asin(cateto_adyacente/hipotenusa))/ 0.017453292); - else if ((lat1 < lat2) && (lon1 < lon2)) //segundo cuadrante - marcacion = (asin(cateto_adyacente/hipotenusa))/ 0.017453292; - else if((lat1 > lat2) && (lon1 < lon2)) //tercer cuadrante - marcacion = 180 -((asin(cateto_adyacente/hipotenusa))/ 0.017453292); - else if((lat1 > lat2) && (lon1 > lon2)) //cuarto cuadrante - marcacion = 180 +((asin(cateto_adyacente/hipotenusa))/ 0.017453292); - else if((lat1 < lat2) && (lon1 == lon2)) //360 - marcacion = 360; - else if((lat1 == lat2) && (lon1 > lon2)) //270 - marcacion = 270; - else if((lat1 > lat2) && (lon1 == lon2)) //180 - marcacion = 180; - else if((lat1 == lat2) && (lon1 < lon2)) //90 - marcacion =90; - else if((lat1 == lat2) && (lon1 == lon2)) //0 - marcacion = 0.0; - - return QPointF(marcacion,hipotenusa);// distancia); -} - -void SlugsPadCameraControl::keyPressEvent(QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Left: - emit changeMotionCamera(LEFT); - break; - - case Qt::Key_Right: - emit changeMotionCamera(RIGHT); - break; - - case Qt::Key_Down: - emit changeMotionCamera(DOWN); - break; - - case Qt::Key_Up: - emit changeMotionCamera(UP); - break; - - default: - QWidget::keyPressEvent(event); - } -} diff --git a/src/ui/SlugsPadCameraControl.h b/src/ui/SlugsPadCameraControl.h deleted file mode 100644 index 3f4e879..0000000 --- a/src/ui/SlugsPadCameraControl.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef SLUGSPADCAMERACONTROL_H -#define SLUGSPADCAMERACONTROL_H - -#include -#include -#include -#include -#include -#include -#include -#include "UASManager.h" - -namespace Ui -{ -class SlugsPadCameraControl; -} - -class SlugsPadCameraControl : public QWidget //QGraphicsView// -{ - Q_OBJECT - -public: - explicit SlugsPadCameraControl(QWidget *parent = 0); - - ~SlugsPadCameraControl(); - - enum MotionCamera { - UP, - DOWN, - LEFT, - RIGHT, - RIGHT_UP, - RIGHT_DOWN, - LEFT_UP, - LEFT_DOWN, - NONE - }; - -public slots: - void getDeltaPositionPad(int x, int y); - QPointF ObtenerMarcacionDistanciaPixel(double lon1, double lat1, double lon2, double lat2); - void activeUasSet(UASInterface *uas); - -signals: - void changeMotionCamera(MotionCamera); - -protected: - void mousePressEvent(QMouseEvent* event); - void mouseReleaseEvent(QMouseEvent* event); - void mouseMoveEvent(QMouseEvent* event); - void keyPressEvent(QKeyEvent *event); - //void paintEvent(QPaintEvent *pe); - - -private: - Ui::SlugsPadCameraControl *ui; - bool dragging; - int x1; - int y1; - int xFin; - int yFin; - QString directionPad; - MotionCamera motion; - UASInterface* activeUAS; - QPoint movePad; - -}; - -#endif // SLUGSPADCAMERACONTROL_H diff --git a/src/ui/SlugsPadCameraControl.ui b/src/ui/SlugsPadCameraControl.ui deleted file mode 100644 index 5b7fa93..0000000 --- a/src/ui/SlugsPadCameraControl.ui +++ /dev/null @@ -1,94 +0,0 @@ - - - SlugsPadCameraControl - - - - 0 - 0 - 200 - 200 - - - - - 200 - 200 - - - - Form - - - background-color: rgb(255, 170, 0); - - - - 1 - - - 1 - - - - - - 200 - 200 - - - - true - - - background-color: rgb(135, 206, 235); - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Qt::Vertical - - - - 20 - 156 - - - - - - - - - - - - - ---- - - - - - - - ---- - - - - - - - - - - - - - diff --git a/src/ui/SlugsVideoCamControl.cpp b/src/ui/SlugsVideoCamControl.cpp deleted file mode 100644 index 5d36455..0000000 --- a/src/ui/SlugsVideoCamControl.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "SlugsVideoCamControl.h" -#include "ui_SlugsVideoCamControl.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "SlugsPadCameraControl.h" - - -SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::SlugsVideoCamControl) -{ - ui->setupUi(this); -// x1= 0; -// y1 = 0; - - connect(ui->viewCamBordeatMap_checkBox,SIGNAL(clicked(bool)),this,SLOT(changeViewCamBorderAtMapStatus(bool))); - padCamera = new SlugsPadCameraControl(this); - - ui->gridLayout->addWidget(padCamera); - - //connect(padCamera,SIGNAL(mouseMoveCoord(int,int)),this,SLOT(mousePadMoveEvent(int,int))); - //connect(padCamera,SIGNAL(mousePressCoord(int,int)),this,SLOT(mousePadPressEvent(int,int))); - //connect(padCamera,SIGNAL(mouseReleaseCoord(int,int)),this,SLOT(mousePadReleaseEvent(int,int))); - //connect(padCamera,SIGNAL(changeCursorPosition(double,double,QString)),this,SLOT(getDeltaPositionPad(double,double,QString))); - - -} - -SlugsVideoCamControl::~SlugsVideoCamControl() -{ - delete ui; -} - -//void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event) -//{ -// Q_UNUSED(event); - -//} - - -//void SlugsVideoCamControl::mousePressEvent(QMouseEvent *evnt) -//{ -// Q_UNUSED(evnt); - -//} - -//void SlugsVideoCamControl::mouseReleaseEvent(QMouseEvent *evnt) -//{ -// Q_UNUSED(evnt); - -//} - - -//void SlugsVideoCamControl::mousePadMoveEvent(int x, int y) -//{ - -//} - -//void SlugsVideoCamControl::mousePadPressEvent(int x, int y) -//{ - -//} - -//void SlugsVideoCamControl::mousePadReleaseEvent(int x, int y) -//{ - - -//} - -void SlugsVideoCamControl::changeViewCamBorderAtMapStatus(bool status) -{ - emit viewCamBorderAtMap(status); -} - -void SlugsVideoCamControl::getDeltaPositionPad(double bearing, double distance, QString dirText) -{ - ui->label_dir->setText(dirText); - ui->label_x->setText("Distancia= " + QString::number(distance)); - ui->label_y->setText("Bearing= " + QString::number(bearing)); - - //emit changeCamPosition(20, bearing, dirText); -} - diff --git a/src/ui/uas/UASControlParameters.cpp b/src/ui/uas/UASControlParameters.cpp index 3947c2d..23f8f40 100644 --- a/src/ui/uas/UASControlParameters.cpp +++ b/src/ui/uas/UASControlParameters.cpp @@ -4,18 +4,6 @@ #define CONTROL_MODE_LOCKED "MODE LOCKED" #define CONTROL_MODE_MANUAL "MODE MANUAL" -#ifdef MAVLINK_ENABLED_SLUGS -#define CONTROL_MODE_GUIDED "MODE MID-L CMDS" -#define CONTROL_MODE_AUTO "MODE WAYPOINT" -#define CONTROL_MODE_TEST1 "MODE PASST" -#define CONTROL_MODE_TEST2 "MODE SEL PT" -#else -#define CONTROL_MODE_GUIDED "MODE GUIDED" -#define CONTROL_MODE_AUTO "MODE AUTO" -#define CONTROL_MODE_TEST1 "MODE TEST1" -#define CONTROL_MODE_TEST2 "MODE TEST2" -#endif - #define CONTROL_MODE_READY "MODE TEST3" #define CONTROL_MODE_RC_TRAINING "RC SIMULATION" @@ -61,21 +49,6 @@ void UASControlParameters::changedMode(int mode) case (uint8_t)MAV_MODE_MANUAL_DISARMED: modeTemp = "D/MANUAL MODE"; break; -#ifdef MAVLINK_ENABLED_SLUGS - case (uint8_t)MAV_MODE_AUTO: - modeTemp = "WAYPOINT MODE"; - break; - case (uint8_t)MAV_MODE_GUIDED: - modeTemp = "MID-L CMDS MODE"; - break; - - case (uint8_t)MAV_MODE_TEST1: - modeTemp = "PASST MODE"; - break; - case (uint8_t)MAV_MODE_TEST2: - modeTemp = "SEL PT MODE"; - break; -#endif default: modeTemp = "UNKNOWN MODE"; break; @@ -131,20 +104,6 @@ void UASControlParameters::updateAttitude(UASInterface *uas, double roll, double void UASControlParameters::setCommands() { -#ifdef MAVLINK_ENABLED_SLUGS - if(this->activeUAS) { - UAS* myUas= static_cast(this->activeUAS); - - mavlink_message_t msg; - - tempCmds.uCommand = ui->sbAirSpeed->value(); - tempCmds.hCommand = ui->sbHeight->value(); - tempCmds.rCommand = ui->sbTurnRate->value(); - - mavlink_msg_mid_lvl_cmds_encode(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, &this->tempCmds); - myUas->sendMessage(msg); - } -#endif } void UASControlParameters::getCommands() @@ -156,40 +115,6 @@ void UASControlParameters::getCommands() void UASControlParameters::setPassthrough() { -#ifdef MAVLINK_ENABLED_SLUGS - if(this->activeUAS) { - UAS* myUas= static_cast(this->activeUAS); - - mavlink_message_t msg; - - int8_t tmpBit=0; - - if(ui->cxdle_c->isChecked()) { //left elevator command - tmpBit+=8; - } - if(ui->cxdr_c->isChecked()) { //rudder command - tmpBit+=16; - } - - if(ui->cxdla_c->isChecked()) { //left aileron command - tmpBit+=64; - } - if(ui->cxdt_c->isChecked()) { //throttle command - tmpBit+=128; - } - - generic_16bit r; - r.b[1] = 0; - r.b[0] = tmpBit;//255; - - tempCtrl.target= this->activeUAS->getUASID(); - tempCtrl.bitfieldPt= (uint16_t)r.s; - - mavlink_msg_ctrl_srfc_pt_encode(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, &this->tempCtrl); - myUas->sendMessage(msg); - //qDebug()< #include "UASManager.h" -#include "SlugsMAV.h" #include #include @@ -45,10 +44,6 @@ private: QString REDcolorStyle; QPointer radio; LinkInterface* hilLink; -#ifdef MAVLINK_ENABLED_SLUGS - mavlink_mid_lvl_cmds_t tempCmds; - mavlink_ctrl_srfc_pt_t tempCtrl; -#endif }; #endif // UASCONTROLPARAMETERS_H From 80e96ad7dd72eb8e9db1a8897298cc5a984a5b69 Mon Sep 17 00:00:00 2001 From: Bryant Date: Tue, 22 Jul 2014 22:14:30 -0700 Subject: [PATCH 2/8] Removing old file containing dev notes. --- src/ui/dongfang-scrapyard.txt | 243 ------------------------------------------ 1 file changed, 243 deletions(-) delete mode 100644 src/ui/dongfang-scrapyard.txt diff --git a/src/ui/dongfang-scrapyard.txt b/src/ui/dongfang-scrapyard.txt deleted file mode 100644 index 913f949..0000000 --- a/src/ui/dongfang-scrapyard.txt +++ /dev/null @@ -1,243 +0,0 @@ - - /* This information is at least for the time not shown here but rather in some always visible bar. - void updateBattery(UASInterface*, double, double, double, int); - void receiveHeartbeat(UASInterface*); - void updateMode(int id,QString mode, QString description); - void updateLoad(UASInterface*, double); - void updateState(UASInterface*,QString); - void updateGPSFixType(UASInterface*,int); - void updateSatelliteCount(double count,QString sth); - void updateThrust(UASInterface*, double); - void updateLocalPosition(UASInterface*,double,double,double,quint64); - void updateGlobalPosition(UASInterface*,double,double,double,quint64); - void selectWaypoint(int uasId, int id); - */ - - /* - bool uavIsArmed; - QString mode; - QString state; - float load; - - double batteryVoltage; - double batteryCurrent; - double batteryCharge; - - int GPSFixType; - int satelliteCount; - */ - - - - - batteryVoltage(UNKNOWN_BATTERY), - batteryCurrent(UNKNOWN_BATTERY), - batteryCharge(UNKNOWN_BATTERY), - - GPSFixType(UNKNOWN_GPSFIXTYPE), - satelliteCount(UNKNOWN_COUNT), - - - uavIsArmed(false), // TODO: This is an assumption. We have no idea! - mode("-"), - state("-"), - load(0), - -void PrimaryFlightDisplay::updateBattery(UASInterface* uas, double voltage, double current, double percent, int seconds) -{ - Q_UNUSED(uas); - Q_UNUSED(seconds); - - batteryVoltage = voltage; - batteryCurrent = current; - batteryCharge = percent; -} - -void PrimaryFlightDisplay::updateGPSFixType(UASInterface* uas, int fixType) { - Q_UNUSED(uas); - this->GPSFixType = fixType; -} - -void PrimaryFlightDisplay::updateSatelliteCount(double count, QString name) { - Q_UNUSED(uas) - this->satelliteCount = (int)count; -} - -void PrimaryFlightDisplay::receiveHeartbeat(UASInterface*) -{ -} - -void PrimaryFlightDisplay::updateThrust(UASInterface* uas, double thrust) -{ - Q_UNUSED(uas); - Q_UNUSED(thrust); -} - -/* - * TODO! Implementation or removal of this. - * Currently a dummy. - */ -void PrimaryFlightDisplay::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint64 timestamp) -{ - Q_UNUSED(uas); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(z); - Q_UNUSED(timestamp); -} - -void PrimaryFlightDisplay::updateGlobalPosition(UASInterface* uas,double lat, double lon, double altitude, quint64 timestamp) -{ - Q_UNUSED(uas); - Q_UNUSED(lat); - Q_UNUSED(lon); - Q_UNUSED(timestamp); - - // TODO: Examine whether this is really the GPS alt or the mix-alt coming in. - GPSAltitude = altitude; -} - - -void PrimaryFlightDisplay::updateState(UASInterface* uas,QString state) -{ - // Only one UAS is connected at a time - Q_UNUSED(uas); - this->state = state; -} - -void PrimaryFlightDisplay::updateMode(int id, QString mode, QString description) -{ - // Only one UAS is connected at a time - Q_UNUSED(id); - Q_UNUSED(description); - this->mode = mode; -} - -void PrimaryFlightDisplay::updateLoad(UASInterface* uas, double load) -{ - Q_UNUSED(uas); - this->load = load; - //updateValue(uas, "load", load, MG::TIME::getGroundTimeNow()); -} - -void PrimaryFlightDisplay::selectWaypoint(int uasId, int id) { -} - -void PrimaryFlightDisplay::drawLinkStatsPanel ( - QPainter& painter, - QRectF area) { - // UAV Id - // Droprates up, down - QString s_linkStat("100%"); - QString s_upTime("01:23:34"); - - painter.resetTransform(); - - if (style == NO_OVERLAYS) - drawInstrumentBackground(painter, area); - - painter.translate(area.center()); - - QPen pen; - pen.setWidthF(lineWidth); - pen.setColor(amberColor); - painter.setPen(pen); - - drawTextCenter(painter, s_linkStat, mediumTextSize, 0, -area.height()/6); - drawTextCenter(painter, s_upTime, mediumTextSize, 0, area.height()/6); -} - -void PrimaryFlightDisplay::drawMissionStatsPanel ( - QPainter& painter, - QRectF area) { - // Flight mode - // next WP - // next WP dist - QString s_flightMode("Auto"); - QString s_nextWP("1234m\u21924"); - - painter.resetTransform(); - - if (style == NO_OVERLAYS) - drawInstrumentBackground(painter, area); - - painter.translate(area.center()); - - QPen pen; - pen.setWidthF(lineWidth); - pen.setColor(amberColor); - painter.setPen(pen); - drawTextCenter(painter, s_flightMode, mediumTextSize, 0, -area.height()/6); - drawTextCenter(painter, s_nextWP, mediumTextSize, 0, area.height()/6); -} - -void PrimaryFlightDisplay::drawSensorsStatsPanel ( - QPainter& painter, - QRectF area) { - // GPS fixmode and #sats - // Home alt.? - // Groundspeed? - QString s_GPS("GPS 3D(8)"); - QString s_homealt("H.alt 472m"); - - painter.resetTransform(); - - if (style == NO_OVERLAYS) - drawInstrumentBackground(painter, area); - - painter.translate(area.center()); - - QPen pen; - pen.setWidthF(lineWidth); - pen.setColor(amberColor); - painter.setPen(pen); - - drawTextCenter(painter, s_GPS, mediumTextSize, 0, -area.height()/6); - drawTextCenter(painter, s_homealt, mediumTextSize, 0, area.height()/6); -} -void PrimaryFlightDisplay::drawSysStatsPanel ( - QPainter& painter, - QRectF area) { - // Timer - // Battery - // Armed/not - - /* - energyStatus = tr("BAT [%1V | %2V%]").arg(voltage, 4, 'f', 1, QChar('0')).arg(percent, 2, 'f', 0, QChar('0')); - if (percent < 20.0f) { - fuelColor = warningColor; - } else if (percent < 10.0f) { - fuelColor = criticalColor; - } else { - fuelColor = infoColor; - } - */ - - QString voltageStatus = batteryVoltage == UNKNOWN_BATTERY ? "-V" : - tr("%1V").arg(batteryVoltage, 4, 'f', 1, QChar('0')); - QString chargeStatus = batteryCharge == UNKNOWN_BATTERY ? "-%" : - tr("%2%").arg(batteryCharge, 2, 'f', 0, QChar('0')); - // We ignore current right now. - - QString batteryStatus = voltageStatus.append(" ").append(chargeStatus); - - QString s_arm = uavIsArmed ? "Armed" : "Disarmed"; - - painter.resetTransform(); - - if (style == NO_OVERLAYS) - drawInstrumentBackground(painter, area); - - painter.translate(area.center()); - - QPen pen; - pen.setWidthF(lineWidth); - pen.setColor(amberColor); - painter.setPen(pen); - - drawTextCenter(painter, batteryStatus, mediumTextSize, 0, -area.height()/6); - pen.setColor(redColor); - drawTextCenter(painter, s_arm, mediumTextSize, 0, area.height()/6); -} - - From e196c07d9397194daec1f80d8f20571120f16c62 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 05:36:49 -0700 Subject: [PATCH 3/8] Ignore .qmake.stash Qt5 qmake seems to leave this handing around --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4f1e634..75fce56 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ bin/*.exe bin/*.txt bin/mac *pro.user* +.qmake.stash qrc_*.cpp *.Debug *.Release From 4b8a3aa59440c6c5f3bab25a036dfec6c1c752a2 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 05:36:59 -0700 Subject: [PATCH 4/8] FileManager UnitTest back on --- qgroundcontrol.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 5fba6c9..dbd2461 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -767,7 +767,8 @@ HEADERS += \ src/qgcunittest/FlightModeConfigTest.h \ src/qgcunittest/FlightGearTest.h \ src/qgcunittest/TCPLinkTest.h \ - src/qgcunittest/TCPLoopBackServer.h + src/qgcunittest/TCPLoopBackServer.h \ + src/qgcunittest/QGCUASFileManagerTest.h SOURCES += \ src/qgcunittest/UASUnitTest.cc \ @@ -779,4 +780,5 @@ SOURCES += \ src/qgcunittest/FlightModeConfigTest.cc \ src/qgcunittest/FlightGearTest.cc \ src/qgcunittest/TCPLinkTest.cc \ - src/qgcunittest/TCPLoopBackServer.cc + src/qgcunittest/TCPLoopBackServer.cc \ + src/qgcunittest/QGCUASFileManagerTest.cc From e839160947b8860da1cbe12953b2ccd6497103df Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 05:37:10 -0700 Subject: [PATCH 5/8] Better output for signal failures --- src/qgcunittest/MultiSignalSpy.cc | 13 +++++++++++++ src/qgcunittest/MultiSignalSpy.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/qgcunittest/MultiSignalSpy.cc b/src/qgcunittest/MultiSignalSpy.cc index 5d8d87c..d9f786f 100644 --- a/src/qgcunittest/MultiSignalSpy.cc +++ b/src/qgcunittest/MultiSignalSpy.cc @@ -96,6 +96,7 @@ bool MultiSignalSpy::checkSignalByMask(quint16 mask) Q_ASSERT(spy != NULL); if (spy->count() != 1) { + _printSignalState(); return false; } } @@ -114,10 +115,12 @@ bool MultiSignalSpy::checkOnlySignalByMask(quint16 mask) if ((1 << i) & mask) { if (spy->count() != 1) { + _printSignalState(); return false; } } else { if (spy->count() != 0) { + _printSignalState(); return false; } } @@ -135,6 +138,7 @@ bool MultiSignalSpy::checkNoSignalByMask(quint16 mask) Q_ASSERT(spy != NULL); if (spy->count() != 0) { + _printSignalState(); return false; } } @@ -232,3 +236,12 @@ bool MultiSignalSpy::waitForSignalByIndex( return spy->count() != 0; } + +void MultiSignalSpy::_printSignalState(void) +{ + for (size_t i=0; i<_cSignals; i++) { + QSignalSpy* spy = _rgSpys[i]; + Q_ASSERT(spy != NULL); + qDebug() << "Signal index:" << i << "count:" << spy->count(); + } +} diff --git a/src/qgcunittest/MultiSignalSpy.h b/src/qgcunittest/MultiSignalSpy.h index 92fb905..1ac5f44 100644 --- a/src/qgcunittest/MultiSignalSpy.h +++ b/src/qgcunittest/MultiSignalSpy.h @@ -59,6 +59,8 @@ public: private: // QObject overrides void timerEvent(QTimerEvent * event); + + void _printSignalState(void); QObject* _signalEmitter; const char** _rgSignals; From 80994911f59483f5034fc60316d25aa82021b85b Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 06:24:50 -0700 Subject: [PATCH 6/8] Set correct component ID Need to disambiguate from video stream messages --- src/qgcunittest/MockMavlinkFileServer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qgcunittest/MockMavlinkFileServer.cc b/src/qgcunittest/MockMavlinkFileServer.cc index 0a39c48..3457a89 100644 --- a/src/qgcunittest/MockMavlinkFileServer.cc +++ b/src/qgcunittest/MockMavlinkFileServer.cc @@ -281,7 +281,7 @@ void MockMavlinkFileServer::_emitResponse(QGCUASFileManager::Request* request) request->hdr.crc32 = QGCUASFileManager::crc32(request); - mavlink_msg_encapsulated_data_pack(250, 0, &mavlinkMessage, 0 /*_encdata_seq*/, (uint8_t*)request); + mavlink_msg_encapsulated_data_pack(250, MAV_COMP_ID_IMU, &mavlinkMessage, 0 /*_encdata_seq*/, (uint8_t*)request); emit messageReceived(NULL, mavlinkMessage); } From 63712d007319c9972699b4238f5f9c1a54beae89 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 06:43:13 -0700 Subject: [PATCH 7/8] Silence release build compiler warning --- src/qgcunittest/QGCUASFileManagerTest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qgcunittest/QGCUASFileManagerTest.cc b/src/qgcunittest/QGCUASFileManagerTest.cc index 7903995..78441d7 100644 --- a/src/qgcunittest/QGCUASFileManagerTest.cc +++ b/src/qgcunittest/QGCUASFileManagerTest.cc @@ -53,6 +53,7 @@ void QGCUASFileManagerUnitTest::init(void) bool connected = connect(&_mockFileServer, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), _fileManager, SLOT(receiveMessage(LinkInterface*, mavlink_message_t))); Q_ASSERT(connected); + Q_UNUSED(connected); // Silent release build compiler warning connected = connect(_fileManager, SIGNAL(statusMessage(const QString&)), this, SLOT(statusMessage(const QString&))); Q_ASSERT(connected); From 2076d3d4873b7c5fb85286f4de0b0f70ba664d55 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jul 2014 06:53:22 -0700 Subject: [PATCH 8/8] Bump signal wait time When unit tests are being run in TeamCity the host box can end up being very bogged down with other builds. So need to up wait time, to take into account CPUs grinding. --- src/qgcunittest/TCPLinkTest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qgcunittest/TCPLinkTest.cc b/src/qgcunittest/TCPLinkTest.cc index 5047125..b18a93e 100644 --- a/src/qgcunittest/TCPLinkTest.cc +++ b/src/qgcunittest/TCPLinkTest.cc @@ -150,7 +150,7 @@ void TCPLinkUnitTest::_connectSucceed_test(void) QCOMPARE(_link->connect(), true); // Make sure we get the two different connected signals - QCOMPARE(_multiSpy->waitForSignalByIndex(connectedSignalIndex, 1000), true); + QCOMPARE(_multiSpy->waitForSignalByIndex(connectedSignalIndex, 10000), true); QCOMPARE(_multiSpy->checkOnlySignalByMask(connectedSignalMask | connected2SignalMask), true); QList arguments = _multiSpy->getSpyByIndex(connected2SignalIndex)->takeFirst(); QCOMPARE(arguments.at(0).toBool(), true);