Commit 0e6dceb0 authored by Alejandro's avatar Alejandro

Change slugs_messages to common_messages

parent 915e3f3a
This diff is collapsed.
......@@ -28,7 +28,7 @@ This file is part of the QGROUNDCONTROL project
#include "mavlink.h"
#include <QTimer>
#define SLUGS_UPDATE_RATE 100 // in ms
#define SLUGS_UPDATE_RATE 200 // in ms
class SlugsMAV : public UAS
{
Q_OBJECT
......@@ -82,41 +82,39 @@ signals:
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;
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
......
......@@ -351,11 +351,11 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
//add for development
emit remoteControlRSSIChanged(state.packet_drop/1000.0f);
//emit remoteControlRSSIChanged(state.packet_drop/1000.0f);
float en = state.packet_drop/1000.0f;
emit remoteControlChannelRawChanged(0, en);//MAVLINK_MSG_ID_RC_CHANNELS_RAW
emit remoteControlChannelScaledChanged(0, en/100.0f);//MAVLINK_MSG_ID_RC_CHANNELS_SCALED
//float en = state.packet_drop/1000.0f;
//emit remoteControlChannelRawChanged(0, en);//MAVLINK_MSG_ID_RC_CHANNELS_RAW
//emit remoteControlChannelScaledChanged(0, en/100.0f);//MAVLINK_MSG_ID_RC_CHANNELS_SCALED
//qDebug() << __FILE__ << __LINE__ << "RCV LOSS: " << state.packet_drop;
......
......@@ -115,6 +115,11 @@ void MapWidget::init()
lastZoom = settings.value("LAST_ZOOM", lastZoom).toInt();
settings.endGroup();
index = 0;
settings.beginGroup("QGC_MAPINDEX");
index = settings.value("MAP_INDEX", index).toInt();
settings.endGroup();
settings.beginGroup("QGC_HOMEPOSITION");
homeCoordinate.setY(settings.value("HOME_LATITUDE", homeCoordinate.y()).toDouble());
homeCoordinate.setX(settings.value("HOME_LONGITUDE", homeCoordinate.x()).toDouble());
......@@ -299,20 +304,15 @@ void MapWidget::init()
connect(homePosition, SIGNAL(geometryEndDrag(Geometry*, QPointF)),
this, SLOT(captureGeometryEndDrag(Geometry*, QPointF)));
this->loadSettingsMap(settings);
this->loadSettingsMap(index);
this->createHomePosition(homeCoordinate);
qDebug() << "CHECK END";
}
}
void MapWidget::loadSettingsMap(QSettings &settings)
void MapWidget::loadSettingsMap(int8_t index)
{
index = 0;
settings.beginGroup("QGC_MAPINDEX");
index = settings.value("MAP_INDEX", index).toInt();
settings.endGroup();
switch(index)
{
case 0:
......@@ -1289,7 +1289,7 @@ void MapWidget::createHomePositionClick(bool click)
static_cast<double>(homeCoordinate.x()), 0);
qDebug()<<"Set home position "<<homeCoordinate.y()<<" "<<homeCoordinate.x();
//qDebug()<<"Set home position "<<homeCoordinate.y()<<" "<<homeCoordinate.x();
}
}
}
......@@ -164,7 +164,7 @@ protected:
void createHomePosition(const QMouseEvent* event, const QPointF coordinate);
void createHomePosition(const QPointF coordinate);
void createHomePositionClick(bool click);
void loadSettingsMap(QSettings &);
void loadSettingsMap(int8_t index);
signals:
void waypointCreated(Waypoint* wp);
......
......@@ -193,7 +193,7 @@ void QGCRemoteControlView::redraw()
// Update RSSI
if(rssi>0)
{
rssiBar->setValue(rssi*100);
//rssiBar->setValue(rssi);//*100);
}
updated = false;
......
......@@ -56,6 +56,10 @@ void SlugsDataSensorView::addUAS(UASInterface* uas)
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) {
......@@ -82,6 +86,30 @@ void SlugsDataSensorView::slugRawDataChanged(int uasId, const mavlink_raw_imu_t
}
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));
}
void SlugsDataSensorView::setActiveUAS(UASInterface* uas){
activeUAS = uas;
addUAS(activeUAS);
......@@ -113,13 +141,10 @@ void SlugsDataSensorView::slugLocalPositionChanged(UASInterface* uas,
Q_UNUSED(uas);
Q_UNUSED(time);
ui->ed_x->setText(QString::number(x));
ui->ed_y->setText(QString::number(y));
ui->ed_z->setText(QString::number(z));
//qDebug()<<"Local Position = "<<x<<" - "<<y<<" - "<<z;
}
void SlugsDataSensorView::slugSpeedLocalPositionChanged(UASInterface* uas,
......@@ -220,33 +245,33 @@ void SlugsDataSensorView::slugsDataLogChanged(int systemId,
ui->m_logFl6->setText(QString::number(dataLog.fl_6));
}
void SlugsDataSensorView::slugsPWMChanged(int systemId,
const mavlink_pwm_commands_t& pwmCommands){
Q_UNUSED(systemId);
ui->m_pwmThro->setText(QString::number(pwmCommands.dt_c));
ui->m_pwmAile->setText(QString::number(pwmCommands.dla_c));
ui->m_pwmElev->setText(QString::number(pwmCommands.dle_c));
ui->m_pwmRudd->setText(QString::number(pwmCommands.dr_c));
//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.dre_c));
ui->m_pwmAileTrim->setText(QString::number(pwmCommands.dlf_c));
ui->m_pwmElevTrim->setText(QString::number(pwmCommands.drf_c));
ui->m_pwmRuddTrim->setText(QString::number(pwmCommands.aux1));
// 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_filtered_data_t& filteredData){
Q_UNUSED(systemId);
ui->m_Axf->setText(QString::number(filteredData.aX));
ui->m_Ayf->setText(QString::number(filteredData.aY));
ui->m_Azf->setText(QString::number(filteredData.aZ));
ui->m_Gxf->setText(QString::number(filteredData.gX));
ui->m_Gyf->setText(QString::number(filteredData.gY));
ui->m_Gzf->setText(QString::number(filteredData.gZ));
ui->m_Mxf->setText(QString::number(filteredData.mX));
ui->m_Myf->setText(QString::number(filteredData.mY));
ui->m_Mzf->setText(QString::number(filteredData.mZ));
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,
......@@ -294,11 +319,6 @@ void SlugsDataSensorView::slugsAirDataChanged(int systemId, const mavlink_air_da
ui->ed_dynamic->setText(QString::number(airData.dynamicPressure));
ui->ed_static->setText(QString::number(airData.staticPressure));
ui->ed_temp->setText(QString::number(airData.temperature));
// qDebug()<<"Air Data = "<<airData.dynamicPressure<<" - "
// <<airData.staticPressure<<" - "
// <<airData.temperature;
}
/**
......@@ -306,21 +326,12 @@ void SlugsDataSensorView::slugsAirDataChanged(int systemId, const mavlink_air_da
*
* COG and SOG GPS display on the Widgets
*/
void SlugsDataSensorView::slugsGPSCogSog(int systemId,
double cog,
double sog)
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
This diff is collapsed.
This diff is collapsed.
......@@ -128,7 +128,7 @@ void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2)
ui->lbPixel->setText(QString::number(localMeasures.y()));
ui->lbDirection->setText(dir);
qDebug()<<dir;
//qDebug()<<dir;
update();
}
}
......
......@@ -68,7 +68,7 @@
<item>
<widget class="QLabel" name="lbPixel">
<property name="styleSheet">
<string notr="true">font-color:rgb(0, 0, 0);</string>
<string notr="true"/>
</property>
<property name="text">
<string>----</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment