Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
259845de
Commit
259845de
authored
Nov 24, 2011
by
oberion
Browse files
Merge remote-tracking branch 'remotes/pixhawk/v10release' into dev_senseSoarMavlinkv10
parents
77bf8dc6
ba326ee6
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
images/earth-singlesystem.html
0 → 100644
View file @
259845de
This diff is collapsed.
Click to expand it.
images/earth.html
View file @
259845de
...
...
@@ -11,16 +11,15 @@
<script
type=
"text/javascript"
src=
"https://www.google.com/jsapi?key=ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg"
></script>
<script
type=
"text/javascript"
>
google
.
load
(
"
earth
"
,
"
1
"
,
{
'
language
'
:
'
en
'
});
var
ge
=
null
;
var
initialized
=
false
;
var
currAircraft
=
0
;
var
followEnabled
=
false
;
var
lineAltitudeOffset
=
0.5
;
///
<
0.5
m
higher
than
waypoint
,
prevents
the
line
from
entering
the
ground
var
lastLat
=
0
;
var
lastLon
=
0
;
var
lastAlt
=
0
;
var
lastLat
=
[]
;
var
lastLon
=
[]
;
var
lastAlt
=
[]
;
var
currLat
=
47.3769
;
var
currLon
=
8.549444
;
var
currAlt
=
470
;
...
...
@@ -59,6 +58,9 @@ var planeLoc;
var
aircraft
=
[];
var
aircraftLocations
=
[];
var
aircraftLastLocations
=
[];
var
aircraftScaleFactors
=
[];
var
aircraftLinks
=
[];
var
aircraftModels
=
[];
var
attitudes
=
[];
var
locations
=
[];
var
trails
=
[];
...
...
@@ -104,7 +106,6 @@ var homePlacemark = null;
var
heightMapPlacemark
=
null
;
var
heightMapModel
=
null
;
function
getGlobal
(
variable
)
{
return
variable
;
...
...
@@ -303,7 +304,6 @@ function setGCSHome(lat, lon, alt)
homeLon
=
lon
;
homeAlt
=
alt
;
if
(
homePlacemark
==
null
)
{
var
placemark
=
ge
.
createPlacemark
(
''
);
...
...
@@ -413,39 +413,39 @@ function updateWaypoint(id, index, lat, lon, alt, action)
function
createAircraft
(
id
,
type
,
color
)
{
planePlacemark
=
ge
.
createPlacemark
(
''
);
planePlacemark
.
setName
(
'
aircraft
'
);
planeModel
=
ge
.
createModel
(
''
);
ge
.
getFeatures
().
appendChild
(
planePlacemark
);
planeLoc
=
ge
.
createLocation
(
''
);
planeModel
.
setLocation
(
planeLoc
);
planeLink
=
ge
.
createLink
(
''
);
planeOrient
=
ge
.
createOrientation
(
''
);
planeModel
.
setOrientation
(
planeOrient
);
aircraft
[
id
]
=
ge
.
createPlacemark
(
''
);
aircraft
[
id
]
.
setName
(
'
aircraft
'
);
aircraftModels
[
id
]
=
ge
.
createModel
(
''
);
ge
.
getFeatures
().
appendChild
(
aircraft
[
id
]
);
aircraftLocations
[
id
]
=
ge
.
createLocation
(
''
);
aircraftModels
[
id
].
setLocation
(
aircraftLocations
[
id
]
);
aircraftLinks
[
id
]
=
ge
.
createLink
(
''
);
attitudes
[
id
]
=
ge
.
createOrientation
(
''
);
aircraftModels
[
id
]
.
setOrientation
(
attitudes
[
id
]
);
var
factor
=
1.0
;
aircraftScaleFactors
[
id
]
=
1.0
;
//planeLink.setHref('http://www.asl.ethz.ch/people/rudink/senseSoarDummy.dae');
planeLink
.
setHref
(
'
http://qgroundcontrol.org/_media/users/models/sfly-hex.dae
'
);
factor
=
1.0
/
1000.0
;
aircraftLinks
[
id
]
.
setHref
(
'
http://qgroundcontrol.org/_media/users/models/sfly-hex.dae
'
);
aircraftScaleFactors
[
id
]
=
1.0
/
1000.0
;
//planeLink.setHref('http://qgroundcontrol.org/_media/users/models/ascent-park-glider.dae');
planeModel
.
setLink
(
planeLink
);
var
scale
=
planeModel
.
getScale
();
scale
.
set
(
scale
.
getX
()
*
factor
,
scale
.
getY
()
*
factor
,
scale
.
getZ
()
*
factor
)
planeModel
.
setScale
(
scale
);
planeModel
.
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
aircraftModels
[
id
].
setLink
(
aircraftLinks
[
id
]
);
var
scale
=
aircraftModels
[
id
]
.
getScale
();
scale
.
set
(
scale
.
getX
()
*
aircraftScaleFactors
[
id
],
scale
.
getY
()
*
aircraftScaleFactors
[
id
],
scale
.
getZ
()
*
aircraftScaleFactors
[
id
]
)
aircraftModels
[
id
]
.
setScale
(
scale
);
aircraftModels
[
id
]
.
setAltitudeMode
(
ge
.
ALTITUDE_ABSOLUTE
);
planeLoc
.
setLatitude
(
currLat
);
planeLoc
.
setLongitude
(
currLon
);
planeLoc
.
setAltitude
(
currAlt
);
aircraftLocations
[
id
]
.
setLatitude
(
currLat
);
aircraftLocations
[
id
]
.
setLongitude
(
currLon
);
aircraftLocations
[
id
]
.
setAltitude
(
currAlt
);
planePlacemark
.
setGeometry
(
planeModel
);
aircraft
[
id
].
setGeometry
(
aircraftModels
[
id
]
);
// Write into global structure
aircraft
[
id
]
=
planePlacemark
;
attitudes
[
id
]
=
planeOrient
;
aircraftLocations
[
id
]
=
planeLoc
;
aircraftLastLocations
[
id
]
=
ge
.
createLocation
(
''
)
;
aircraft
LastLocations
[
id
]
=
aircraftLocations
[
id
]
;
lastLat
[
id
]
=
0
;
lastLon
[
id
]
=
0
;
lastAlt
[
id
]
=
0
;
createTrail
(
id
,
color
);
createWaypointLine
(
id
,
color
);
...
...
@@ -565,13 +565,12 @@ function initCallback(object)
ge
.
getLayerRoot
().
enableLayerById
(
ge
.
LAYER_BORDERS
,
true
);
ge
.
getLayerRoot
().
enableLayerById
(
ge
.
LAYER_TREES
,
true
);
enableEventListener
();
document
.
getElementById
(
'
JScript_initialized
'
).
setAttribute
(
'
value
'
,
'
true
'
);
// Load heightmap
// http://www.inf.ethz.ch/personal/lomeier/data/untex-environment.dae
heightMapPlacemark
=
ge
.
createPlacemark
(
''
);
/*
heightMapPlacemark = ge.createPlacemark('');
heightMapPlacemark.setName('aircraft');
heightMapModel = ge.createModel('');
ge.getFeatures().appendChild(heightMapPlacemark);
...
...
@@ -593,51 +592,56 @@ function initCallback(object)
planeLoc.setLongitude(currLon);
planeLoc.setAltitude(currAlt);
heightMapPlacemark
.
setGeometry
(
heightMapModel
);
heightMapPlacemark.setGeometry(heightMapModel);*/
enableEventListener
();
document
.
getElementById
(
'
JScript_initialized
'
).
setAttribute
(
'
value
'
,
'
true
'
);
initialized
=
true
;
}
function
setAircraftPositionAttitude
(
id
,
lat
,
lon
,
alt
,
roll
,
pitch
,
yaw
)
{
if
(
lastLat
[
id
]
==
0
)
{
lastLat
[
id
]
=
lat
;
lastLon
[
id
]
=
lon
;
}
if
(
id
==
currAircraft
)
{
if
(
lastLat
==
0
)
{
lastLat
=
currLat
;
lastLon
=
currLon
;
}
currFollowHeading
=
currFollowHeading
*
0.95
+
0.05
*
(((
yaw
/
M_PI
))
*
180.0
);
currLat
=
lat
;
currLon
=
lon
;
var
trueGroundAlt
=
ge
.
getGlobe
().
getGroundAltitude
(
lat
,
lon
);
if
(
trueGroundAlt
<
alt
)
{
currAlt
=
alt
;
currAlt
=
alt
;
}
else
{
currAlt
=
trueGroundAlt
+
0.1
;
currAlt
=
trueGroundAlt
+
0.1
;
}
// Interpolate between t-1 and t and set new states
lastLat
=
lastLat
*
0.5
+
currLat
*
0.5
;
lastLon
=
lastLon
*
0.5
+
currLon
*
0.5
;
lastAlt
=
lastAlt
*
0.5
+
currAlt
*
0.5
;
}
// Interpolate between t-1 and t and set new states
//lastLat[id] = lastLat[id]*0.5+lat*0.5;
//lastLon[id] = lastLon[id]*0.5+lon*0.5;
//lastAlt[id] = lastAlt[id]*0.5+alt*0.5;
planeOrient
.
setRoll
(
+
((
roll
/
M_PI
))
*
180.0
);
planeOrient
.
setTilt
(
-
((
pitch
/
M_PI
))
*
180.0
);
planeOrient
.
setHeading
(((
yaw
/
M_PI
))
*
180.0
-
90.0
);
planeModel
.
setOrientation
(
planeOrient
);
lastLat
[
id
]
=
lastLat
[
id
]
*
0.5
+
lat
*
0.5
;
lastLon
[
id
]
=
lastLon
[
id
]
*
0.5
+
lon
*
0.5
;
lastAlt
[
id
]
=
lastAlt
[
id
]
*
0.5
+
alt
*
0.5
;
currFollowHeading
=
currFollowHeading
*
0.95
+
0.05
*
(((
yaw
/
M_PI
))
*
180.0
);
attitudes
[
id
].
setRoll
(
+
((
roll
/
M_PI
))
*
180.0
);
attitudes
[
id
].
setTilt
(
-
((
pitch
/
M_PI
))
*
180.0
);
attitudes
[
id
].
setHeading
(((
yaw
/
M_PI
))
*
180.0
-
90.0
);
aircraftModels
[
id
].
setOrientation
(
attitudes
[
id
]);
planeLoc
.
setLatitude
(
lastLat
);
planeLoc
.
setLongitude
(
lastLon
);
planeLoc
.
setAltitude
(
lastAlt
);
planeModel
.
setLocation
(
planeLoc
);
aircraftLocations
[
id
]
.
setLatitude
(
lastLat
[
id
]
);
aircraftLocations
[
id
]
.
setLongitude
(
lastLon
[
id
]
);
aircraftLocations
[
id
]
.
setAltitude
(
lastAlt
[
id
]
);
aircraftModels
[
id
].
setLocation
(
aircraftLocations
[
id
]
);
if
(
followEnabled
)
updateFollowAircraft
();
}
if
(
followEnabled
&&
id
==
currAircraft
)
updateFollowAircraft
();
}
function
enableDaylight
(
enabled
)
...
...
@@ -703,16 +707,16 @@ function setViewMode(mode)
function
updateFollowAircraft
()
{
currView
=
ge
.
getView
().
copyAsLookAt
(
ge
.
ALTITUDE_ABSOLUTE
);
currView
.
setLatitude
(
lastLat
);
currView
.
setLongitude
(
lastLon
);
currView
.
setLatitude
(
lastLat
[
currAircraft
]
);
currView
.
setLongitude
(
lastLon
[
currAircraft
]
);
if
(
distanceMode
==
1
)
{
var
groundAltitude
=
ge
.
getGlobe
().
getGroundAltitude
(
lastLat
,
lastLon
);
var
groundAltitude
=
ge
.
getGlobe
().
getGroundAltitude
(
lastLat
[
currAircraft
],
lastLon
[
currAircraft
]
);
currView
.
setAltitude
(
groundAltitude
);
}
if
(
distanceMode
==
0
)
currView
.
setAltitude
(
lastAlt
);
if
(
distanceMode
==
0
)
currView
.
setAltitude
(
lastAlt
[
currAircraft
]
);
currView
.
setRange
(
currViewRange
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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