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
a1801317
Commit
a1801317
authored
Sep 22, 2012
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in named value decoding, added additional functionality to HIL config widget
parent
62a8f919
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
170 additions
and
12 deletions
+170
-12
qgroundcontrol.pro
qgroundcontrol.pro
+1
-1
QGCXPlaneLink.cc
src/comm/QGCXPlaneLink.cc
+64
-0
QGCXPlaneLink.h
src/comm/QGCXPlaneLink.h
+25
-0
MAVLinkDecoder.cc
src/ui/MAVLinkDecoder.cc
+12
-3
QGCHilConfiguration.cc
src/ui/QGCHilConfiguration.cc
+11
-0
QGCHilConfiguration.ui
src/ui/QGCHilConfiguration.ui
+57
-8
No files found.
qgroundcontrol.pro
View file @
a1801317
...
@@ -50,7 +50,7 @@ OBJECTS_DIR = $${BUILDDIR}/obj
...
@@ -50,7 +50,7 @@ OBJECTS_DIR = $${BUILDDIR}/obj
MOC_DIR
=
$$
{
BUILDDIR
}
/
moc
MOC_DIR
=
$$
{
BUILDDIR
}
/
moc
UI_DIR
=
$$
{
BUILDDIR
}
/
ui
UI_DIR
=
$$
{
BUILDDIR
}
/
ui
RCC_DIR
=
$$
{
BUILDDIR
}
/
rcc
RCC_DIR
=
$$
{
BUILDDIR
}
/
rcc
MAVLINK_CONF
=
""
MAVLINK_CONF
=
"
pixhawk
"
MAVLINKPATH
=
$$
BASEDIR
/
libs
/
mavlink
/
include
/
mavlink
/
v1
.
0
MAVLINKPATH
=
$$
BASEDIR
/
libs
/
mavlink
/
include
/
mavlink
/
v1
.
0
DEFINES
+=
MAVLINK_NO_DATA
DEFINES
+=
MAVLINK_NO_DATA
...
...
src/comm/QGCXPlaneLink.cc
View file @
a1801317
...
@@ -466,6 +466,70 @@ bool QGCXPlaneLink::disconnectSimulation()
...
@@ -466,6 +466,70 @@ bool QGCXPlaneLink::disconnectSimulation()
return
!
connectState
;
return
!
connectState
;
}
}
void
QGCXPlaneLink
::
selectPlane
(
const
QString
&
plane
)
{
}
void
QGCXPlaneLink
::
setPositionAttitude
(
double
lat
,
double
lon
,
double
alt
,
double
roll
,
double
pitch
,
double
yaw
)
{
struct
VEH1_struct
{
quint32
p
;
double
lat_lon_ele
[
3
];
float
psi_the_phi
[
3
];
float
gear_flap_vect
[
3
];
}
pos
;
pos
.
p
=
0
;
pos
.
lat_lon_ele
[
0
]
=
lat
;
pos
.
lat_lon_ele
[
1
]
=
lon
;
pos
.
lat_lon_ele
[
2
]
=
alt
;
}
/**
* Sets a random position with an offset of max 1/1000 degree
* and max 100 m altitude
*/
void
QGCXPlaneLink
::
setRandomPosition
()
{
// Initialize generator
srand
(
0
);
double
offLat
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
/
500.0
+
1.0
/
500.0
;
double
offLon
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
/
500.0
+
1.0
/
500.0
;
double
offAlt
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
*
200.0
+
100.0
;
if
(
mav
->
getAltitude
()
+
offAlt
<
0
)
{
offAlt
*=
-
1.0
;
}
setPositionAttitude
(
mav
->
getLatitude
()
+
offLat
,
mav
->
getLongitude
()
+
offLon
,
mav
->
getAltitude
()
+
offAlt
,
mav
->
getRoll
(),
mav
->
getPitch
(),
mav
->
getYaw
());
}
void
QGCXPlaneLink
::
setRandomAttitude
()
{
// Initialize generator
srand
(
0
);
double
roll
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
*
2.0
-
1.0
;
double
pitch
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
*
2.0
-
1.0
;
double
yaw
=
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
*
2.0
-
1.0
;
setPositionAttitude
(
mav
->
getLatitude
(),
mav
->
getLongitude
(),
mav
->
getAltitude
(),
roll
,
pitch
,
yaw
);
}
/**
/**
* @brief Connect the connection.
* @brief Connect the connection.
*
*
...
...
src/comm/QGCXPlaneLink.h
View file @
a1801317
...
@@ -87,6 +87,31 @@ public slots:
...
@@ -87,6 +87,31 @@ public slots:
void
writeBytes
(
const
char
*
data
,
qint64
length
);
void
writeBytes
(
const
char
*
data
,
qint64
length
);
bool
connectSimulation
();
bool
connectSimulation
();
bool
disconnectSimulation
();
bool
disconnectSimulation
();
/**
* @brief Select airplane model
* @param plane the name of the airplane
*/
void
selectPlane
(
const
QString
&
plane
);
/**
* @brief Set the airplane position and attitude
* @param lat
* @param lon
* @param alt
* @param roll
* @param pitch
* @param yaw
*/
void
setPositionAttitude
(
double
lat
,
double
lon
,
double
alt
,
double
roll
,
double
pitch
,
double
yaw
);
/**
* @brief Set a random position
*/
void
setRandomPosition
();
/**
* @brief Set a random attitude
*/
void
setRandomAttitude
();
protected:
protected:
UASInterface
*
mav
;
UASInterface
*
mav
;
...
...
src/ui/MAVLinkDecoder.cc
View file @
a1801317
...
@@ -216,7 +216,10 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
...
@@ -216,7 +216,10 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
{
{
mavlink_debug_vect_t
debug
;
mavlink_debug_vect_t
debug
;
mavlink_msg_debug_vect_decode
(
msg
,
&
debug
);
mavlink_msg_debug_vect_decode
(
msg
,
&
debug
);
name
=
name
.
arg
(
QString
(
debug
.
name
),
fieldName
);
char
buf
[
11
];
strncpy
(
buf
,
debug
.
name
,
10
);
buf
[
10
]
=
'\0'
;
name
=
QString
(
buf
);
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
(
debug
.
time_usec
+
500
)
/
1000
);
// Scale to milliseconds, round up/down correctly
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
(
debug
.
time_usec
+
500
)
/
1000
);
// Scale to milliseconds, round up/down correctly
}
}
else
if
(
msgid
==
MAVLINK_MSG_ID_DEBUG
)
else
if
(
msgid
==
MAVLINK_MSG_ID_DEBUG
)
...
@@ -230,14 +233,20 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
...
@@ -230,14 +233,20 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64
{
{
mavlink_named_value_float_t
debug
;
mavlink_named_value_float_t
debug
;
mavlink_msg_named_value_float_decode
(
msg
,
&
debug
);
mavlink_msg_named_value_float_decode
(
msg
,
&
debug
);
name
=
debug
.
name
;
char
buf
[
11
];
strncpy
(
buf
,
debug
.
name
,
10
);
buf
[
10
]
=
'\0'
;
name
=
QString
(
buf
);
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
debug
.
time_boot_ms
);
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
debug
.
time_boot_ms
);
}
}
else
if
(
msgid
==
MAVLINK_MSG_ID_NAMED_VALUE_INT
)
else
if
(
msgid
==
MAVLINK_MSG_ID_NAMED_VALUE_INT
)
{
{
mavlink_named_value_int_t
debug
;
mavlink_named_value_int_t
debug
;
mavlink_msg_named_value_int_decode
(
msg
,
&
debug
);
mavlink_msg_named_value_int_decode
(
msg
,
&
debug
);
name
=
name
.
arg
(
debug
.
name
).
arg
(
fieldName
);
char
buf
[
11
];
strncpy
(
buf
,
debug
.
name
,
10
);
buf
[
10
]
=
'\0'
;
name
=
QString
(
buf
);
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
debug
.
time_boot_ms
);
time
=
getUnixTimeFromMs
(
msg
->
sysid
,
debug
.
time_boot_ms
);
}
}
// else if (msgid == MAVLINK_MSG_ID_HIGHRES_IMU)
// else if (msgid == MAVLINK_MSG_ID_HIGHRES_IMU)
...
...
src/ui/QGCHilConfiguration.cc
View file @
a1801317
#include "QGCHilConfiguration.h"
#include "QGCHilConfiguration.h"
#include "ui_QGCHilConfiguration.h"
#include "ui_QGCHilConfiguration.h"
#include "QGCXPlaneLink.h"
QGCHilConfiguration
::
QGCHilConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
)
:
QGCHilConfiguration
::
QGCHilConfiguration
(
QGCHilLink
*
link
,
QWidget
*
parent
)
:
QWidget
(
parent
),
QWidget
(
parent
),
...
@@ -12,6 +13,16 @@ QGCHilConfiguration::QGCHilConfiguration(QGCHilLink* link, QWidget *parent) :
...
@@ -12,6 +13,16 @@ QGCHilConfiguration::QGCHilConfiguration(QGCHilLink* link, QWidget *parent) :
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
connect
(
ui
->
hostComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setRemoteHost
(
QString
)));
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
ui
->
startButton
->
setText
(
tr
(
"Connect"
));
QGCXPlaneLink
*
xplane
=
dynamic_cast
<
QGCXPlaneLink
*>
(
link
);
if
(
xplane
)
{
connect
(
ui
->
randomAttitudeButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomAttitude
()));
connect
(
ui
->
randomPositionButton
,
SIGNAL
(
clicked
()),
link
,
SLOT
(
setRandomPosition
()));
connect
(
ui
->
airframeComboBox
,
SIGNAL
(
activated
(
QString
)),
link
,
SLOT
(
setAirframe
(
QString
)));
}
// connect(ui->)
}
}
void
QGCHilConfiguration
::
toggleSimulation
(
bool
connect
)
void
QGCHilConfiguration
::
toggleSimulation
(
bool
connect
)
...
...
src/ui/QGCHilConfiguration.ui
View file @
a1801317
...
@@ -7,28 +7,28 @@
...
@@ -7,28 +7,28 @@
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
305
</width>
<width>
305
</width>
<height>
17
2
</height>
<height>
20
2
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"windowTitle"
>
<property
name=
"windowTitle"
>
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,60,50,50"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"40,60,50,50"
>
<item
row=
"
4
"
column=
"0"
colspan=
"3"
>
<item
row=
"
5
"
column=
"0"
colspan=
"3"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<widget
class=
"QLabel"
name=
"statusLabel"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Status
</string>
<string>
Status
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
5
"
column=
"0"
colspan=
"2"
>
<item
row=
"
6
"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomAttitudeButton"
>
<widget
class=
"QPushButton"
name=
"randomAttitudeButton"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Random ATT
</string>
<string>
Random ATT
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
3
"
column=
"0"
colspan=
"2"
>
<item
row=
"
4
"
column=
"0"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<widget
class=
"QPushButton"
name=
"startButton"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Start
</string>
<string>
Start
</string>
...
@@ -42,21 +42,21 @@
...
@@ -42,21 +42,21 @@
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
1
"
column=
"0"
>
<item
row=
"
2
"
column=
"0"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<widget
class=
"QLabel"
name=
"hostLabel"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Host
</string>
<string>
Host
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
3
"
column=
"2"
colspan=
"2"
>
<item
row=
"
4
"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"setHomeButton"
>
<widget
class=
"QPushButton"
name=
"setHomeButton"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Set HOME
</string>
<string>
Set HOME
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"
1
"
column=
"1"
colspan=
"3"
>
<item
row=
"
2
"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"hostComboBox"
>
<widget
class=
"QComboBox"
name=
"hostComboBox"
>
<property
name=
"editable"
>
<property
name=
"editable"
>
<bool>
true
</bool>
<bool>
true
</bool>
...
@@ -77,13 +77,62 @@
...
@@ -77,13 +77,62 @@
</item>
</item>
</widget>
</widget>
</item>
</item>
<item
row=
"
5
"
column=
"2"
colspan=
"2"
>
<item
row=
"
6
"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"randomPositionButton"
>
<widget
class=
"QPushButton"
name=
"randomPositionButton"
>
<property
name=
"text"
>
<property
name=
"text"
>
<string>
Random POS
</string>
<string>
Random POS
</string>
</property>
</property>
</widget>
</widget>
</item>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Airframe
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"airframeComboBox"
>
<property
name=
"editable"
>
<bool>
true
</bool>
</property>
<item>
<property
name=
"text"
>
<string>
QRO_X
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Unlimited
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Twinjet
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Early Bird
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Reno Racer
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Slowstick
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Tiny
</string>
</property>
</item>
</widget>
</item>
</layout>
</layout>
</widget>
</widget>
<resources/>
<resources/>
...
...
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