Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
2dfdafca
Commit
2dfdafca
authored
Nov 19, 2010
by
tecnosapiens
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'experimental' of
git://github.com/malife/qgroundcontrol
into experimental
parents
f8b4caf4
3ff7452d
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
2088 additions
and
1134 deletions
+2088
-1134
qgroundcontrol.pro
qgroundcontrol.pro
+0
-1
SerialLink.cc
src/comm/SerialLink.cc
+2
-1
configuration.h
src/configuration.h
+3
-1
SlugsMAV.cc
src/uas/SlugsMAV.cc
+166
-277
SlugsMAV.h
src/uas/SlugsMAV.h
+70
-98
UAS.cc
src/uas/UAS.cc
+0
-5
MainWindow.cc
src/ui/MainWindow.cc
+17
-11
SlugsDataSensorView.cc
src/ui/SlugsDataSensorView.cc
+121
-392
SlugsDataSensorView.h
src/ui/SlugsDataSensorView.h
+23
-207
SlugsDataSensorView.ui
src/ui/SlugsDataSensorView.ui
+1640
-107
SlugsPIDControl.cpp
src/ui/SlugsPIDControl.cpp
+17
-8
SlugsPIDControl.h
src/ui/SlugsPIDControl.h
+4
-2
slugshilsim.cc
src/ui/slugshilsim.cc
+19
-23
slugshilsim.h
src/ui/slugshilsim.h
+6
-1
No files found.
qgroundcontrol.pro
View file @
2dfdafca
...
@@ -139,7 +139,6 @@ FORMS += src/ui/MainWindow.ui \
...
@@ -139,7 +139,6 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
WaypointGlobalView
.
ui
\
src
/
ui
/
WaypointGlobalView
.
ui
\
src
/
ui
/
SlugsDataSensorView
.
ui
\
src
/
ui
/
SlugsDataSensorView
.
ui
\
src
/
ui
/
SlugsHilSim
.
ui
\
src
/
ui
/
SlugsHilSim
.
ui
\
src
/
ui
/
SlugsDataSensorView
.
ui
\
src
/
ui
/
SlugsPIDControl
.
ui
\
src
/
ui
/
SlugsPIDControl
.
ui
\
src
/
ui
/
SlugsVideoCamControl
.
ui
src
/
ui
/
SlugsVideoCamControl
.
ui
INCLUDEPATH
+=
src
\
INCLUDEPATH
+=
src
\
...
...
src/comm/SerialLink.cc
View file @
2dfdafca
...
@@ -89,7 +89,8 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
...
@@ -89,7 +89,8 @@ SerialLink::SerialLink(QString portname, BaudRateType baudrate, FlowType flow, P
}
}
#else
#else
// *nix (Linux, MacOS tested) serial port support
// *nix (Linux, MacOS tested) serial port support
port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
//port = new QextSerialPort(porthandle, QextSerialPort::Polling);
port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
EventDriven
);
port
->
setTimeout
(
timeout
);
// Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port
->
setTimeout
(
timeout
);
// Timeout of 0 ms, we don't want to wait for data, we just poll again next time
port
->
setBaudRate
(
baudrate
);
port
->
setBaudRate
(
baudrate
);
port
->
setFlowControl
(
flow
);
port
->
setFlowControl
(
flow
);
...
...
src/configuration.h
View file @
2dfdafca
#ifndef CONFIGURATION_H
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#define CONFIGURATION_H
#include "mavlink.h"
/** @brief Polling interval in ms */
/** @brief Polling interval in ms */
#ifdef MAVLINK_ENABLED_SLUGS
_MESSAGES_QGC
#ifdef MAVLINK_ENABLED_SLUGS
#define SERIAL_POLL_INTERVAL 7
#define SERIAL_POLL_INTERVAL 7
#else
#else
#define SERIAL_POLL_INTERVAL 2
#define SERIAL_POLL_INTERVAL 2
...
...
src/uas/SlugsMAV.cc
View file @
2dfdafca
This diff is collapsed.
Click to expand it.
src/uas/SlugsMAV.h
View file @
2dfdafca
...
@@ -26,7 +26,9 @@ This file is part of the QGROUNDCONTROL project
...
@@ -26,7 +26,9 @@ This file is part of the QGROUNDCONTROL project
#include "UAS.h"
#include "UAS.h"
#include "mavlink.h"
#include "mavlink.h"
#include <QTimer>
#define SLUGS_UPDATE_RATE 100 // in ms
class
SlugsMAV
:
public
UAS
class
SlugsMAV
:
public
UAS
{
{
Q_OBJECT
Q_OBJECT
...
@@ -38,111 +40,81 @@ public slots:
...
@@ -38,111 +40,81 @@ public slots:
/** @brief Receive a MAVLink message from this MAV */
/** @brief Receive a MAVLink message from this MAV */
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
emitSignals
(
void
);
signals:
signals:
// ESPECIAL SLUGS MESSAGE
void
slugsCPULoad
(
int
systemId
,
void
slugsRawImu
(
int
uasId
,
const
mavlink_raw_imu_t
&
rawData
);
uint8_t
sensLoad
,
uint8_t
ctrlLoad
,
#ifdef MAVLINK_ENABLED_SLUGS
uint8_t
batVolt
,
quint64
time
);
void
slugsCPULoad
(
int
systemId
,
const
mavlink_cpu_load_t
&
cpuLoad
);
void
slugsAirData
(
int
systemId
,
const
mavlink_air_data_t
&
airData
);
void
slugsAirData
(
int
systemId
,
void
slugsSensorBias
(
int
systemId
,
const
mavlink_sensor_bias_t
&
sensorBias
);
float
dinamicPressure
,
void
slugsDiagnostic
(
int
systemId
,
const
mavlink_diagnostic_t
&
diagnostic
);
float
staticPresure
,
void
slugsPilotConsolePWM
(
int
systemId
,
const
mavlink_pilot_console_t
&
pilotConsole
);
uint16_t
temperature
,
void
slugsPWM
(
int
systemId
,
const
mavlink_pwm_commands_t
&
pwmCommands
);
quint64
time
);
void
slugsNavegation
(
int
systemId
,
const
mavlink_slugs_navigation_t
&
slugsNavigation
);
void
slugsDataLog
(
int
systemId
,
const
mavlink_data_log_t
&
dataLog
);
void
slugsSensorBias
(
int
systemId
,
void
slugsFilteredData
(
int
systemId
,
const
mavlink_filtered_data_t
&
filteredData
);
double
axBias
,
void
slugsGPSDateTime
(
int
systemId
,
const
mavlink_gps_date_time_t
&
gpsDateTime
);
double
ayBias
,
void
slugsActionAck
(
int
systemId
,
const
mavlink_action_ack_t
&
actionAck
);
double
azBias
,
double
gxBias
,
void
slugsBootMsg
(
int
uasId
,
mavlink_boot_t
&
boot
);
double
gyBias
,
void
slugsAttitude
(
int
uasId
,
mavlink_attitude_t
&
attitude
);
double
gzBias
,
quint64
time
);
#endif
void
slugsDiagnostic
(
int
systemId
,
protected:
double
diagFl1
,
double
diagFl2
,
typedef
struct
_mavlink_pid_values_t
{
double
diagFl3
,
float
P
[
11
];
int16_t
diagSh1
,
float
I
[
11
];
int16_t
diagSh2
,
float
D
[
11
];
int16_t
diagSh3
,
}
mavlink_pid_values_t
;
quint64
time
);
unsigned
char
updateRoundRobin
;
void
slugsPilotConsolePWM
(
int
systemId
,
QTimer
*
widgetTimer
;
uint16_t
dt
,
uint16_t
dla
,
uint16_t
dra
,
mavlink_raw_imu_t
mlRawImuData
;
uint16_t
dr
,
uint16_t
de
,
#ifdef MAVLINK_ENABLED_SLUGS
quint64
time
);
mavlink_gps_raw_t
mlGpsData
;
mavlink_attitude_t
mlAttitude
;
void
slugsPWM
(
int
systemId
,
mavlink_cpu_load_t
mlCpuLoadData
;
uint16_t
dt_c
,
mavlink_air_data_t
mlAirData
;
uint16_t
dla_c
,
mavlink_sensor_bias_t
mlSensorBiasData
;
uint16_t
dra_c
,
mavlink_diagnostic_t
mlDiagnosticData
;
uint16_t
dr_c
,
mavlink_pilot_console_t
mlPilotConsoleData
;
uint16_t
dle_c
,
mavlink_filtered_data_t
mlFilteredData
;
uint16_t
dre_c
,
mavlink_boot_t
mlBoot
;
uint16_t
dlf_c
,
mavlink_gps_date_time_t
mlGpsDateTime
;
uint16_t
drf_c
,
mavlink_mid_lvl_cmds_t
mlMidLevelCommands
;
uint16_t
da1_c
,
mavlink_set_mode_t
mlApMode
;
uint16_t
da2_c
,
mavlink_pwm_commands_t
mlPwmCommands
;
quint64
time
);
mavlink_pid_values_t
mlPidValues
;
mavlink_pid_t
mlSinglePid
;
void
slugsNavegation
(
int
systemId
,
double
u_m
,
mavlink_slugs_navigation_t
mlNavigation
;
double
phi_c
,
mavlink_data_log_t
mlDataLog
;
double
theta_c
,
mavlink_ctrl_srfc_pt_t
mlPassthrough
;
double
psiDot_c
,
mavlink_action_ack_t
mlActionAck
;
double
ay_body
,
double
totalDist
,
mavlink_slugs_action_t
mlAction
;
double
dist2Go
,
uint8_t
fromWP
,
uint8_t
toWP
,
quint64
time
);
void
slugsDataLog
(
int
systemId
,
double
logfl_1
,
double
logfl_2
,
double
logfl_3
,
double
logfl_4
,
double
logfl_5
,
double
logfl_6
,
quint64
time
);
void
slugsFilteredData
(
int
systemId
,
double
filaX
,
double
filaY
,
double
filaZ
,
double
filgX
,
double
filgY
,
double
filgZ
,
double
filmX
,
double
filmY
,
double
filmZ
,
quint64
time
);
void
slugsGPSDateTime
(
int
systemId
,
uint8_t
gpsyear
,
uint8_t
gpsmonth
,
uint8_t
gpsday
,
uint8_t
gpshour
,
uint8_t
gpsmin
,
uint8_t
gpssec
,
uint8_t
gpsvisSat
,
quint64
time
);
// Standart messages MAVLINK used by SLUGS
// Standart messages MAVLINK used by SLUGS
void
slugsActionAck
(
int
systemId
,
private:
uint8_t
action
,
uint8_t
result
);
void
emitGpsSignals
(
void
);
int
uasId
;
#endif // if SLUGS
};
};
...
...
src/uas/UAS.cc
View file @
2dfdafca
...
@@ -611,11 +611,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -611,11 +611,6 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
throttle
<<
radioMsg
.
throttle
[
i
];
throttle
<<
radioMsg
.
throttle
[
i
];
QPointer
<
RadioCalibrationData
>
radioData
=
new
RadioCalibrationData
(
aileron
,
QPointer
<
RadioCalibrationData
>
radioData
=
new
RadioCalibrationData
(
aileron
,
elevator
,
rudder
,
gyro
,
pitch
,
throttle
);
emit
radioCalibrationReceived
(
radioData
);
emit
radioCalibrationReceived
(
radioData
);
delete
radioData
;
delete
radioData
;
}
}
...
...
src/ui/MainWindow.cc
View file @
2dfdafca
...
@@ -227,8 +227,14 @@ void MainWindow::connectWidgets()
...
@@ -227,8 +227,14 @@ void MainWindow::connectWidgets()
connect
(
waypointsDockWidget
->
widget
(),
SIGNAL
(
changePositionWPGlobalBySpinBox
(
int
,
float
,
float
)),
mapWidget
,
SLOT
(
changeGlobalWaypointPositionBySpinBox
(
int
,
float
,
float
)));
connect
(
waypointsDockWidget
->
widget
(),
SIGNAL
(
changePositionWPGlobalBySpinBox
(
int
,
float
,
float
)),
mapWidget
,
SLOT
(
changeGlobalWaypointPositionBySpinBox
(
int
,
float
,
float
)));
}
}
if
(
slugsHilSimWidget
->
widget
()){
if
(
slugsHilSimWidget
&&
slugsHilSimWidget
->
widget
()){
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
dynamic_cast
<
SlugsHilSim
*>
(
slugsHilSimWidget
->
widget
()),
SLOT
(
activeUasSet
(
UASInterface
*
))
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
slugsHilSimWidget
->
widget
(),
SLOT
(
activeUasSet
(
UASInterface
*
)));
}
if
(
slugsDataWidget
&&
slugsDataWidget
->
widget
()){
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
slugsDataWidget
->
widget
(),
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
}
...
@@ -558,16 +564,16 @@ void MainWindow::UASCreated(UASInterface* uas)
...
@@ -558,16 +564,16 @@ void MainWindow::UASCreated(UASInterface* uas)
PxQuadMAV
*
mav
=
dynamic_cast
<
PxQuadMAV
*>
(
uas
);
PxQuadMAV
*
mav
=
dynamic_cast
<
PxQuadMAV
*>
(
uas
);
if
(
mav
)
loadPixhawkView
();
if
(
mav
)
loadPixhawkView
();
SlugsMAV
*
mav2
=
dynamic_cast
<
SlugsMAV
*>
(
uas
);
if
(
slugsDataWidget
)
{
if
(
mav2
)
SlugsDataSensorView
*
dataWidget
=
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
());
{
if
(
dataWidget
)
{
dynamic_cast
<
SlugsDataSensorView
*>
(
slugsDataWidget
->
widget
())
->
addUAS
(
uas
);
SlugsMAV
*
mav2
=
dynamic_cast
<
SlugsMAV
*>
(
uas
);
loadSlugsView
();
if
(
mav2
)
{
dataWidget
->
addUAS
(
uas
);
loadSlugsView
();
}
}
}
}
}
}
}
}
...
...
src/ui/SlugsDataSensorView.cc
View file @
2dfdafca
This diff is collapsed.
Click to expand it.
src/ui/SlugsDataSensorView.h
View file @
2dfdafca
...
@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include "UASInterface.h"
#include "UASInterface.h"
#include "SlugsMAV.h"
#include "SlugsMAV.h"
#include "mavlink.h"
namespace
Ui
{
namespace
Ui
{
class
SlugsDataSensorView
;
class
SlugsDataSensorView
;
...
@@ -67,17 +68,10 @@ public slots:
...
@@ -67,17 +68,10 @@ public slots:
*/
*/
void
setActiveUAS
(
UASInterface
*
uas
);
void
setActiveUAS
(
UASInterface
*
uas
);
/**
* @brief Adds the UAS for data display
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
void
refresh
();
void
slugRawDataChanged
(
int
uasId
,
const
mavlink_raw_imu_t
&
rawData
);
#ifdef MAVLINK_ENABLED_SLUGS
/**
/**
* @brief Adds the UAS for data display
* @brief Adds the UAS for data display
*
*
...
@@ -120,240 +114,62 @@ public slots:
...
@@ -120,240 +114,62 @@ public slots:
double
alt
,
double
alt
,
quint64
time
);
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the sensor bias widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsSensorBiasChanged
(
int
systemId
,
void
slugsSensorBiasChanged
(
int
systemId
,
double
axb
,
const
mavlink_sensor_bias_t
&
sensorBias
);
double
ayb
,
double
azb
,
double
gxb
,
double
gyb
,
double
gzb
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the diagnostic widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsDiagnosticMessageChanged
(
int
systemId
,
void
slugsDiagnosticMessageChanged
(
int
systemId
,
double
diagfl1
,
const
mavlink_diagnostic_t
&
diagnostic
);
double
diagfl2
,
double
diagfl3
,
int16_t
diagsh1
,
int16_t
diagsh2
,
int16_t
diagsh3
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the CPU load widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsCpuLoadChanged
(
int
systemId
,
void
slugsCpuLoadChanged
(
int
systemId
,
uint8_t
sensload
,
const
mavlink_cpu_load_t
&
cpuLoad
);
uint8_t
ctrlload
,
uint8_t
batvolt
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the Navigation widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsNavegationChanged
(
int
systemId
,
void
slugsNavegationChanged
(
int
systemId
,
double
navu_m
,
const
mavlink_slugs_navigation_t
&
slugsNavigation
);
double
navphi_c
,
double
navtheta_c
,
double
navpsiDot_c
,
double
navay_body
,
double
navtotalDist
,
double
navdist2Go
,
uint8_t
navfromWP
,
uint8_t
navtoWP
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the Data Log widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsDataLogChanged
(
int
systemId
,
void
slugsDataLogChanged
(
int
systemId
,
double
logfl_1
,
const
mavlink_data_log_t
&
dataLog
);
double
logfl_2
,
double
logfl_3
,
double
logfl_4
,
double
logfl_5
,
double
logfl_6
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the PWM Commands widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsPWMChanged
(
int
systemId
,
void
slugsPWMChanged
(
int
systemId
,
uint16_t
vdt_c
,
const
mavlink_pwm_commands_t
&
pwmCommands
);
uint16_t
vdla_c
,
uint16_t
vdra_c
,
uint16_t
vdr_c
,
uint16_t
vdle_c
,
uint16_t
vdre_c
,
uint16_t
vdlf_c
,
uint16_t
vdrf_c
,
uint16_t
vda1_c
,
uint16_t
vda2_c
,
quint64
time
);
/**
/**
* @brief Adds the UAS for data display
* @brief Updates the filtered sensor measurements widget
*
* Adds the UAS and makes all the correct connections for data display on the Widgets
*/
*/
void
slugsFilteredDataChanged
(
int
systemId
,
void
slugsFilteredDataChanged
(
int
systemId
,
double
filaX
,
const
mavlink_filtered_data_t
&
filteredData
);
double
filaY
,
double
filaZ
,
double
filgX
,
double
filgY
,
double
filgZ
,
double
filmX
,
double
filmY
,
double
filmZ
,
quint64
time
);
/**
* @brief Updates the gps Date Time widget
*/
void
slugsGPSDateTimeChanged
(
int
systemId
,
void
slugsGPSDateTimeChanged
(
int
systemId
,
uint8_t
gpsyear
,
const
mavlink_gps_date_time_t
&
gpsDateTime
);
uint8_t
gpsmonth
,
uint8_t
gpsday
,
uint8_t
gpshour
,
uint8_t
gpsmin
,
uint8_t
gpssec
,
uint8_t
gpsvisSat
,
quint64
time
);
#endif // MAVLINK_ENABLED_SLUGS
protected:
protected:
QTimer
*
updateTimer
;
UASInterface
*
activeUAS
;
UASInterface
*
activeUAS
;
//Global Position
double
Latitude
;
double
Longitude
;
double
Height
;
quint64
timeGlobalPosition
;
// Position and Attitude
//Position
double
Xpos
;
double
Ypos
;
double
Zpos
;
quint64
TimeActualPosition
;
//Speed
double
VXpos
;
double
VYpos
;
double
VZpos
;
quint64
TimeActualSpeed
;
//Attitude
double
roll
;
double
pitch
;
double
yaw
;
quint64
TimeActualAttitude
;
//Sensor Biases
//Acelerometer
double
Axb
;
double
Ayb
;
double
Azb
;
//Gyro
double
Gxb
;
double
Gyb
;
double
Gzb
;
quint64
TimeActualBias
;
//Diagnostic
double
diagFl1
;
double
diagFl2
;
double
diagFl3
;
int16_t
diagSh1
;
int16_t
diagSh2
;
int16_t
diagSh3
;
quint64
timeDiagnostic
;
//CPU Load
uint8_t
sensLoad
;
uint8_t
ctrlLoad
;
uint8_t
batVolt
;
quint64
timeCpuLoad
;
//navigation data
double
u_m
;
double
phi_c
;
double
theta_c
;
double
psiDot_c
;
double
ay_body
;
double
totalDist
;
double
dist2Go
;
uint8_t
fromWP
;
uint8_t
toWP
;
quint64
timeNavigation
;
// Data Log
double
Logfl_1
;
double
Logfl_2
;
double
Logfl_3
;
double
Logfl_4
;
double
Logfl_5
;
double
Logfl_6
;
quint64
timeDataLog
;
//pwm commands
uint16_t
dt_c
;
///< AutoPilot's throttle command
uint16_t
dla_c
;
///< AutoPilot's left aileron command
uint16_t
dra_c
;
///< AutoPilot's right aileron command
uint16_t
dr_c
;
///< AutoPilot's rudder command
uint16_t
dle_c
;
///< AutoPilot's left elevator command
uint16_t
dre_c
;
///< AutoPilot's right elevator command
uint16_t
dlf_c
;
///< AutoPilot's left flap command
uint16_t
drf_c
;
///< AutoPilot's right flap command
uint16_t
aux1
;
///< AutoPilot's aux1 command
uint16_t
aux2
;
///< AutoPilot's aux2 command
quint64
timePWMCommand
;
//filtered data
double
aX
;
///< Accelerometer X value (m/s^2)
double
aY
;
///< Accelerometer Y value (m/s^2)
double
aZ
;
///< Accelerometer Z value (m/s^2)
double
gX
;
///< Gyro X value (rad/s)
double
gY
;
///< Gyro Y value (rad/s)
double
gZ
;
///< Gyro Z value (rad/s)
double
mX
;
///< Magnetometer X (normalized to 1)
double
mY
;
///< Magnetometer Y (normalized to 1)
double
mZ
;
///< Magnetometer Z (normalized to 1)
quint64
timeFiltered
;
//gps date and time
uint8_t
year
;
///< Year reported by Gps
uint8_t
month
;
///< Month reported by Gps
uint8_t
day
;
///< Day reported by Gps
uint8_t
hour
;
///< Hour reported by Gps
uint8_t
min
;
///< Min reported by Gps
uint8_t
sec
;
///< Sec reported by Gps
uint8_t
visSat
;
///< Visible sattelites reported by Gps
quint64
timeGPSDateTime
;
private:
private:
Ui
::
SlugsDataSensorView
*
ui
;
Ui
::
SlugsDataSensorView
*
ui
;
void
loadParameters
();
};
};
...
...
src/ui/SlugsDataSensorView.ui
View file @
2dfdafca
This diff is collapsed.
Click to expand it.
src/ui/SlugsPIDControl.cpp
View file @
2dfdafca
...
@@ -44,11 +44,13 @@ void SlugsPIDControl::activeUasSet(UASInterface* uas)
...
@@ -44,11 +44,13 @@ void SlugsPIDControl::activeUasSet(UASInterface* uas)
{
{
SlugsMAV
*
slugsMav
=
dynamic_cast
<
SlugsMAV
*>
(
uas
);
SlugsMAV
*
slugsMav
=
dynamic_cast
<
SlugsMAV
*>
(
uas
);
#ifdef MAVLINK_ENABLED_SLUGS
if
(
slugsMav
!=
NULL
)
if
(
slugsMav
!=
NULL
)
{
{
connect
(
slugsMav
,
SIGNAL
(
slugsActionAck
(
int
,
uint8_t
,
uint8_t
)),
this
,
SLOT
(
recibeMensaje
(
int
,
uint8_t
,
uint8
_t
)));
connect
(
slugsMav
,
SIGNAL
(
slugsActionAck
(
int
,
const
mavlink_action_ack_t
&
)),
this
,
SLOT
(
recibeMensaje
(
int
,
mavlink_action_ack
_t
)));
}
}
#endif // MAVLINK_ENABLED_SLUG
// Set this UAS as active if it is the first one
// Set this UAS as active if it is the first one
if
(
activeUAS
==
0
)
if
(
activeUAS
==
0
)
{
{
...
@@ -154,6 +156,12 @@ void SlugsPIDControl::changeColor_RED_AirSpeed_groupBox(QString text)
...
@@ -154,6 +156,12 @@ void SlugsPIDControl::changeColor_RED_AirSpeed_groupBox(QString text)
void
SlugsPIDControl
::
changeColor_GREEN_AirSpeed_groupBox
()
void
SlugsPIDControl
::
changeColor_GREEN_AirSpeed_groupBox
()
{
{
SlugsMAV
*
slugsMav
=
dynamic_cast
<
SlugsMAV
*>
(
activeUAS
);
if
(
slugsMav
!=
NULL
)
{
//create the packet
//create the packet
pidMessage
.
target
=
activeUAS
->
getUASID
();
pidMessage
.
target
=
activeUAS
->
getUASID
();
pidMessage
.
idx
=
0
;
pidMessage
.
idx
=
0
;
...
@@ -161,16 +169,13 @@ void SlugsPIDControl::changeColor_GREEN_AirSpeed_groupBox()
...
@@ -161,16 +169,13 @@ void SlugsPIDControl::changeColor_GREEN_AirSpeed_groupBox()
pidMessage
.
iVal
=
ui
->
dT_I_set
->
text
().
toFloat
();
pidMessage
.
iVal
=
ui
->
dT_I_set
->
text
().
toFloat
();
pidMessage
.
dVal
=
ui
->
dT_D_set
->
text
().
toFloat
();
pidMessage
.
dVal
=
ui
->
dT_D_set
->
text
().
toFloat
();
UAS
*
uas
=
dynamic_cast
<
UAS
*>
(
UASManager
::
instance
()
->
getActiveUAS
());
mavlink_message_t
msg
;
mavlink_message_t
msg
;
mavlink_msg_pid_encode
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
&
pidMessage
);
mavlink_msg_pid_encode
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
&
pidMessage
);
uas
->
sendMessage
(
msg
);
slugsMav
->
sendMessage
(
msg
);
ui
->
AirSpeedHold_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
ui
->
AirSpeedHold_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
}
}
...
@@ -335,7 +340,11 @@ void SlugsPIDControl::connect_Pitch2dT_LineEdit()
...
@@ -335,7 +340,11 @@ void SlugsPIDControl::connect_Pitch2dT_LineEdit()
connect
(
ui
->
P2dT_FF_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_Pitch2dT_groupBox
(
QString
)));
connect
(
ui
->
P2dT_FF_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_Pitch2dT_groupBox
(
QString
)));
}
}
void
SlugsPIDControl
::
recibeMensaje
(
int
systemId
,
uint8_t
action
,
uint8_t
result
)
#ifdef MAVLINK_ENABLED_SLUGS
void
SlugsPIDControl
::
recibeMensaje
(
int
systemId
,
const
mavlink_action_ack_t
&
action
)
{
{
ui
->
recepcion_label
->
setText
(
"Mensaje Recibido: "
+
QString
::
number
(
action
));
ui
->
recepcion_label
->
setText
(
QString
::
number
(
action
.
action
));
}
}
#endif // MAVLINK_ENABLED_SLUGS
src/ui/SlugsPIDControl.h
View file @
2dfdafca
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "UASInterface.h"
#include "UASInterface.h"
#include "QGCMAVLink.h"
#include "QGCMAVLink.h"
#include "SlugsMAV.h"
#include "SlugsMAV.h"
#include "mavlink.h"
namespace
Ui
{
namespace
Ui
{
class
SlugsPIDControl
;
class
SlugsPIDControl
;
...
@@ -184,9 +184,11 @@ public slots:
...
@@ -184,9 +184,11 @@ public slots:
//Create, send and get Messages PID
//Create, send and get Messages PID
// void createMessagePID();
// void createMessagePID();
#ifdef MAVLINK_ENABLED_SLUGS
void
recibeMensaje
(
int
systemId
,
uint8_t
action
,
uint8_t
result
);
void
recibeMensaje
(
int
systemId
,
const
mavlink_action_ack_t
&
action
);
#endif // MAVLINK_ENABLED_SLUG
private:
private:
Ui
::
SlugsPIDControl
*
ui
;
Ui
::
SlugsPIDControl
*
ui
;
...
...
src/ui/slugshilsim.cc
View file @
2dfdafca
...
@@ -41,7 +41,10 @@ SlugsHilSim::SlugsHilSim(QWidget *parent) :
...
@@ -41,7 +41,10 @@ SlugsHilSim::SlugsHilSim(QWidget *parent) :
rxSocket
=
new
QUdpSocket
(
this
);
rxSocket
=
new
QUdpSocket
(
this
);
txSocket
=
new
QUdpSocket
(
this
);
txSocket
=
new
QUdpSocket
(
this
);
hilLink
=
NULL
;
connect
(
LinkManager
::
instance
(),
SIGNAL
(
newLink
(
LinkInterface
*
)),
this
,
SLOT
(
addToCombo
(
LinkInterface
*
)));
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
(
ui
->
bt_startHil
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
putInHilMode
()));
connect
(
rxSocket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readDatagram
()));
connect
(
rxSocket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readDatagram
()));
...
@@ -54,23 +57,15 @@ SlugsHilSim::~SlugsHilSim()
...
@@ -54,23 +57,15 @@ SlugsHilSim::~SlugsHilSim()
delete
ui
;
delete
ui
;
}
}
void
SlugsHilSim
::
linkAdded
(
void
){
// ui->cb_mavlinkLinks->clear();
// QList<LinkInterface *> linkList;
// linkList.append(LinkManager::instance()->getLinks()) ;
// for (int i = 0; i< linkList.size(); i++){
// ui->cb_mavlinkLinks->addItem((linkList.takeFirst())->getName());
// }
}
void
SlugsHilSim
::
addToCombo
(
LinkInterface
*
theLink
){
void
SlugsHilSim
::
addToCombo
(
LinkInterface
*
theLink
){
ui
->
cb_mavlinkLinks
->
addItem
(
theLink
->
getName
());
ui
->
cb_mavlinkLinks
->
addItem
(
theLink
->
getName
());
linksAvailable
.
insert
(
ui
->
cb_mavlinkLinks
->
count
(),
theLink
);
linksAvailable
.
insert
(
ui
->
cb_mavlinkLinks
->
count
(),
theLink
);
if
(
hilLink
==
NULL
){
hilLink
=
theLink
;
}
}
}
void
SlugsHilSim
::
putInHilMode
(
void
){
void
SlugsHilSim
::
putInHilMode
(
void
){
...
@@ -86,8 +81,7 @@ void SlugsHilSim::putInHilMode(void){
...
@@ -86,8 +81,7 @@ void SlugsHilSim::putInHilMode(void){
msgBox
.
setStandardButtons
(
QMessageBox
::
Yes
|
QMessageBox
::
No
);
msgBox
.
setStandardButtons
(
QMessageBox
::
Yes
|
QMessageBox
::
No
);
msgBox
.
setDefaultButton
(
QMessageBox
::
No
);
msgBox
.
setDefaultButton
(
QMessageBox
::
No
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Yes
)
if
(
msgBox
.
exec
()
==
QMessageBox
::
Yes
)
{
{
rxSocket
->
disconnectFromHost
();
rxSocket
->
disconnectFromHost
();
rxSocket
->
bind
(
QHostAddress
::
Any
,
ui
->
ed_rxPort
->
text
().
toInt
());
rxSocket
->
bind
(
QHostAddress
::
Any
,
ui
->
ed_rxPort
->
text
().
toInt
());
//txSocket->bind(QHostAddress::Broadcast, ui->ed_txPort->text().toInt());
//txSocket->bind(QHostAddress::Broadcast, ui->ed_txPort->text().toInt());
...
@@ -99,7 +93,6 @@ void SlugsHilSim::putInHilMode(void){
...
@@ -99,7 +93,6 @@ void SlugsHilSim::putInHilMode(void){
ui
->
bt_startHil
->
setText
(
buttonCaption
);
ui
->
bt_startHil
->
setText
(
buttonCaption
);
}
else
{
}
else
{
ui
->
bt_startHil
->
setChecked
(
false
);
ui
->
bt_startHil
->
setChecked
(
false
);
}
}
...
@@ -170,9 +163,13 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
...
@@ -170,9 +163,13 @@ void SlugsHilSim::processHilDatagram(const QByteArray* datagram){
tmpGpsRaw
.
fix_type
=
datagram
->
at
(
i
++
);
tmpGpsRaw
.
fix_type
=
datagram
->
at
(
i
++
);
tmpGpsTime
.
visSat
=
datagram
->
at
(
i
++
);
tmpGpsTime
.
visSat
=
datagram
->
at
(
i
++
);
//mavlink_msg_gps_date_time_pack();
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
));
//activeUas->sendMessage();
mavlink_msg_gps_raw_encode
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
&
tmpGpsRaw
);
activeUas
->
sendMessage
(
hilLink
,
msg
);
// TODO: this is legacy of old HIL datagram. Need to remove from Simulink model
// TODO: this is legacy of old HIL datagram. Need to remove from Simulink model
i
++
;
i
++
;
...
@@ -190,11 +187,6 @@ float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned ch
...
@@ -190,11 +187,6 @@ float SlugsHilSim::getFloatFromDatagram (const QByteArray* datagram, unsigned ch
tmpF2C
.
chData
[
2
]
=
datagram
->
at
((
*
i
)
++
);
tmpF2C
.
chData
[
2
]
=
datagram
->
at
((
*
i
)
++
);
tmpF2C
.
chData
[
3
]
=
datagram
->
at
((
*
i
)
++
);
tmpF2C
.
chData
[
3
]
=
datagram
->
at
((
*
i
)
++
);
// if (uas != NULL) {
// //activeUas = uas;
// }
return
tmpF2C
.
flData
;
return
tmpF2C
.
flData
;
}
}
...
@@ -207,3 +199,7 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne
...
@@ -207,3 +199,7 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne
return
tmpU2C
.
uiData
;
return
tmpU2C
.
uiData
;
}
}
void
SlugsHilSim
::
linkSelected
(
int
cbIndex
){
//hilLink = linksAvailable
}
src/ui/slugshilsim.h
View file @
2dfdafca
...
@@ -60,7 +60,6 @@ protected:
...
@@ -60,7 +60,6 @@ protected:
UAS
*
activeUas
;
UAS
*
activeUas
;
public
slots
:
public
slots
:
void
linkAdded
(
void
);
/**
/**
* @brief Adds a link to the combo box listing so the user can select a link
* @brief Adds a link to the combo box listing so the user can select a link
...
@@ -98,6 +97,12 @@ public slots:
...
@@ -98,6 +97,12 @@ public slots:
*/
*/
void
activeUasSet
(
UASInterface
*
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
:
public
slots
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment