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
b647bb9b
Commit
b647bb9b
authored
Aug 27, 2010
by
Bryan Godbolt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://github.com/pixhawk/qgroundcontrol
into dev
parents
2238f371
9597d772
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
26 deletions
+147
-26
MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationLink.cc
+129
-8
MAVLinkSimulationLink.h
src/comm/MAVLinkSimulationLink.h
+7
-7
UASInterface.h
src/uas/UASInterface.h
+1
-1
MainWindow.cc
src/ui/MainWindow.cc
+2
-2
ObjectDetectionView.cc
src/ui/ObjectDetectionView.cc
+7
-7
ObjectDetectionView.h
src/ui/ObjectDetectionView.h
+1
-1
No files found.
src/comm/MAVLinkSimulationLink.cc
View file @
b647bb9b
...
...
@@ -377,20 +377,77 @@ void MAVLinkSimulationLink::mainloop()
rate10hzCounter
=
1
;
// Move X Position
x
+=
sin
(
QGC
::
groundTimeUsecs
())
*
0.1
f
;
y
+=
sin
(
QGC
::
groundTimeUsecs
())
*
0.1
f
;
z
+=
sin
(
QGC
::
groundTimeUsecs
())
*
0.1
f
;
x
+=
sin
(
QGC
::
groundTimeUsecs
()
*
1000
)
*
0.05
f
;
y
+=
sin
(
QGC
::
groundTimeUsecs
())
*
0.05
f
;
z
+=
sin
(
QGC
::
groundTimeUsecs
())
*
0.009
f
;
x
=
(
x
>
5.0
f
)
?
5.0
f
:
x
;
y
=
(
y
>
5.0
f
)
?
5.0
f
:
y
;
z
=
(
z
>
3.0
f
)
?
3.0
f
:
z
;
x
=
(
x
<
-
5.0
f
)
?
-
5.0
f
:
x
;
y
=
(
y
<
-
5.0
f
)
?
-
5.0
f
:
y
;
z
=
(
z
<
-
3.0
f
)
?
-
3.0
f
:
z
;
x
=
(
x
>
1.0
f
)
?
1.0
f
:
x
;
y
=
(
y
>
1.0
f
)
?
1.0
f
:
y
;
z
=
(
z
>
1.0
f
)
?
1.0
f
:
z
;
// Send back new setpoint
mavlink_message_t
ret
;
mavlink_msg_local_position_setpoint_pack
(
systemId
,
componentId
,
&
ret
,
spX
,
spY
,
spZ
,
spYaw
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
// Send back new position
mavlink_msg_local_position_pack
(
systemId
,
componentId
,
&
ret
,
0
,
x
,
y
,
z
,
0
,
0
,
0
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
// GPS RAW
mavlink_msg_gps_raw_pack
(
systemId
,
componentId
,
&
ret
,
0
,
3
,
47.376417
+
x
*
0.001
f
,
8.548103
+
y
*
0.001
f
,
z
,
0
,
0
,
2.5
f
,
0.1
f
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
// GLOBAL POSITION
mavlink_msg_global_position_pack
(
systemId
,
componentId
,
&
ret
,
0
,
3
,
47.376417
+
x
*
0.001
f
,
8.548103
+
y
*
0.001
f
,
z
,
0
,
0
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
static
int
rcCounter
=
0
;
if
(
rcCounter
==
2
)
{
mavlink_rc_channels_t
chan
;
chan
.
chan1_raw
=
1000
+
((
int
)(
fabs
(
x
)
*
1000
)
%
2000
);
chan
.
chan2_raw
=
1000
+
((
int
)(
fabs
(
y
)
*
1000
)
%
2000
);
chan
.
chan3_raw
=
1000
+
((
int
)(
fabs
(
z
)
*
1000
)
%
2000
);
chan
.
chan4_raw
=
(
chan
.
chan1_raw
+
chan
.
chan2_raw
)
/
2.0
f
;
chan
.
chan5_raw
=
(
chan
.
chan3_raw
+
chan
.
chan4_raw
)
/
2.0
f
;
chan
.
chan6_raw
=
(
chan
.
chan3_raw
+
chan
.
chan2_raw
)
/
2.0
f
;
chan
.
chan7_raw
=
(
chan
.
chan4_raw
+
chan
.
chan2_raw
)
/
2.0
f
;
chan
.
chan8_raw
=
(
chan
.
chan6_raw
+
chan
.
chan2_raw
)
/
2.0
f
;
chan
.
chan1_255
=
((
chan
.
chan1_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan2_255
=
((
chan
.
chan2_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan3_255
=
((
chan
.
chan3_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan4_255
=
((
chan
.
chan4_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan5_255
=
((
chan
.
chan5_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan6_255
=
((
chan
.
chan6_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan7_255
=
((
chan
.
chan7_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
chan
.
chan8_255
=
((
chan
.
chan8_raw
-
1000
)
/
1000.0
f
)
*
255.0
f
;
messageSize
=
mavlink_msg_rc_channels_encode
(
systemId
,
componentId
,
&
msg
,
&
chan
);
// Allocate buffer with packet data
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
rcCounter
=
0
;
}
rcCounter
++
;
}
// 1 HZ TASKS
...
...
@@ -405,6 +462,62 @@ void MAVLinkSimulationLink::mainloop()
}
statusCounter
++
;
static
int
detectionCounter
=
6
;
if
(
detectionCounter
%
10
==
0
)
{
#ifdef MAVLINK_ENABLED_PIXHAWK_MESSAGES
mavlink_pattern_detected_t
detected
;
detected
.
confidence
=
5.0
f
;
if
(
detectionCounter
==
10
)
{
char
fileName
[]
=
"patterns/face5.png"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
0
;
// 0: Pattern, 1: Letter
}
else
if
(
detectionCounter
==
20
)
{
char
fileName
[]
=
"7"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
1
;
// 0: Pattern, 1: Letter
}
else
if
(
detectionCounter
==
30
)
{
char
fileName
[]
=
"patterns/einstein.bmp"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
0
;
// 0: Pattern, 1: Letter
}
else
if
(
detectionCounter
==
40
)
{
char
fileName
[]
=
"F"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
1
;
// 0: Pattern, 1: Letter
}
else
if
(
detectionCounter
==
50
)
{
char
fileName
[]
=
"patterns/face2.png"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
0
;
// 0: Pattern, 1: Letter
}
else
if
(
detectionCounter
==
60
)
{
char
fileName
[]
=
"H"
;
memcpy
(
detected
.
file
,
fileName
,
sizeof
(
fileName
));
detected
.
type
=
1
;
// 0: Pattern, 1: Letter
detectionCounter
=
0
;
}
detected
.
detected
=
1
;
messageSize
=
mavlink_msg_pattern_detected_encode
(
systemId
,
componentId
,
&
msg
,
&
detected
);
// Allocate buffer with packet data
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
//detectionCounter = 0;
#endif
}
detectionCounter
++
;
status
.
vbat
=
voltage
*
1000
;
// millivolts
// Pack message and get size of encoded byte string
...
...
@@ -436,7 +549,15 @@ void MAVLinkSimulationLink::mainloop()
// HEARTBEAT
static
int
typeCounter
=
0
;
uint8_t
mavType
=
typeCounter
%
(
OCU
);
uint8_t
mavType
;
if
(
typeCounter
<
10
)
{
mavType
=
MAV_QUADROTOR
;
}
else
{
mavType
=
typeCounter
%
(
OCU
);
}
typeCounter
++
;
// Pack message and get size of encoded byte string
...
...
src/comm/MAVLinkSimulationLink.h
View file @
b647bb9b
/*=====================================================================
PIXHAWK Micro Air Vehicle Flying Robotics Toolkit
QGroundControl Open Source Ground Control Station
(c) 2009, 2010
PIXHAWK PROJECT <http://pixhawk.ethz.ch
>
(c) 2009, 2010
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org
>
This file is part of the
PIXHAWK
project
This file is part of the
QGROUNDCONTROL
project
PIXHAWK
is free software: you can redistribute it and/or modify
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.
PIXHAWK
is distributed in the hope that it will be useful,
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
PIXHAWK
. If not, see <http://www.gnu.org/licenses/>.
along with
QGROUNDCONTROL
. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of
simulated system l
ink
* @brief Definition of
MAVLinkSimulationL
ink
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
...
...
src/uas/UASInterface.h
View file @
b647bb9b
...
...
@@ -111,8 +111,8 @@ public:
///> Color map for plots, includes 20 colors
///> Map will start from beginning when the first 20 colors are exceeded
colors
.
append
(
QColor
(
203
,
254
,
121
));
colors
.
append
(
QColor
(
231
,
72
,
28
));
colors
.
append
(
QColor
(
203
,
254
,
121
));
colors
.
append
(
QColor
(
161
,
252
,
116
));
colors
.
append
(
QColor
(
232
,
33
,
47
));
colors
.
append
(
QColor
(
116
,
251
,
110
));
...
...
src/ui/MainWindow.cc
View file @
b647bb9b
...
...
@@ -127,7 +127,7 @@ void MainWindow::buildWidgets()
list
=
new
UASListWidget
(
this
);
waypoints
=
new
WaypointList
(
this
,
NULL
);
info
=
new
UASInfoWidget
(
this
);
detection
=
new
ObjectDetectionView
(
"patterns"
,
this
);
detection
=
new
ObjectDetectionView
(
"
images/
patterns"
,
this
);
hud
=
new
HUD
(
640
,
480
,
this
);
debugConsole
=
new
DebugConsole
(
this
);
map
=
new
MapWidget
(
this
);
...
...
@@ -563,7 +563,7 @@ void MainWindow::loadPixhawkView()
container7
->
setWidget
(
debugConsole
);
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
container7
);
//
DEBUG CONSOLE
//
RADIO CONTROL VIEW
QDockWidget
*
rcContainer
=
new
QDockWidget
(
tr
(
"Radio Control"
),
this
);
rcContainer
->
setWidget
(
rcView
);
addDockWidget
(
Qt
::
BottomDockWidgetArea
,
rcContainer
);
...
...
src/ui/ObjectDetectionView.cc
View file @
b647bb9b
...
...
@@ -94,7 +94,7 @@ void ObjectDetectionView::newPattern(int uasId, QString patternPath, float confi
if
(
!
patternList
.
contains
(
patternPath
))
{
// Emit audio message on detection
if
(
detected
)
GAudioOutput
::
instance
()
->
say
(
"System "
+
QString
::
number
(
uasId
)
+
" detected pattern "
+
QString
(
patternPath
.
split
(
"/"
).
last
()).
split
(
"."
).
first
());
if
(
detected
)
GAudioOutput
::
instance
()
->
say
(
"System "
+
QString
::
number
(
uasId
)
+
" detected pattern "
+
QString
(
patternPath
.
split
(
"/"
,
QString
::
SkipEmptyParts
).
last
()).
split
(
"."
,
QString
::
SkipEmptyParts
).
first
());
patternList
.
insert
(
patternPath
,
Pattern
(
patternPath
,
confidence
));
}
...
...
@@ -117,7 +117,7 @@ void ObjectDetectionView::newPattern(int uasId, QString patternPath, float confi
m_ui
->
listWidget
->
addItem
(
pattern
.
name
+
separator
+
"("
+
QString
::
number
(
pattern
.
count
)
+
")"
+
separator
+
QString
::
number
(
pattern
.
confidence
));
// load image
QString
filePath
=
MG
::
DIR
::
getSupportFilesDirectory
()
+
"/"
+
patternFolder
+
"/"
+
patternPath
.
split
(
"/"
).
last
();
QString
filePath
=
MG
::
DIR
::
getSupportFilesDirectory
()
+
"/"
+
patternFolder
+
"/"
+
patternPath
.
split
(
"/"
,
QString
::
SkipEmptyParts
).
last
();
QPixmap
image
=
QPixmap
(
filePath
);
if
(
image
.
width
()
>
image
.
height
())
image
=
image
.
scaledToWidth
(
m_ui
->
imageLabel
->
width
());
...
...
@@ -126,8 +126,8 @@ void ObjectDetectionView::newPattern(int uasId, QString patternPath, float confi
m_ui
->
imageLabel
->
setPixmap
(
image
);
// set textlabel
QString
patternName
=
patternPath
.
split
(
"/"
).
last
();
// Remove preceding folder names
patternName
=
patternName
.
split
(
"."
).
first
();
// Remove file ending
QString
patternName
=
patternPath
.
split
(
"/"
,
QString
::
SkipEmptyParts
).
last
();
// Remove preceding folder names
patternName
=
patternName
.
split
(
"."
,
QString
::
SkipEmptyParts
).
first
();
// Remove file ending
m_ui
->
nameLabel
->
setText
(
"Pattern: "
+
patternName
);
}
}
...
...
@@ -204,9 +204,9 @@ void ObjectDetectionView::takeAction()
QAction
*
act
=
dynamic_cast
<
QAction
*>
(
sender
());
if
(
act
)
{
QString
patternPath
=
act
->
text
().
trimmed
().
split
(
separator
).
first
();
// Remove additional information
QString
patternName
=
patternPath
.
split
(
"//"
).
last
();
// Remove preceding folder names
patternName
=
patternName
.
split
(
"."
).
first
();
// Remove file ending
QString
patternPath
=
act
->
text
().
trimmed
().
split
(
separator
,
QString
::
SkipEmptyParts
).
first
();
// Remove additional information
QString
patternName
=
patternPath
.
split
(
"//"
,
QString
::
SkipEmptyParts
).
last
();
// Remove preceding folder names
patternName
=
patternName
.
split
(
"."
,
QString
::
SkipEmptyParts
).
first
();
// Remove file ending
// Set name and label
m_ui
->
nameLabel
->
setText
(
patternName
);
...
...
src/ui/ObjectDetectionView.h
View file @
b647bb9b
...
...
@@ -62,7 +62,7 @@ class ObjectDetectionView : public QWidget {
};
public:
explicit
ObjectDetectionView
(
QString
folder
=
"patterns"
,
QWidget
*
parent
=
0
);
explicit
ObjectDetectionView
(
QString
folder
=
"
images/
patterns"
,
QWidget
*
parent
=
0
);
virtual
~
ObjectDetectionView
();
/** @brief Resize widget contents */
...
...
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