diff --git a/src/uas/SlugsMAV.cc b/src/uas/SlugsMAV.cc index 7728ec387a4e2633c5d1713e273983a232d332a4..edc2a4d3bc6b7c7b2d22927a6d0b10f0648ba054 100644 --- a/src/uas/SlugsMAV.cc +++ b/src/uas/SlugsMAV.cc @@ -169,11 +169,16 @@ void SlugsMAV::emitSignals (void){ case 2: emit slugsAirData(uasId, mlAirData); emit slugsDiagnostic(uasId,mlDiagnosticData); + break; case 3: emit remoteControlChannelScaledChanged(0,(mlPilotConsoleData.de- 1000.0f)/1000.0f); - emit remoteControlChannelScaledChanged(1,0.75); + emit remoteControlChannelScaledChanged(1,(mlPilotConsoleData.dla- 1000.0f)/1000.0f); + emit remoteControlChannelScaledChanged(2,(mlPilotConsoleData.dr- 1000.0f)/1000.0f); + emit remoteControlChannelScaledChanged(3,(mlPilotConsoleData.dra- 1000.0f)/1000.0f); + emit remoteControlChannelScaledChanged(0,(mlPilotConsoleData.dt- 1000.0f)/1000.0f); + emit slugsPWM(uasId, mlPwmCommands); break; @@ -185,11 +190,13 @@ void SlugsMAV::emitSignals (void){ case 5: emit slugsFilteredData(uasId,mlFilteredData); emit slugsGPSDateTime(uasId, mlGpsDateTime); + break; case 6: emit slugsActionAck(uasId,mlActionAck); emit emitGpsSignals(); + break; } @@ -213,20 +220,30 @@ void SlugsMAV::emitSignals (void){ #ifdef MAVLINK_ENABLED_SLUGS void SlugsMAV::emitGpsSignals (void){ - if (mlGpsData.fix_type > 0){ + qDebug()<<"After Emit GPS Signal"< 0){ emit globalPositionChanged(this, mlGpsData.lon, mlGpsData.lat, mlGpsData.alt, 0.0); - // Smaller than threshold and not NaN - if (mlGpsData.v < 1000000 && mlGpsData.v == mlGpsData.v){ - emit speedChanged(this, (double)mlGpsData.v, 0.0, 0.0, 0.0); - } else { - emit textMessageReceived(uasId, uasId, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(mlGpsData.v)); - } - } + emit slugsGPSCogSog(uasId,mlGpsData.hdg, mlGpsData.v); + +// // Smaller than threshold and not NaN +// if (mlGpsData.v < 1000000 && mlGpsData.v == mlGpsData.v){ +// // emit speedChanged(this, (double)mlGpsData.v, 0.0, 0.0, 0.0); + +// } +// else { +// emit textMessageReceived(uasId, uasId, 255, QString("GCS ERROR: RECEIVED INVALID SPEED OF %1 m/s").arg(mlGpsData.v)); +// } + //} + } void SlugsMAV::emitPidSignal() diff --git a/src/uas/SlugsMAV.h b/src/uas/SlugsMAV.h index 295c8206530267bda6c4574215251824b628bf10..c30996d32369dbb66290b71af97408fac7cd748b 100644 --- a/src/uas/SlugsMAV.h +++ b/src/uas/SlugsMAV.h @@ -47,6 +47,7 @@ public slots: signals: void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData); + void slugsGPSCogSog(int uasId, double cog, double sog); #ifdef MAVLINK_ENABLED_SLUGS @@ -67,6 +68,8 @@ signals: void slugsBootMsg(int uasId, mavlink_boot_t& boot); void slugsAttitude(int uasId, mavlink_attitude_t& attitude); + + #endif protected: diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index b1c48e5c5c740203283d5193b84d2d83bc479c7d..0ad31fddbdd9b6d4a4ba141065b14b613c4d2a93 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -330,6 +330,10 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit valueChanged(uasId, "Vz", pos.vz, time); emit localPositionChanged(this, pos.x, pos.y, pos.z, time); emit speedChanged(this, pos.vx, pos.vy, pos.vz, time); + +// qDebug()<<"Local Position = "<m_Axr->setText(QString::number(rawData.xacc)); ui->m_Ayr->setText(QString::number(rawData.yacc)); ui->m_Azr->setText(QString::number(rawData.zacc)); + + ui->m_Mxr->setText(QString::number(rawData.xmag)); + ui->m_Myr->setText(QString::number(rawData.ymag)); + ui->m_Mzr->setText(QString::number(rawData.zmag)); + + ui->m_Gxr->setText(QString::number(rawData.xgyro)); + ui->m_Gyr->setText(QString::number(rawData.ygyro)); + ui->m_Gzr->setText(QString::number(rawData.zgyro)); + } void SlugsDataSensorView::setActiveUAS(UASInterface* uas){ @@ -85,9 +98,13 @@ void SlugsDataSensorView::slugsGlobalPositionChanged(UASInterface *uas, Q_UNUSED(uas); Q_UNUSED(time); + + ui->m_GpsLatitude->setText(QString::number(lat)); ui->m_GpsLongitude->setText(QString::number(lon)); ui->m_GpsHeight->setText(QString::number(alt)); + + qDebug()<<"GPS Position = "<ed_y->setPlainText(QString::number(y)); ui->ed_z->setPlainText(QString::number(z)); + //qDebug()<<"Local Position = "<ed_vy->setPlainText(QString::number(vy)); ui->ed_vz->setPlainText(QString::number(vz)); + //qDebug()<<"Speed Local Position = "<m_Pitch->setPlainText(QString::number(slugpitch)); ui->m_Yaw->setPlainText(QString::number(slugyaw)); + qDebug()<<"Attitude change = "<m_GpsDate->setText(QString::number(gpsDateTime.month) + "/" + - QString::number(gpsDateTime.day) + "/" + + + QString month, day; + + month = QString::number(gpsDateTime.month); + day = QString::number(gpsDateTime.day); + + if(gpsDateTime.month < 10) month = "0" + QString::number(gpsDateTime.month); + if(gpsDateTime.day < 10) day = "0" + QString::number(gpsDateTime.day); + + + ui->m_GpsDate->setText(day + "/" + + month + "/" + QString::number(gpsDateTime.year)); - ui->m_GpsTime->setText(QString::number(gpsDateTime.hour) + ":" + - QString::number(gpsDateTime.min) + ":" + - QString::number(gpsDateTime.sec)); + QString hour, min, sec; + + hour = QString::number(gpsDateTime.hour); + min = QString::number(gpsDateTime.min); + sec = QString::number(gpsDateTime.sec); + + if(gpsDateTime.hour < 10) hour = "0" + QString::number(gpsDateTime.hour); + if(gpsDateTime.min < 10) min = "0" + QString::number(gpsDateTime.min); + if(gpsDateTime.sec < 10) sec = "0" + QString::number(gpsDateTime.sec); + + ui->m_GpsTime->setText(hour + ":" + + min + ":" + + sec); ui->m_GpsSat->setText(QString::number(gpsDateTime.visSat)); + + +} + +/** + * @brief Updates the air data widget - 171 +*/ +void SlugsDataSensorView::slugsAirDataChanged(int systemId, const mavlink_air_data_t &airData) +{ + Q_UNUSED(systemId); + ui->ed_dynamic->setText(QString::number(airData.dynamicPressure)); + ui->ed_static->setText(QString::number(airData.staticPressure)); + ui->ed_temp->setText(QString::number(airData.temperature)); + +// qDebug()<<"Air Data = "<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 index ed0b9f07c7dd2195ddca02c739a7b1e795635fc7..b1adcca6a18b4dd6519858f9e82d0343185946a5 100644 --- a/src/ui/SlugsDataSensorView.h +++ b/src/ui/SlugsDataSensorView.h @@ -70,6 +70,9 @@ public slots: void setActiveUAS(UASInterface* uas); + /** + * @brief Updates the Raw Data widget + */ void slugRawDataChanged (int uasId, const mavlink_raw_imu_t& rawData); #ifdef MAVLINK_ENABLED_SLUGS @@ -114,58 +117,79 @@ public slots: double lon, double alt, quint64 time); + /** - * @brief Updates the sensor bias widget + * @brief set COG and SOG values + * + * COG and SOG GPS display on the Widgets + */ + void slugsGPSCogSog(int systemId, + double cog, + double sog); + + + + /** + * @brief Updates the CPU load widget - 170 + */ + void slugsCpuLoadChanged(int systemId, + const mavlink_cpu_load_t& cpuLoad); + + /** + * @brief Updates the air data widget - 171 + */ + void slugsAirDataChanged(int systemId, + const mavlink_air_data_t& airData); + + /** + * @brief Updates the sensor bias widget - 172 */ void slugsSensorBiasChanged(int systemId, const mavlink_sensor_bias_t& sensorBias); /** - * @brief Updates the diagnostic widget + * @brief Updates the diagnostic widget - 173 */ void slugsDiagnosticMessageChanged(int systemId, const mavlink_diagnostic_t& diagnostic); - /** - * @brief Updates the CPU load widget - */ - void slugsCpuLoadChanged(int systemId, - const mavlink_cpu_load_t& cpuLoad); - /** - * @brief Updates the Navigation widget + * @brief Updates the Navigation widget - 176 */ void slugsNavegationChanged(int systemId, const mavlink_slugs_navigation_t& slugsNavigation); /** - * @brief Updates the Data Log widget + * @brief Updates the Data Log widget - 177 */ void slugsDataLogChanged(int systemId, const mavlink_data_log_t& dataLog); /** - * @brief Updates the PWM Commands widget + * @brief Updates the PWM Commands widget - 175 */ void slugsPWMChanged(int systemId, const mavlink_pwm_commands_t& pwmCommands); /** - * @brief Updates the filtered sensor measurements widget + * @brief Updates the filtered sensor measurements widget - 178 */ void slugsFilteredDataChanged(int systemId, const mavlink_filtered_data_t& filteredData); /** - * @brief Updates the gps Date Time widget + * @brief Updates the gps Date Time widget - 179 */ void slugsGPSDateTimeChanged(int systemId, const mavlink_gps_date_time_t& gpsDateTime); + + + #endif // MAVLINK_ENABLED_SLUGS protected: diff --git a/src/ui/SlugsDataSensorView.ui b/src/ui/SlugsDataSensorView.ui index 4a6e2de6bc0a1e9004a25ffdd440a16eb4c1a06a..5474afb0abff4307da40cddbe7905e408ca65eb2 100644 --- a/src/ui/SlugsDataSensorView.ui +++ b/src/ui/SlugsDataSensorView.ui @@ -7,7 +7,7 @@ 0 0 399 - 667 + 604 @@ -24,18 +24,18 @@ - 16777215 - 16777215 + 399 + 604 Form - - + + - 0 + 1 @@ -989,7 +989,7 @@ 20 - 13 + 5 @@ -1791,8 +1791,8 @@ Tab 2 - - + + @@ -4483,11 +4483,6 @@ - - - Tab 4 - -