diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index dbd246141aa3b6496f3da199e55270166cbc2bd9..72b71f5f8db7bfaadd14c2a0a803c7dfd99e9a9d 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 ae16ed10aca8b4c2d2e9df7c0a5444efb3e00df1..72b1d041c1395139035b745bbc69fd19b8822cca 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 ccf4c0673fa76c52d303edd0df5ec037da2eb577..f1a1b90a82b1a13ccdb63fa616a2b340aaea127f 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 3c864a61c3c97a5296afe76ab910d069966a856a..d050a3384ec05e911a150b7838f496478af693ca 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 6928979d7cbee7deeddc95cffc3279cfce658ffa..0000000000000000000000000000000000000000 --- 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 da88cbea102715011abd8f9a564ba851e305f3f8..0000000000000000000000000000000000000000 --- 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 2f37f7cc1264e93e7bb0685a1c26b110ad282f5f..c60851c4fa27368bed1823b62680ad4900324ace 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 9605b8f7ac696f55fe3c2a6106762c81d7bae464..c1694c391133238da39f7b5c314a4e5b1a1a9502 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 c414df0d9b67dd64d045ba0411cbb44acba82ea4..0000000000000000000000000000000000000000 --- 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 628f6e29c756c43ca885155e4cbca6b752a451db..0000000000000000000000000000000000000000 --- 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 fbe5309c4e5c5a640f0d22eab363b07d164f3b5b..0000000000000000000000000000000000000000 --- 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 d88d53bb84bd69d7cc954388337aeae35b61bd46..0000000000000000000000000000000000000000 --- 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 22c2e933507f8cd20a46eba0579987f00c951b39..0000000000000000000000000000000000000000 --- 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 7edcb1ea7f22c4b8a1c2443c6145572307063668..0000000000000000000000000000000000000000 --- 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 3fe119108413c81ff81322ce9d49a78eae4761e8..0000000000000000000000000000000000000000 --- 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 3f4e8799d28fb9f5157d2028d6db8e0917a17b91..0000000000000000000000000000000000000000 --- 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 5b7fa9310714be5128dc4e6dce23d08674373f2c..0000000000000000000000000000000000000000 --- 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 5d3645517b8199cff1f2967bb9a7084490222239..0000000000000000000000000000000000000000 --- 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 3947c2d325a12f197269982c44c719bbc2fdea67..23f8f40d5cd34b33acf83e07b90d1672796ca1cf 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