Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rugged
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Orekit
Rugged
Commits
13c04739
Commit
13c04739
authored
10 years ago
by
Luc Maisonobe
Browse files
Options
Downloads
Patches
Plain Diff
Added the code for tutorials.
parent
b42818e2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tutorials/java/fr/cs/examples/DirectLocation.java
+177
-0
177 additions, 0 deletions
src/tutorials/java/fr/cs/examples/DirectLocation.java
src/tutorials/java/fr/cs/examples/DirectLocationWithDEM.java
+226
-0
226 additions, 0 deletions
src/tutorials/java/fr/cs/examples/DirectLocationWithDEM.java
with
403 additions
and
0 deletions
src/tutorials/java/fr/cs/examples/DirectLocation.java
0 → 100644
+
177
−
0
View file @
13c04739
/* Copyright 2013-2015 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
fr.cs.examples
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
org.apache.commons.math3.geometry.euclidean.threed.Rotation
;
import
org.apache.commons.math3.geometry.euclidean.threed.Vector3D
;
import
org.apache.commons.math3.util.FastMath
;
import
org.orekit.bodies.GeodeticPoint
;
import
org.orekit.data.DataProvidersManager
;
import
org.orekit.data.DirectoryCrawler
;
import
org.orekit.errors.OrekitException
;
import
org.orekit.frames.Frame
;
import
org.orekit.frames.FramesFactory
;
import
org.orekit.frames.Transform
;
import
org.orekit.rugged.api.AlgorithmId
;
import
org.orekit.rugged.api.BodyRotatingFrameId
;
import
org.orekit.rugged.api.EllipsoidId
;
import
org.orekit.rugged.api.InertialFrameId
;
import
org.orekit.rugged.api.Rugged
;
import
org.orekit.rugged.api.RuggedBuilder
;
import
org.orekit.rugged.errors.RuggedException
;
import
org.orekit.rugged.linesensor.LineSensor
;
import
org.orekit.rugged.linesensor.LinearLineDatation
;
import
org.orekit.rugged.los.LOSBuilder
;
import
org.orekit.rugged.los.FixedRotation
;
import
org.orekit.rugged.los.TimeDependentLOS
;
import
org.orekit.rugged.utils.ParameterType
;
import
org.orekit.time.AbsoluteDate
;
import
org.orekit.time.TimeScale
;
import
org.orekit.time.TimeScalesFactory
;
import
org.orekit.utils.AngularDerivativesFilter
;
import
org.orekit.utils.CartesianDerivativesFilter
;
import
org.orekit.utils.IERSConventions
;
import
org.orekit.utils.PVCoordinates
;
import
org.orekit.utils.TimeStampedAngularCoordinates
;
import
org.orekit.utils.TimeStampedPVCoordinates
;
public
class
DirectLocation
{
public
static
void
main
(
String
[]
args
)
{
try
{
// Initialize Orekit, assuming an orekit-data folder is in user home directory
File
home
=
new
File
(
System
.
getProperty
(
"user.home"
));
File
orekitData
=
new
File
(
home
,
"orekit-data"
);
DataProvidersManager
.
getInstance
().
addProvider
(
new
DirectoryCrawler
(
orekitData
));
// The raw viewing direction of pixel i with respect to the instrument is defined by the vector:
List
<
Vector3D
>
rawDirs
=
new
ArrayList
<
Vector3D
>();
for
(
int
i
=
0
;
i
<
2000
;
i
++)
{
//20° field of view, 2000 pixels
rawDirs
.
add
(
new
Vector3D
(
0
d
,
i
*
FastMath
.
toRadians
(
20
)/
2000
d
,
1
d
));
}
// The instrument is oriented 10° off nadir around the X-axis, we need to rotate the viewing
// direction to obtain the line of sight in the satellite frame
LOSBuilder
losBuilder
=
new
LOSBuilder
(
rawDirs
);
losBuilder
.
addTransform
(
new
FixedRotation
(
ParameterType
.
FIXED
,
Vector3D
.
PLUS_I
,
FastMath
.
toRadians
(
10
)));
TimeDependentLOS
lineOfSight
=
losBuilder
.
build
();
// We use Orekit for handling time and dates, and Rugged for defining the datation model:
TimeScale
gps
=
TimeScalesFactory
.
getGPS
();
AbsoluteDate
absDate
=
new
AbsoluteDate
(
"2009-12-11T16:59:30.0"
,
gps
);
LinearLineDatation
lineDatation
=
new
LinearLineDatation
(
absDate
,
1
d
,
20
);
// With the LOS and the datation now defined , we can initialize a line sensor object in Rugged:
LineSensor
lineSensor
=
new
LineSensor
(
"mySensor"
,
lineDatation
,
Vector3D
.
ZERO
,
lineOfSight
);
// In our application, we simply need to know the name of the frames we are working with. Positions and
// velocities are given in the ITRF terrestrial frame, while the quaternions are given in EME2000
// inertial frame.
Frame
eme2000
=
FramesFactory
.
getEME2000
();
boolean
simpleEOP
=
true
;
// we don't want to compute tiny tidal effects at millimeter level
Frame
itrf
=
FramesFactory
.
getITRF
(
IERSConventions
.
IERS_2010
,
simpleEOP
);
ArrayList
<
TimeStampedAngularCoordinates
>
satelliteQList
=
new
ArrayList
<
TimeStampedAngularCoordinates
>();
ArrayList
<
TimeStampedPVCoordinates
>
satellitePVList
=
new
ArrayList
<
TimeStampedPVCoordinates
>();
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:58:42.592937"
,
-
0.340236d
,
0.333952d
,
-
0.844012d
,
-
0.245684d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:06.592937"
,
-
0.354773d
,
0.329336d
,
-
0.837871d
,
-
0.252281d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:30.592937"
,
-
0.369237d
,
0.324612d
,
-
0.831445d
,
-
0.258824d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:54.592937"
,
-
0.3836d
,
0.319792d
,
-
0.824743d
,
-
0.265299d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:00:18.592937"
,
-
0.397834d
,
0.314883d
,
-
0.817777d
,
-
0.271695d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:00:42.592937"
,
-
0.411912d
,
0.309895d
,
-
0.810561d
,
-
0.278001d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:06.592937"
,
-
0.42581d
,
0.304838d
,
-
0.803111d
,
-
0.284206d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:30.592937"
,
-
0.439505d
,
0.299722d
,
-
0.795442d
,
-
0.290301d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:54.592937"
,
-
0.452976d
,
0.294556d
,
-
0.787571d
,
-
0.296279d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:02:18.592937"
,
-
0.466207d
,
0.28935d
,
-
0.779516d
,
-
0.302131d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:58:42.592937"
,
-
726361.466d
,
-
5411878.485d
,
4637549.599d
,
-
2068.995d
,
-
4500.601d
,
-
5576.736d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:04.192937"
,
-
779538.267d
,
-
5506500.533d
,
4515934.894d
,
-
2058.308d
,
-
4369.521d
,
-
5683.906d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:25.792937"
,
-
832615.368d
,
-
5598184.195d
,
4392036.13d
,
-
2046.169d
,
-
4236.279d
,
-
5788.201d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:47.392937"
,
-
885556.748d
,
-
5686883.696d
,
4265915.971d
,
-
2032.579d
,
-
4100.944d
,
-
5889.568d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:08.992937"
,
-
938326.32d
,
-
5772554.875d
,
4137638.207d
,
-
2017.537d
,
-
3963.59d
,
-
5987.957d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:30.592937"
,
-
990887.942d
,
-
5855155.21d
,
4007267.717d
,
-
2001.046d
,
-
3824.291d
,
-
6083.317d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:52.192937"
,
-
1043205.448d
,
-
5934643.836d
,
3874870.441d
,
-
1983.107d
,
-
3683.122d
,
-
6175.6d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:13.792937"
,
-
1095242.669d
,
-
6010981.571d
,
3740513.34d
,
-
1963.723d
,
-
3540.157d
,
-
6264.76d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:35.392937"
,
-
1146963.457d
,
-
6084130.93d
,
3604264.372d
,
-
1942.899d
,
-
3395.473d
,
-
6350.751d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:56.992937"
,
-
1198331.706d
,
-
6154056.146d
,
3466192.446d
,
-
1920.64d
,
-
3249.148d
,
-
6433.531d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:02:18.592937"
,
-
1249311.381d
,
-
6220723.191d
,
3326367.397d
,
-
1896.952d
,
-
3101.26d
,
-
6513.056d
);
Rugged
rugged
=
new
RuggedBuilder
().
setAlgorithm
(
AlgorithmId
.
IGNORE_DEM_USE_ELLIPSOID
).
setEllipsoid
(
EllipsoidId
.
WGS84
,
BodyRotatingFrameId
.
ITRF
).
setTimeSpan
(
absDate
,
absDate
.
shiftedBy
(
60.0
),
0.01
,
5
/
lineSensor
.
getRate
(
0
)).
setTrajectory
(
InertialFrameId
.
EME2000
,
satellitePVList
,
4
,
CartesianDerivativesFilter
.
USE_P
,
satelliteQList
,
4
,
AngularDerivativesFilter
.
USE_R
).
addLineSensor
(
lineSensor
).
build
();
Vector3D
position
=
lineSensor
.
getPosition
();
// This returns a zero vector since we set the relative position of the sensor w.r.T the satellite to 0.
AbsoluteDate
firstLineDate
=
lineSensor
.
getDate
(
0
);
Vector3D
los
=
lineSensor
.
getLos
(
firstLineDate
,
0
);
GeodeticPoint
upLeftPoint
=
rugged
.
directLocation
(
firstLineDate
,
position
,
los
);
System
.
out
.
format
(
Locale
.
US
,
"upper left point: φ = %8.3f °, λ = %8.3f °, h = %8.3f m%n"
,
FastMath
.
toDegrees
(
upLeftPoint
.
getLatitude
()),
FastMath
.
toDegrees
(
upLeftPoint
.
getLongitude
()),
upLeftPoint
.
getAltitude
());
}
catch
(
OrekitException
oe
)
{
System
.
err
.
println
(
oe
.
getLocalizedMessage
());
System
.
exit
(
1
);
}
catch
(
RuggedException
re
)
{
System
.
err
.
println
(
re
.
getLocalizedMessage
());
System
.
exit
(
1
);
}
}
private
static
void
addSatellitePV
(
TimeScale
gps
,
Frame
eme2000
,
Frame
itrf
,
ArrayList
<
TimeStampedPVCoordinates
>
satellitePVList
,
String
absDate
,
double
px
,
double
py
,
double
pz
,
double
vx
,
double
vy
,
double
vz
)
throws
OrekitException
{
AbsoluteDate
ephemerisDate
=
new
AbsoluteDate
(
absDate
,
gps
);
Vector3D
position
=
new
Vector3D
(
px
,
py
,
pz
);
Vector3D
velocity
=
new
Vector3D
(
vx
,
vy
,
vz
);
PVCoordinates
pvITRF
=
new
PVCoordinates
(
position
,
velocity
);
Transform
transform
=
itrf
.
getTransformTo
(
eme2000
,
ephemerisDate
);
Vector3D
pEME2000
=
transform
.
transformPosition
(
pvITRF
.
getPosition
());
Vector3D
vEME2000
=
transform
.
transformVector
(
pvITRF
.
getVelocity
());
satellitePVList
.
add
(
new
TimeStampedPVCoordinates
(
ephemerisDate
,
pEME2000
,
vEME2000
,
Vector3D
.
ZERO
));
}
private
static
void
addSatelliteQ
(
TimeScale
gps
,
ArrayList
<
TimeStampedAngularCoordinates
>
satelliteQList
,
String
absDate
,
double
q0
,
double
q1
,
double
q2
,
double
q3
)
{
AbsoluteDate
attitudeDate
=
new
AbsoluteDate
(
absDate
,
gps
);
Rotation
rotation
=
new
Rotation
(
q0
,
q1
,
q2
,
q3
,
true
);
TimeStampedAngularCoordinates
pair
=
new
TimeStampedAngularCoordinates
(
attitudeDate
,
rotation
,
Vector3D
.
ZERO
,
Vector3D
.
ZERO
);
satelliteQList
.
add
(
pair
);
}
}
This diff is collapsed.
Click to expand it.
src/tutorials/java/fr/cs/examples/DirectLocationWithDEM.java
0 → 100644
+
226
−
0
View file @
13c04739
/* Copyright 2013-2015 CS Systèmes d'Information
* Licensed to CS Systèmes d'Information (CS) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* CS licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
fr.cs.examples
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
org.apache.commons.math3.geometry.euclidean.threed.Rotation
;
import
org.apache.commons.math3.geometry.euclidean.threed.Vector3D
;
import
org.apache.commons.math3.util.FastMath
;
import
org.orekit.bodies.GeodeticPoint
;
import
org.orekit.data.DataProvidersManager
;
import
org.orekit.data.DirectoryCrawler
;
import
org.orekit.errors.OrekitException
;
import
org.orekit.frames.Frame
;
import
org.orekit.frames.FramesFactory
;
import
org.orekit.frames.Transform
;
import
org.orekit.rugged.api.AlgorithmId
;
import
org.orekit.rugged.api.BodyRotatingFrameId
;
import
org.orekit.rugged.api.EllipsoidId
;
import
org.orekit.rugged.api.InertialFrameId
;
import
org.orekit.rugged.api.Rugged
;
import
org.orekit.rugged.api.RuggedBuilder
;
import
org.orekit.rugged.errors.RuggedException
;
import
org.orekit.rugged.linesensor.LineSensor
;
import
org.orekit.rugged.linesensor.LinearLineDatation
;
import
org.orekit.rugged.los.LOSBuilder
;
import
org.orekit.rugged.los.FixedRotation
;
import
org.orekit.rugged.los.TimeDependentLOS
;
import
org.orekit.rugged.raster.TileUpdater
;
import
org.orekit.rugged.raster.UpdatableTile
;
import
org.orekit.rugged.utils.ParameterType
;
import
org.orekit.time.AbsoluteDate
;
import
org.orekit.time.TimeScale
;
import
org.orekit.time.TimeScalesFactory
;
import
org.orekit.utils.AngularDerivativesFilter
;
import
org.orekit.utils.CartesianDerivativesFilter
;
import
org.orekit.utils.Constants
;
import
org.orekit.utils.IERSConventions
;
import
org.orekit.utils.PVCoordinates
;
import
org.orekit.utils.TimeStampedAngularCoordinates
;
import
org.orekit.utils.TimeStampedPVCoordinates
;
public
class
DirectLocationWithDEM
{
public
static
void
main
(
String
[]
args
)
{
try
{
// Initialize Orekit, assuming an orekit-data folder is in user home directory
File
home
=
new
File
(
System
.
getProperty
(
"user.home"
));
File
orekitData
=
new
File
(
home
,
"orekit-data"
);
DataProvidersManager
.
getInstance
().
addProvider
(
new
DirectoryCrawler
(
orekitData
));
// The raw viewing direction of pixel i with respect to the instrument is defined by the vector:
List
<
Vector3D
>
rawDirs
=
new
ArrayList
<
Vector3D
>();
for
(
int
i
=
0
;
i
<
2000
;
i
++)
{
//20° field of view, 2000 pixels
rawDirs
.
add
(
new
Vector3D
(
0
d
,
i
*
FastMath
.
toRadians
(
20
)/
2000
d
,
1
d
));
}
// The instrument is oriented 10° off nadir around the X-axis, we need to rotate the viewing
// direction to obtain the line of sight in the satellite frame
LOSBuilder
losBuilder
=
new
LOSBuilder
(
rawDirs
);
losBuilder
.
addTransform
(
new
FixedRotation
(
ParameterType
.
FIXED
,
Vector3D
.
PLUS_I
,
FastMath
.
toRadians
(
10
)));
TimeDependentLOS
lineOfSight
=
losBuilder
.
build
();
// We use Orekit for handling time and dates, and Rugged for defining the datation model:
TimeScale
gps
=
TimeScalesFactory
.
getGPS
();
AbsoluteDate
absDate
=
new
AbsoluteDate
(
"2009-12-11T16:59:30.0"
,
gps
);
LinearLineDatation
lineDatation
=
new
LinearLineDatation
(
absDate
,
1
d
,
20
);
// With the LOS and the datation now defined , we can initialize a line sensor object in Rugged:
LineSensor
lineSensor
=
new
LineSensor
(
"mySensor"
,
lineDatation
,
Vector3D
.
ZERO
,
lineOfSight
);
// In our application, we simply need to know the name of the frames we are working with. Positions and
// velocities are given in the ITRF terrestrial frame, while the quaternions are given in EME2000
// inertial frame.
Frame
eme2000
=
FramesFactory
.
getEME2000
();
boolean
simpleEOP
=
true
;
// we don't want to compute tiny tidal effects at millimeter level
Frame
itrf
=
FramesFactory
.
getITRF
(
IERSConventions
.
IERS_2010
,
simpleEOP
);
ArrayList
<
TimeStampedAngularCoordinates
>
satelliteQList
=
new
ArrayList
<
TimeStampedAngularCoordinates
>();
ArrayList
<
TimeStampedPVCoordinates
>
satellitePVList
=
new
ArrayList
<
TimeStampedPVCoordinates
>();
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:58:42.592937"
,
-
0.340236d
,
0.333952d
,
-
0.844012d
,
-
0.245684d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:06.592937"
,
-
0.354773d
,
0.329336d
,
-
0.837871d
,
-
0.252281d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:30.592937"
,
-
0.369237d
,
0.324612d
,
-
0.831445d
,
-
0.258824d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T16:59:54.592937"
,
-
0.3836d
,
0.319792d
,
-
0.824743d
,
-
0.265299d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:00:18.592937"
,
-
0.397834d
,
0.314883d
,
-
0.817777d
,
-
0.271695d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:00:42.592937"
,
-
0.411912d
,
0.309895d
,
-
0.810561d
,
-
0.278001d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:06.592937"
,
-
0.42581d
,
0.304838d
,
-
0.803111d
,
-
0.284206d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:30.592937"
,
-
0.439505d
,
0.299722d
,
-
0.795442d
,
-
0.290301d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:01:54.592937"
,
-
0.452976d
,
0.294556d
,
-
0.787571d
,
-
0.296279d
);
addSatelliteQ
(
gps
,
satelliteQList
,
"2009-12-11T17:02:18.592937"
,
-
0.466207d
,
0.28935d
,
-
0.779516d
,
-
0.302131d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:58:42.592937"
,
-
726361.466d
,
-
5411878.485d
,
4637549.599d
,
-
2068.995d
,
-
4500.601d
,
-
5576.736d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:04.192937"
,
-
779538.267d
,
-
5506500.533d
,
4515934.894d
,
-
2058.308d
,
-
4369.521d
,
-
5683.906d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:25.792937"
,
-
832615.368d
,
-
5598184.195d
,
4392036.13d
,
-
2046.169d
,
-
4236.279d
,
-
5788.201d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T16:59:47.392937"
,
-
885556.748d
,
-
5686883.696d
,
4265915.971d
,
-
2032.579d
,
-
4100.944d
,
-
5889.568d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:08.992937"
,
-
938326.32d
,
-
5772554.875d
,
4137638.207d
,
-
2017.537d
,
-
3963.59d
,
-
5987.957d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:30.592937"
,
-
990887.942d
,
-
5855155.21d
,
4007267.717d
,
-
2001.046d
,
-
3824.291d
,
-
6083.317d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:00:52.192937"
,
-
1043205.448d
,
-
5934643.836d
,
3874870.441d
,
-
1983.107d
,
-
3683.122d
,
-
6175.6d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:13.792937"
,
-
1095242.669d
,
-
6010981.571d
,
3740513.34d
,
-
1963.723d
,
-
3540.157d
,
-
6264.76d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:35.392937"
,
-
1146963.457d
,
-
6084130.93d
,
3604264.372d
,
-
1942.899d
,
-
3395.473d
,
-
6350.751d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:01:56.992937"
,
-
1198331.706d
,
-
6154056.146d
,
3466192.446d
,
-
1920.64d
,
-
3249.148d
,
-
6433.531d
);
addSatellitePV
(
gps
,
eme2000
,
itrf
,
satellitePVList
,
"2009-12-11T17:02:18.592937"
,
-
1249311.381d
,
-
6220723.191d
,
3326367.397d
,
-
1896.952d
,
-
3101.26d
,
-
6513.056d
);
Rugged
rugged
=
new
RuggedBuilder
().
setAlgorithm
(
AlgorithmId
.
DUVENHAGE
).
setDigitalElevationModel
(
new
VolcanicConeElevationUpdater
(
new
GeodeticPoint
(
FastMath
.
toRadians
(
37.58
),
FastMath
.
toRadians
(-
96.95
),
2463.0
),
FastMath
.
toRadians
(
30.0
),
16.0
,
FastMath
.
toRadians
(
1.0
),
1201
),
8
).
setEllipsoid
(
EllipsoidId
.
WGS84
,
BodyRotatingFrameId
.
ITRF
).
setTimeSpan
(
absDate
,
absDate
.
shiftedBy
(
60.0
),
0.01
,
5
/
lineSensor
.
getRate
(
0
)).
setTrajectory
(
InertialFrameId
.
EME2000
,
satellitePVList
,
4
,
CartesianDerivativesFilter
.
USE_P
,
satelliteQList
,
4
,
AngularDerivativesFilter
.
USE_R
).
addLineSensor
(
lineSensor
).
build
();
Vector3D
position
=
lineSensor
.
getPosition
();
// This returns a zero vector since we set the relative position of the sensor w.r.T the satellite to 0.
AbsoluteDate
firstLineDate
=
lineSensor
.
getDate
(
0
);
Vector3D
los
=
lineSensor
.
getLos
(
firstLineDate
,
0
);
GeodeticPoint
upLeftPoint
=
rugged
.
directLocation
(
firstLineDate
,
position
,
los
);
System
.
out
.
format
(
Locale
.
US
,
"upper left point: φ = %8.3f °, λ = %8.3f °, h = %8.3f m%n"
,
FastMath
.
toDegrees
(
upLeftPoint
.
getLatitude
()),
FastMath
.
toDegrees
(
upLeftPoint
.
getLongitude
()),
upLeftPoint
.
getAltitude
());
}
catch
(
OrekitException
oe
)
{
System
.
err
.
println
(
oe
.
getLocalizedMessage
());
System
.
exit
(
1
);
}
catch
(
RuggedException
re
)
{
System
.
err
.
println
(
re
.
getLocalizedMessage
());
System
.
exit
(
1
);
}
}
private
static
void
addSatellitePV
(
TimeScale
gps
,
Frame
eme2000
,
Frame
itrf
,
ArrayList
<
TimeStampedPVCoordinates
>
satellitePVList
,
String
absDate
,
double
px
,
double
py
,
double
pz
,
double
vx
,
double
vy
,
double
vz
)
throws
OrekitException
{
AbsoluteDate
ephemerisDate
=
new
AbsoluteDate
(
absDate
,
gps
);
Vector3D
position
=
new
Vector3D
(
px
,
py
,
pz
);
Vector3D
velocity
=
new
Vector3D
(
vx
,
vy
,
vz
);
PVCoordinates
pvITRF
=
new
PVCoordinates
(
position
,
velocity
);
Transform
transform
=
itrf
.
getTransformTo
(
eme2000
,
ephemerisDate
);
Vector3D
pEME2000
=
transform
.
transformPosition
(
pvITRF
.
getPosition
());
Vector3D
vEME2000
=
transform
.
transformVector
(
pvITRF
.
getVelocity
());
satellitePVList
.
add
(
new
TimeStampedPVCoordinates
(
ephemerisDate
,
pEME2000
,
vEME2000
,
Vector3D
.
ZERO
));
}
private
static
void
addSatelliteQ
(
TimeScale
gps
,
ArrayList
<
TimeStampedAngularCoordinates
>
satelliteQList
,
String
absDate
,
double
q0
,
double
q1
,
double
q2
,
double
q3
)
{
AbsoluteDate
attitudeDate
=
new
AbsoluteDate
(
absDate
,
gps
);
Rotation
rotation
=
new
Rotation
(
q0
,
q1
,
q2
,
q3
,
true
);
TimeStampedAngularCoordinates
pair
=
new
TimeStampedAngularCoordinates
(
attitudeDate
,
rotation
,
Vector3D
.
ZERO
,
Vector3D
.
ZERO
);
satelliteQList
.
add
(
pair
);
}
private
static
class
VolcanicConeElevationUpdater
implements
TileUpdater
{
private
GeodeticPoint
summit
;
private
double
slope
;
private
double
base
;
private
double
size
;
private
int
n
;
public
VolcanicConeElevationUpdater
(
GeodeticPoint
summit
,
double
slope
,
double
base
,
double
size
,
int
n
)
{
this
.
summit
=
summit
;
this
.
slope
=
slope
;
this
.
base
=
base
;
this
.
size
=
size
;
this
.
n
=
n
;
}
public
void
updateTile
(
double
latitude
,
double
longitude
,
UpdatableTile
tile
)
throws
RuggedException
{
double
step
=
size
/
(
n
-
1
);
double
minLatitude
=
size
*
FastMath
.
floor
(
latitude
/
size
);
double
minLongitude
=
size
*
FastMath
.
floor
(
longitude
/
size
);
double
sinSlope
=
FastMath
.
sin
(
slope
);
tile
.
setGeometry
(
minLatitude
,
minLongitude
,
step
,
step
,
n
,
n
);
for
(
int
i
=
0
;
i
<
n
;
++
i
)
{
double
cellLatitude
=
minLatitude
+
i
*
step
;
for
(
int
j
=
0
;
j
<
n
;
++
j
)
{
double
cellLongitude
=
minLongitude
+
j
*
step
;
double
distance
=
Constants
.
WGS84_EARTH_EQUATORIAL_RADIUS
*
FastMath
.
hypot
(
cellLatitude
-
summit
.
getLatitude
(),
cellLongitude
-
summit
.
getLongitude
());
double
altitude
=
FastMath
.
max
(
summit
.
getAltitude
()
-
distance
*
sinSlope
,
base
);
tile
.
setElevation
(
i
,
j
,
altitude
);
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment