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
0f18c7c5
Commit
0f18c7c5
authored
Dec 05, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Plain Diff
Merged
parents
e4ea6b31
788ba064
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
406 additions
and
103 deletions
+406
-103
MAVLinkSimulationLink.cc
src/comm/MAVLinkSimulationLink.cc
+10
-17
Freenect.cc
src/input/Freenect.cc
+31
-0
Freenect.h
src/input/Freenect.h
+31
-0
UAS.cc
src/uas/UAS.cc
+12
-9
UAS.h
src/uas/UAS.h
+3
-3
UASInterface.h
src/uas/UASInterface.h
+3
-3
Imagery.cc
src/ui/map3D/Imagery.cc
+15
-11
Imagery.h
src/ui/map3D/Imagery.h
+9
-7
Pixhawk3DWidget.cc
src/ui/map3D/Pixhawk3DWidget.cc
+243
-33
Pixhawk3DWidget.h
src/ui/map3D/Pixhawk3DWidget.h
+20
-1
Q3DWidget.cc
src/ui/map3D/Q3DWidget.cc
+9
-4
QGCGoogleEarthView.cc
src/ui/map3D/QGCGoogleEarthView.cc
+11
-10
Texture.cc
src/ui/map3D/Texture.cc
+7
-5
Texture.h
src/ui/map3D/Texture.h
+2
-0
No files found.
src/comm/MAVLinkSimulationLink.cc
View file @
0f18c7c5
...
@@ -99,12 +99,6 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
...
@@ -99,12 +99,6 @@ MAVLinkSimulationLink::MAVLinkSimulationLink(QString readFile, QString writeFile
// Open packet log
// Open packet log
mavlinkLogFile
=
new
QFile
(
MAVLinkProtocol
::
getLogfileName
());
mavlinkLogFile
=
new
QFile
(
MAVLinkProtocol
::
getLogfileName
());
mavlinkLogFile
->
open
(
QIODevice
::
ReadOnly
);
mavlinkLogFile
->
open
(
QIODevice
::
ReadOnly
);
// position at Pixhawk lab @ ETHZ
x
=
5247273.0
f
;
y
=
465955.0
f
;
z
=
-
0.2
f
;
yaw
=
0
;
}
}
MAVLinkSimulationLink
::~
MAVLinkSimulationLink
()
MAVLinkSimulationLink
::~
MAVLinkSimulationLink
()
...
@@ -383,15 +377,14 @@ void MAVLinkSimulationLink::mainloop()
...
@@ -383,15 +377,14 @@ void MAVLinkSimulationLink::mainloop()
x
=
x
*
0.93
f
+
0.07
f
*
(
x
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
())
*
0.08
f
));
x
=
x
*
0.93
f
+
0.07
f
*
(
x
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
())
*
0.08
f
));
y
=
y
*
0.93
f
+
0.07
f
*
(
y
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
())
*
0.5
f
));
y
=
y
*
0.93
f
+
0.07
f
*
(
y
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
())
*
0.5
f
));
z
=
z
*
0.93
f
+
0.07
f
*
(
z
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
()
*
0.001
f
))
*
0.1
f
);
z
=
z
*
0.93
f
+
0.07
f
*
(
z
+
sin
(
static_cast
<
float
>
(
QGC
::
groundTimeUsecs
()
*
0.001
f
))
*
0.1
f
);
x
=
5247273.0
f
;
y
=
465955.0
f
;
x
=
(
x
>
5.0
f
)
?
5.0
f
:
x
;
// x = (x > 5.0f) ? 5.0f : x;
y
=
(
y
>
5.0
f
)
?
5.0
f
:
y
;
// y = (y > 5.0f) ? 5.0f : y;
z
=
(
z
>
3.0
f
)
?
3.0
f
:
z
;
// z = (z > 3.0f) ? 3.0f : z;
//
x
=
(
x
<
-
5.0
f
)
?
-
5.0
f
:
x
;
// x = (x < -5.0f) ? -5.0f : x;
y
=
(
y
<
-
5.0
f
)
?
-
5.0
f
:
y
;
// y = (y < -5.0f) ? -5.0f : y;
z
=
(
z
<
-
3.0
f
)
?
-
3.0
f
:
z
;
// z = (z < -3.0f) ? -3.0f : z;
// Send back new setpoint
// Send back new setpoint
mavlink_message_t
ret
;
mavlink_message_t
ret
;
...
@@ -409,14 +402,14 @@ void MAVLinkSimulationLink::mainloop()
...
@@ -409,14 +402,14 @@ void MAVLinkSimulationLink::mainloop()
streampointer
+=
bufferlength
;
streampointer
+=
bufferlength
;
// GPS RAW
// GPS RAW
mavlink_msg_gps_raw_pack
(
systemId
,
componentId
,
&
ret
,
0
,
3
,
47.376417
+
(
x
*
0.00
1
),
8.548103
+
(
y
*
0.
001
),
z
,
0
,
0
,
2.5
f
,
0.1
f
);
mavlink_msg_gps_raw_pack
(
systemId
,
componentId
,
&
ret
,
0
,
3
,
47.376417
+
(
x
*
0.00
001
),
8.548103
+
(
y
*
0.00
001
),
z
,
0
,
0
,
2.5
f
,
0.1
f
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
streampointer
+=
bufferlength
;
streampointer
+=
bufferlength
;
// GLOBAL POSITION
// GLOBAL POSITION
mavlink_msg_global_position_pack
(
systemId
,
componentId
,
&
ret
,
0
,
3
,
47.376417
+
(
x
*
0.001
),
8.548103
+
(
y
*
0.001
),
z
,
0
,
0
);
mavlink_msg_global_position_pack
(
systemId
,
componentId
,
&
ret
,
0
,
47.378028137103
+
(
x
*
0.00001
),
8.54899892510421
+
(
y
*
0.00001
),
z
,
0
,
0
,
0
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
bufferlength
=
mavlink_msg_to_send_buffer
(
buffer
,
&
ret
);
//add data into datastream
//add data into datastream
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
memcpy
(
stream
+
streampointer
,
buffer
,
bufferlength
);
...
...
src/input/Freenect.cc
View file @
0f18c7c5
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
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.
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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class Freenect.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#include "Freenect.h"
#include "Freenect.h"
#include <cmath>
#include <cmath>
...
...
src/input/Freenect.h
View file @
0f18c7c5
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
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.
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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of the class Freenect.
*
* @author Lionel Heng <hengli@student.ethz.ch>
*
*/
#ifndef FREENECT_H
#ifndef FREENECT_H
#define FREENECT_H
#define FREENECT_H
...
...
src/uas/UAS.cc
View file @
0f18c7c5
...
@@ -73,15 +73,15 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
...
@@ -73,15 +73,15 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
sendDropRate
(
0
),
sendDropRate
(
0
),
lowBattAlarm
(
false
),
lowBattAlarm
(
false
),
positionLock
(
false
),
positionLock
(
false
),
localX
(
0
),
localX
(
0
.0
),
localY
(
0
),
localY
(
0
.0
),
localZ
(
0
),
localZ
(
0
.0
),
latitude
(
0
),
latitude
(
0
.0
),
longitude
(
0
),
longitude
(
0
.0
),
altitude
(
0
),
altitude
(
0
.0
),
roll
(
0
),
roll
(
0
.0
),
pitch
(
0
),
pitch
(
0
.0
),
yaw
(
0
),
yaw
(
0
.0
),
statusTimeout
(
new
QTimer
(
this
))
statusTimeout
(
new
QTimer
(
this
))
{
{
color
=
UASInterface
::
getNextColor
();
color
=
UASInterface
::
getNextColor
();
...
@@ -345,6 +345,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -345,6 +345,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
mavlink_global_position_t
pos
;
mavlink_global_position_t
pos
;
mavlink_msg_global_position_decode
(
&
message
,
&
pos
);
mavlink_msg_global_position_decode
(
&
message
,
&
pos
);
quint64
time
=
getUnixTime
(
pos
.
usec
);
quint64
time
=
getUnixTime
(
pos
.
usec
);
latitude
=
pos
.
lat
;
longitude
=
pos
.
lon
;
altitude
=
pos
.
alt
;
emit
valueChanged
(
uasId
,
"lat"
,
pos
.
lat
,
time
);
emit
valueChanged
(
uasId
,
"lat"
,
pos
.
lat
,
time
);
emit
valueChanged
(
uasId
,
"lon"
,
pos
.
lon
,
time
);
emit
valueChanged
(
uasId
,
"lon"
,
pos
.
lon
,
time
);
emit
valueChanged
(
uasId
,
"alt"
,
pos
.
alt
,
time
);
emit
valueChanged
(
uasId
,
"alt"
,
pos
.
alt
,
time
);
...
...
src/uas/UAS.h
View file @
0f18c7c5
...
@@ -82,9 +82,9 @@ public:
...
@@ -82,9 +82,9 @@ public:
double
getLocalX
()
const
{
return
localX
;
};
double
getLocalX
()
const
{
return
localX
;
};
double
getLocalY
()
const
{
return
localY
;
};
double
getLocalY
()
const
{
return
localY
;
};
double
getLocalZ
()
const
{
return
localZ
;
};
double
getLocalZ
()
const
{
return
localZ
;
};
double
getLat
()
const
{
return
latitude
;
};
double
getLat
itude
()
const
{
return
latitude
;
};
double
getLon
()
const
{
return
longitude
;
};
double
getLon
gitude
()
const
{
return
longitude
;
};
double
getAlt
()
const
{
return
altitude
;
};
double
getAlt
itude
()
const
{
return
altitude
;
};
double
getRoll
()
const
{
return
roll
;
};
double
getRoll
()
const
{
return
roll
;
};
double
getPitch
()
const
{
return
pitch
;
};
double
getPitch
()
const
{
return
pitch
;
};
...
...
src/uas/UASInterface.h
View file @
0f18c7c5
...
@@ -70,9 +70,9 @@ public:
...
@@ -70,9 +70,9 @@ public:
virtual
double
getLocalY
()
const
=
0
;
virtual
double
getLocalY
()
const
=
0
;
virtual
double
getLocalZ
()
const
=
0
;
virtual
double
getLocalZ
()
const
=
0
;
virtual
double
getLat
()
const
=
0
;
virtual
double
getLat
itude
()
const
=
0
;
virtual
double
getLon
()
const
=
0
;
virtual
double
getLon
gitude
()
const
=
0
;
virtual
double
getAlt
()
const
=
0
;
virtual
double
getAlt
itude
()
const
=
0
;
virtual
double
getRoll
()
const
=
0
;
virtual
double
getRoll
()
const
=
0
;
virtual
double
getPitch
()
const
=
0
;
virtual
double
getPitch
()
const
=
0
;
...
...
src/ui/map3D/Imagery.cc
View file @
0f18c7c5
...
@@ -118,6 +118,7 @@ Imagery::prefetch2D(double windowWidth, double windowHeight,
...
@@ -118,6 +118,7 @@ Imagery::prefetch2D(double windowWidth, double windowHeight,
void
void
Imagery
::
draw2D
(
double
windowWidth
,
double
windowHeight
,
Imagery
::
draw2D
(
double
windowWidth
,
double
windowHeight
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
double
xOffset
,
double
yOffset
,
double
zOffset
,
const
QString
&
utmZone
)
const
QString
&
utmZone
)
{
{
if
(
getNumDrawables
()
>
0
)
if
(
getNumDrawables
()
>
0
)
...
@@ -171,10 +172,11 @@ Imagery::draw2D(double windowWidth, double windowHeight,
...
@@ -171,10 +172,11 @@ Imagery::draw2D(double windowWidth, double windowHeight,
TexturePtr
t
=
textureCache
->
get
(
tileURL
);
TexturePtr
t
=
textureCache
->
get
(
tileURL
);
if
(
!
t
.
isNull
())
if
(
!
t
.
isNull
())
{
{
addDrawable
(
t
->
draw
(
y1
,
x1
,
addDrawable
(
t
->
draw
(
y1
-
yOffset
,
x1
-
xOffset
,
y2
,
x2
,
y2
-
yOffset
,
x2
-
xOffset
,
y3
,
x3
,
y3
-
yOffset
,
x3
-
xOffset
,
y4
,
x4
,
y4
-
yOffset
,
x4
-
xOffset
,
zOffset
,
true
));
true
));
}
}
}
}
...
@@ -213,6 +215,7 @@ Imagery::prefetch3D(double radius, double tileResolution,
...
@@ -213,6 +215,7 @@ Imagery::prefetch3D(double radius, double tileResolution,
void
void
Imagery
::
draw3D
(
double
radius
,
double
tileResolution
,
Imagery
::
draw3D
(
double
radius
,
double
tileResolution
,
double
xOrigin
,
double
yOrigin
,
double
xOrigin
,
double
yOrigin
,
double
xOffset
,
double
yOffset
,
double
zOffset
,
const
QString
&
utmZone
)
const
QString
&
utmZone
)
{
{
if
(
getNumDrawables
()
>
0
)
if
(
getNumDrawables
()
>
0
)
...
@@ -246,10 +249,11 @@ Imagery::draw3D(double radius, double tileResolution,
...
@@ -246,10 +249,11 @@ Imagery::draw3D(double radius, double tileResolution,
if
(
!
t
.
isNull
())
if
(
!
t
.
isNull
())
{
{
addDrawable
(
t
->
draw
(
y1
,
x1
,
addDrawable
(
t
->
draw
(
y1
-
yOffset
,
x1
-
xOffset
,
y2
,
x2
,
y2
-
yOffset
,
x2
-
xOffset
,
y3
,
x3
,
y3
-
yOffset
,
x3
-
xOffset
,
y4
,
x4
,
y4
-
yOffset
,
x4
-
xOffset
,
zOffset
,
true
));
true
));
}
}
}
}
...
@@ -397,7 +401,7 @@ Imagery::UTMtoTile(double northing, double easting, const QString& utmZone,
...
@@ -397,7 +401,7 @@ Imagery::UTMtoTile(double northing, double easting, const QString& utmZone,
}
}
QChar
QChar
Imagery
::
UTMLetterDesignator
(
double
latitude
)
const
Imagery
::
UTMLetterDesignator
(
double
latitude
)
{
{
// This routine determines the correct UTM letter designator for the given latitude
// This routine determines the correct UTM letter designator for the given latitude
// returns 'Z' if latitude is outside the UTM limits of 84N to 80S
// returns 'Z' if latitude is outside the UTM limits of 84N to 80S
...
@@ -432,7 +436,7 @@ Imagery::UTMLetterDesignator(double latitude) const
...
@@ -432,7 +436,7 @@ Imagery::UTMLetterDesignator(double latitude) const
void
void
Imagery
::
LLtoUTM
(
double
latitude
,
double
longitude
,
Imagery
::
LLtoUTM
(
double
latitude
,
double
longitude
,
double
&
utmNorthing
,
double
&
utmEasting
,
double
&
utmNorthing
,
double
&
utmEasting
,
QString
&
utmZone
)
const
QString
&
utmZone
)
{
{
// converts lat/long to UTM coords. Equations from USGS Bulletin 1532
// converts lat/long to UTM coords. Equations from USGS Bulletin 1532
// East Longitudes are positive, West longitudes are negative.
// East Longitudes are positive, West longitudes are negative.
...
@@ -513,7 +517,7 @@ Imagery::LLtoUTM(double latitude, double longitude,
...
@@ -513,7 +517,7 @@ Imagery::LLtoUTM(double latitude, double longitude,
void
void
Imagery
::
UTMtoLL
(
double
utmNorthing
,
double
utmEasting
,
const
QString
&
utmZone
,
Imagery
::
UTMtoLL
(
double
utmNorthing
,
double
utmEasting
,
const
QString
&
utmZone
,
double
&
latitude
,
double
&
longitude
)
const
double
&
latitude
,
double
&
longitude
)
{
{
// converts UTM coords to lat/long. Equations from USGS Bulletin 1532
// converts UTM coords to lat/long. Equations from USGS Bulletin 1532
// East Longitudes are positive, West longitudes are negative.
// East Longitudes are positive, West longitudes are negative.
...
...
src/ui/map3D/Imagery.h
View file @
0f18c7c5
...
@@ -60,6 +60,7 @@ public:
...
@@ -60,6 +60,7 @@ public:
const
QString
&
utmZone
);
const
QString
&
utmZone
);
void
draw2D
(
double
windowWidth
,
double
windowHeight
,
void
draw2D
(
double
windowWidth
,
double
windowHeight
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
double
zoom
,
double
xOrigin
,
double
yOrigin
,
double
xOffset
,
double
yOffset
,
double
zOffset
,
const
QString
&
utmZone
);
const
QString
&
utmZone
);
void
prefetch3D
(
double
radius
,
double
tileResolution
,
void
prefetch3D
(
double
radius
,
double
tileResolution
,
...
@@ -67,10 +68,17 @@ public:
...
@@ -67,10 +68,17 @@ public:
const
QString
&
utmZone
);
const
QString
&
utmZone
);
void
draw3D
(
double
radius
,
double
tileResolution
,
void
draw3D
(
double
radius
,
double
tileResolution
,
double
xOrigin
,
double
yOrigin
,
double
xOrigin
,
double
yOrigin
,
double
xOffset
,
double
yOffset
,
double
zOffset
,
const
QString
&
utmZone
);
const
QString
&
utmZone
);
bool
update
(
void
);
bool
update
(
void
);
static
void
LLtoUTM
(
double
latitude
,
double
longitude
,
double
&
utmNorthing
,
double
&
utmEasting
,
QString
&
utmZone
);
static
void
UTMtoLL
(
double
utmNorthing
,
double
utmEasting
,
const
QString
&
utmZone
,
double
&
latitude
,
double
&
longitude
);
private:
private:
void
imageBounds
(
int
tileX
,
int
tileY
,
double
tileResolution
,
void
imageBounds
(
int
tileX
,
int
tileY
,
double
tileResolution
,
double
&
x1
,
double
&
y1
,
double
&
x2
,
double
&
y2
,
double
&
x1
,
double
&
y1
,
double
&
x2
,
double
&
y2
,
...
@@ -90,13 +98,7 @@ private:
...
@@ -90,13 +98,7 @@ private:
void
UTMtoTile
(
double
northing
,
double
easting
,
const
QString
&
utmZone
,
void
UTMtoTile
(
double
northing
,
double
easting
,
const
QString
&
utmZone
,
double
tileResolution
,
int
&
tileX
,
int
&
tileY
,
double
tileResolution
,
int
&
tileX
,
int
&
tileY
,
int
&
zoomLevel
)
const
;
int
&
zoomLevel
)
const
;
QChar
UTMLetterDesignator
(
double
latitude
)
const
;
static
QChar
UTMLetterDesignator
(
double
latitude
);
void
LLtoUTM
(
double
latitude
,
double
longitude
,
double
&
utmNorthing
,
double
&
utmEasting
,
QString
&
utmZone
)
const
;
void
UTMtoLL
(
double
utmNorthing
,
double
utmEasting
,
const
QString
&
utmZone
,
double
&
latitude
,
double
&
longitude
)
const
;
QString
getTileLocation
(
int
tileX
,
int
tileY
,
int
zoomLevel
,
QString
getTileLocation
(
int
tileX
,
int
tileY
,
int
zoomLevel
,
double
tileResolution
)
const
;
double
tileResolution
)
const
;
...
...
src/ui/map3D/Pixhawk3DWidget.cc
View file @
0f18c7c5
This diff is collapsed.
Click to expand it.
src/ui/map3D/Pixhawk3DWidget.h
View file @
0f18c7c5
...
@@ -68,6 +68,13 @@ private slots:
...
@@ -68,6 +68,13 @@ private slots:
void
recenter
(
void
);
void
recenter
(
void
);
void
toggleFollowCamera
(
int
state
);
void
toggleFollowCamera
(
int
state
);
void
insertWaypoint
(
void
);
void
moveWaypoint
(
void
);
void
setWaypoint
(
void
);
void
deleteWaypoint
(
void
);
void
setWaypointAltitude
(
void
);
void
clearAllWaypoints
(
void
);
protected:
protected:
QVector
<
osg
::
ref_ptr
<
osg
::
Node
>
>
findVehicleModels
(
void
);
QVector
<
osg
::
ref_ptr
<
osg
::
Node
>
>
findVehicleModels
(
void
);
void
buildLayout
(
void
);
void
buildLayout
(
void
);
...
@@ -91,7 +98,8 @@ private:
...
@@ -91,7 +98,8 @@ private:
void
updateHUD
(
double
robotX
,
double
robotY
,
double
robotZ
,
void
updateHUD
(
double
robotX
,
double
robotY
,
double
robotZ
,
double
robotRoll
,
double
robotPitch
,
double
robotYaw
);
double
robotRoll
,
double
robotPitch
,
double
robotYaw
);
void
updateTrail
(
double
robotX
,
double
robotY
,
double
robotZ
);
void
updateTrail
(
double
robotX
,
double
robotY
,
double
robotZ
);
void
updateImagery
(
void
);
void
updateImagery
(
double
originX
,
double
originY
,
double
originZ
,
const
QString
&
zone
);
void
updateTarget
(
void
);
void
updateTarget
(
void
);
void
updateWaypoints
(
void
);
void
updateWaypoints
(
void
);
#ifdef QGC_LIBFREENECT_ENABLED
#ifdef QGC_LIBFREENECT_ENABLED
...
@@ -100,6 +108,17 @@ private:
...
@@ -100,6 +108,17 @@ private:
void
markTarget
(
void
);
void
markTarget
(
void
);
int
findWaypoint
(
int
mouseX
,
int
mouseY
);
void
showInsertWaypointMenu
(
const
QPoint
&
cursorPos
);
void
showEditWaypointMenu
(
const
QPoint
&
cursorPos
);
enum
Mode
{
DEFAULT_MODE
,
MOVE_WAYPOINT_MODE
};
Mode
mode
;
int
selectedWpIndex
;
bool
displayGrid
;
bool
displayGrid
;
bool
displayTrail
;
bool
displayTrail
;
bool
displayImagery
;
bool
displayImagery
;
...
...
src/ui/map3D/Q3DWidget.cc
View file @
0f18c7c5
...
@@ -72,6 +72,9 @@ Q3DWidget::init(float fps)
...
@@ -72,6 +72,9 @@ Q3DWidget::init(float fps)
{
{
getCamera
()
->
setGraphicsContext
(
osgGW
);
getCamera
()
->
setGraphicsContext
(
osgGW
);
// manually specify near and far clip planes
getCamera
()
->
setComputeNearFarMode
(
osg
::
CullSettings
::
DO_NOT_COMPUTE_NEAR_FAR
);
setLightingMode
(
osg
::
View
::
SKY_LIGHT
);
setLightingMode
(
osg
::
View
::
SKY_LIGHT
);
// set up various maps
// set up various maps
...
@@ -149,8 +152,9 @@ Q3DWidget::createRobot(void)
...
@@ -149,8 +152,9 @@ Q3DWidget::createRobot(void)
osg
::
ref_ptr
<
osg
::
Node
>
osg
::
ref_ptr
<
osg
::
Node
>
Q3DWidget
::
createHUD
(
void
)
Q3DWidget
::
createHUD
(
void
)
{
{
hudProjectionMatrix
->
setMatrix
(
osg
::
Matrix
::
ortho2D
(
0
,
width
(),
hudProjectionMatrix
->
setMatrix
(
osg
::
Matrix
::
ortho
(
0.0
,
width
(),
0
,
height
()));
0.0
,
height
(),
-
10.0
,
10.0
));
osg
::
ref_ptr
<
osg
::
MatrixTransform
>
hudModelViewMatrix
(
osg
::
ref_ptr
<
osg
::
MatrixTransform
>
hudModelViewMatrix
(
new
osg
::
MatrixTransform
);
new
osg
::
MatrixTransform
);
...
@@ -256,8 +260,9 @@ Q3DWidget::getMouseY(void)
...
@@ -256,8 +260,9 @@ Q3DWidget::getMouseY(void)
void
void
Q3DWidget
::
resizeGL
(
int
width
,
int
height
)
Q3DWidget
::
resizeGL
(
int
width
,
int
height
)
{
{
hudProjectionMatrix
->
setMatrix
(
osg
::
Matrix
::
ortho2D
(
0
,
width
,
hudProjectionMatrix
->
setMatrix
(
osg
::
Matrix
::
ortho
(
0.0
,
width
,
0
,
height
));
0.0
,
height
,
-
10.0
,
10.0
));
osgGW
->
getEventQueue
()
->
windowResize
(
0
,
0
,
width
,
height
);
osgGW
->
getEventQueue
()
->
windowResize
(
0
,
0
,
width
,
height
);
osgGW
->
resized
(
0
,
0
,
width
,
height
);
osgGW
->
resized
(
0
,
0
,
width
,
height
);
...
...
src/ui/map3D/QGCGoogleEarthView.cc
View file @
0f18c7c5
...
@@ -76,24 +76,25 @@ void QGCGoogleEarthView::updateState()
...
@@ -76,24 +76,25 @@ void QGCGoogleEarthView::updateState()
if
(
mav
)
if
(
mav
)
{
{
uasId
=
mav
->
getUASID
();
uasId
=
mav
->
getUASID
();
lat
=
mav
->
getLat
();
lat
=
mav
->
getLat
itude
();
lon
=
mav
->
getLon
();
lon
=
mav
->
getLon
gitude
();
alt
=
mav
->
getAlt
();
alt
=
mav
->
getAlt
itude
();
roll
=
mav
->
getRoll
();
roll
=
mav
->
getRoll
();
pitch
=
mav
->
getPitch
();
pitch
=
mav
->
getPitch
();
yaw
=
mav
->
getYaw
();
yaw
=
mav
->
getYaw
();
}
}
// ui->webView->page()->currentFrame()->evaluateJavaScript(QString("setAircraftPosition(%1, %2, %3, %4);")
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
QString
(
"setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);"
)
// .arg(uasId)
.
arg
(
uasId
)
// .arg(lat)
.
arg
(
lat
)
// .arg(lon)
.
arg
(
lon
)
// .arg(alt));
.
arg
(
alt
+
500
)
// //ui->webView->page()->currentFrame()->evaluateJavaScript(QString("drawAndCenter(%1, %2, %3, %4, '%5', %6, %7, %8, %9, %10, %11);").arg(lat).arg(lon).arg(alt).arg("true").arg("ff0000ff").arg("1").arg("true").arg("true").arg(yaw).arg(pitch).arg(roll));
.
arg
(
roll
)
.
arg
(
pitch
)
.
arg
(
yaw
));
if
(
followCamera
)
if
(
followCamera
)
{
{
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
QString
(
"updateFollowAircraft()"
));
ui
->
webView
->
page
()
->
currentFrame
()
->
evaluateJavaScript
(
QString
(
"updateFollowAircraft()"
));
//ui->webView->page()->currentFrame()->evaluateJavaScript(QString("followAircraft(%1);").arg(mav->getUASID()));
}
}
}
}
}
}
...
...
src/ui/map3D/Texture.cc
View file @
0f18c7c5
...
@@ -113,22 +113,24 @@ Texture::sync(const WebImagePtr& image)
...
@@ -113,22 +113,24 @@ Texture::sync(const WebImagePtr& image)
osg
::
ref_ptr
<
osg
::
Geometry
>
osg
::
ref_ptr
<
osg
::
Geometry
>
Texture
::
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
Texture
::
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
z
,
bool
smoothInterpolation
)
const
bool
smoothInterpolation
)
const
{
{
return
draw
(
x1
,
y1
,
x2
,
y1
,
x2
,
y2
,
x1
,
y2
,
smoothInterpolation
);
return
draw
(
x1
,
y1
,
x2
,
y1
,
x2
,
y2
,
x1
,
y2
,
z
,
smoothInterpolation
);
}
}
osg
::
ref_ptr
<
osg
::
Geometry
>
osg
::
ref_ptr
<
osg
::
Geometry
>
Texture
::
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
Texture
::
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
x3
,
double
y3
,
double
x4
,
double
y4
,
double
x3
,
double
y3
,
double
x4
,
double
y4
,
double
z
,
bool
smoothInterpolation
)
const
bool
smoothInterpolation
)
const
{
{
osg
::
Vec3dArray
*
vertices
=
osg
::
Vec3dArray
*
vertices
=
static_cast
<
osg
::
Vec3dArray
*>
(
geometry
->
getVertexArray
());
static_cast
<
osg
::
Vec3dArray
*>
(
geometry
->
getVertexArray
());
(
*
vertices
)[
0
].
set
(
x1
,
y1
,
-
0.1
);
(
*
vertices
)[
0
].
set
(
x1
,
y1
,
z
-
0.1
);
(
*
vertices
)[
1
].
set
(
x2
,
y2
,
-
0.1
);
(
*
vertices
)[
1
].
set
(
x2
,
y2
,
z
-
0.1
);
(
*
vertices
)[
2
].
set
(
x3
,
y3
,
-
0.1
);
(
*
vertices
)[
2
].
set
(
x3
,
y3
,
z
-
0.1
);
(
*
vertices
)[
3
].
set
(
x4
,
y4
,
-
0.1
);
(
*
vertices
)[
3
].
set
(
x4
,
y4
,
z
-
0.1
);
osg
::
DrawArrays
*
drawarrays
=
osg
::
DrawArrays
*
drawarrays
=
static_cast
<
osg
::
DrawArrays
*>
(
geometry
->
getPrimitiveSet
(
0
));
static_cast
<
osg
::
DrawArrays
*>
(
geometry
->
getPrimitiveSet
(
0
));
...
...
src/ui/map3D/Texture.h
View file @
0f18c7c5
...
@@ -52,9 +52,11 @@ public:
...
@@ -52,9 +52,11 @@ public:
void
sync
(
const
WebImagePtr
&
image
);
void
sync
(
const
WebImagePtr
&
image
);
osg
::
ref_ptr
<
osg
::
Geometry
>
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
osg
::
ref_ptr
<
osg
::
Geometry
>
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
z
,
bool
smoothInterpolation
)
const
;
bool
smoothInterpolation
)
const
;
osg
::
ref_ptr
<
osg
::
Geometry
>
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
osg
::
ref_ptr
<
osg
::
Geometry
>
draw
(
double
x1
,
double
y1
,
double
x2
,
double
y2
,
double
x3
,
double
y3
,
double
x4
,
double
y4
,
double
x3
,
double
y3
,
double
x4
,
double
y4
,
double
z
,
bool
smoothInterpolation
)
const
;
bool
smoothInterpolation
)
const
;
private:
private:
...
...
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