From fe25cef2acd4c131f3548f460e28159c742c85b6 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe <luc@orekit.org> Date: Sat, 20 Dec 2014 16:17:18 +0100 Subject: [PATCH] Added a builder for line-of-sight lists. --- .../java/org/orekit/rugged/los/FixedLOS.java | 2 +- .../org/orekit/rugged/los/LOSBuilder.java | 58 +++++++++++++ src/site/markdown/design/overview.md | 2 +- src/site/markdown/design/technical-choices.md | 13 +-- src/site/xdoc/changes.xml | 3 + .../orekit/rugged/api/RuggedBuilderTest.java | 8 +- .../org/orekit/rugged/api/RuggedTest.java | 86 ++++++++++--------- .../SensorMeanPlaneCrossingTest.java | 25 +++--- 8 files changed, 131 insertions(+), 66 deletions(-) create mode 100644 src/main/java/org/orekit/rugged/los/LOSBuilder.java diff --git a/src/main/java/org/orekit/rugged/los/FixedLOS.java b/src/main/java/org/orekit/rugged/los/FixedLOS.java index 4ffc2435..e3f15d0f 100644 --- a/src/main/java/org/orekit/rugged/los/FixedLOS.java +++ b/src/main/java/org/orekit/rugged/los/FixedLOS.java @@ -24,7 +24,7 @@ import org.orekit.time.AbsoluteDate; * @see LineSensor * @author Luc Maisonobe */ -public class FixedLOS implements TimeDependentLOS { +class FixedLOS implements TimeDependentLOS { /** Fixed direction for los. */ private final Vector3D los; diff --git a/src/main/java/org/orekit/rugged/los/LOSBuilder.java b/src/main/java/org/orekit/rugged/los/LOSBuilder.java new file mode 100644 index 00000000..b54ee572 --- /dev/null +++ b/src/main/java/org/orekit/rugged/los/LOSBuilder.java @@ -0,0 +1,58 @@ +/* Copyright 2013-2014 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 org.orekit.rugged.los; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; + +/** Builder for lines-of-sight list. + * <p> + * This builder aims at creating lines-of-sight directions which are + * the result of several transforms applied to an initial list of raw + * directions. It therefore allows to take into account the optical + * path due to mirrors and the alignments of sensors frames with respect + * to a spacecraft. + * </p> + * @see TimeDependentLOS + * @author Luc Maisonobe + */ +public class LOSBuilder { + + /** Raw fixed ine-of-sights. */ + public final List<Vector3D> rawLOS; + + /** Create builder. + * @param rawLOS raw fixed lines-of-sight + */ + public LOSBuilder(final List<Vector3D> rawLOS) { + this.rawLOS = rawLOS; + } + + /** Build a list of transformed lines-of-sight. + * @return list of transformed lines of sight + */ + public List<TimeDependentLOS> build() { + final List<TimeDependentLOS> los = new ArrayList<TimeDependentLOS>(rawLOS.size()); + for (final Vector3D raw : rawLOS) { + los.add(new FixedLOS(raw)); + } + return los; + } + +} diff --git a/src/site/markdown/design/overview.md b/src/site/markdown/design/overview.md index 0ffb4943..00e28293 100644 --- a/src/site/markdown/design/overview.md +++ b/src/site/markdown/design/overview.md @@ -68,6 +68,6 @@ The following table sorts out the various topics between the various layers. | Grid-post elevation model | Rugged |Only raster elevation models are supported |Triangulated Irregular Network elevation model | Not supported |If vector elevation models are needed, they must be converted to raster form in order to be used | Geoid computation | Not in version 1 |The first version only supports Digital Elevation Models computed with respect to a reference ellipsoid. If needed, this feature could be added after version 1, either at Rugged or Orekit level, using Orekit gravity fields -| Time-dependent deformations | Interface/Rugged |The caller must supply a simple line-of-sight model (typically polynomial) that will be applied +| Time-dependent deformations | Interface/Rugged |Simple line-of-sight models (typically polynomial) can be used | Calibration |Image processing or interface|The calibration phase remains at the mission-specific caller level (pixels geometry, clock synchronization …), the caller is required to provide the already calibrated line of sights | DEM file parsing | Interface |The elevation models are dedicated to the mission and there are several formats (DTED, GeoTIFF, raw data …).Rugged only deals with raw elevation on small latitude/longitude cells diff --git a/src/site/markdown/design/technical-choices.md b/src/site/markdown/design/technical-choices.md index 3c076291..1fe60dbf 100644 --- a/src/site/markdown/design/technical-choices.md +++ b/src/site/markdown/design/technical-choices.md @@ -128,17 +128,20 @@ Optical path ### Inside spacecraft At spacecraft level, the optical path is folded due to the various reflections and positions of the sensors with respect -to the spacecraft center of mass. This path is considered fixed in spacecraft frame, i.e. no time-dependent or thermal -deformation effects are considered. Following this assumption, the path can be virtually unfolded using the laws of optical +to the spacecraft center of mass. Following this assumption, the path can be virtually unfolded using the laws of optical geometry and replaced by a straight line in spacecraft vicinity, with virtual pixels locations and lines of sights defined by simple vectors with respect to the center of mass. As both position and orientation are considered, this implies that the pixels are not considered exactly co-located with the spacecraft center of mass, the offset is typically of meter order of magnitude. If for example we consider a 3m long spacecraft with an instrument is on the front (+X), the offset would be about 1.5m if center of mass were at spacecraft mid-length. -This path unfolding is done once at geometry loading by the interface layer above the Rugged library, so all further computation -are done with simple straight lines. Of course, if the spacecraft definition file does not include position informations, only -the various reflections are taken into account and the location of the sensor is co-located with spacecraft center of mass. +This path unfolding is done once at geometry loading by the interface layer above the Rugged library, using the services +provided by Rugged line-of-sight builder, so all further computation are done with simple straight lines. Of course, if +the spacecraft definition file does not include position informations, only the various reflections are taken into account +and the location of the sensor is co-located with spacecraft center of mass. + +The various transformed applied when building the lines-of-sight may be time-dependent to take into account slow variations +like thermo-elastic effects. Their parameters can also be estimated in calibration phases. ### Free space travel diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 9f0e9d2f..0f213112 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -23,6 +23,9 @@ <release version="1.0" date="TBD" description="TBD"> <action dev="luc" type="add" > + Added a builder for line-of-sight lists. + </action> + <action dev="luc" type="update" > Reorganized packages. </action> <action dev="luc" type="add" > diff --git a/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java b/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java index 781ddba0..0fa8263f 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java @@ -69,7 +69,7 @@ import org.orekit.rugged.errors.RuggedMessages; import org.orekit.rugged.linesensor.LineDatation; import org.orekit.rugged.linesensor.LineSensor; import org.orekit.rugged.linesensor.LinearLineDatation; -import org.orekit.rugged.los.FixedLOS; +import org.orekit.rugged.los.LOSBuilder; import org.orekit.rugged.los.TimeDependentLOS; import org.orekit.rugged.raster.RandomLandscapeUpdater; import org.orekit.rugged.raster.TileUpdater; @@ -663,12 +663,12 @@ public class RuggedBuilderTest { } private List<TimeDependentLOS> createLOSPerfectLine(Vector3D center, Vector3D normal, double halfAperture, int n) { - List<TimeDependentLOS> list = new ArrayList<TimeDependentLOS>(n); + List<Vector3D> list = new ArrayList<Vector3D>(n); for (int i = 0; i < n; ++i) { double alpha = (halfAperture * (2 * i + 1 - n)) / (n - 1); - list.add(new FixedLOS(new Rotation(normal, alpha).applyTo(center))); + list.add(new Rotation(normal, alpha).applyTo(center)); } - return list; + return new LOSBuilder(list).build(); } private TimeStampedPVCoordinates createPV(AbsoluteDate t0, double dt, diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java index fcbcfbe3..d493f4ac 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java @@ -71,7 +71,7 @@ import org.orekit.rugged.linesensor.LineDatation; import org.orekit.rugged.linesensor.LineSensor; import org.orekit.rugged.linesensor.LinearLineDatation; import org.orekit.rugged.linesensor.SensorPixel; -import org.orekit.rugged.los.FixedLOS; +import org.orekit.rugged.los.LOSBuilder; import org.orekit.rugged.los.TimeDependentLOS; import org.orekit.rugged.raster.RandomLandscapeUpdater; import org.orekit.rugged.raster.TileUpdater; @@ -733,39 +733,40 @@ public class RuggedTest { satellitePVList, 8, CartesianDerivativesFilter.USE_PV, satelliteQList, 8, AngularDerivativesFilter.USE_R); - List<TimeDependentLOS> lineOfSight = new ArrayList<TimeDependentLOS>(); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181530, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181518, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181505, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181492, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181480, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181467, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181455, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181442, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181430, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181417, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181405, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.181392, 1d).normalize())); - - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149762, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149749, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149737, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149724, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149712, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149699, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149686, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149674, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149661, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149649, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149636, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149624, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149611, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149599, 1d).normalize())); - lineOfSight.add(new FixedLOS(new Vector3D(-0.011204, 0.149586, 1d).normalize())); + List<Vector3D> lineOfSight = new ArrayList<Vector3D>(); + lineOfSight.add(new Vector3D(-0.011204, 0.181530, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181518, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181505, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181492, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181480, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181467, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181455, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181442, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181430, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181417, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181405, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.181392, 1d).normalize()); + + lineOfSight.add(new Vector3D(-0.011204, 0.149762, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149749, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149737, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149724, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149712, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149699, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149686, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149674, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149661, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149649, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149636, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149624, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149611, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149599, 1d).normalize()); + lineOfSight.add(new Vector3D(-0.011204, 0.149586, 1d).normalize()); AbsoluteDate absDate = new AbsoluteDate("2009-12-11T16:58:51.593", gps); LinearLineDatation lineDatation = new LinearLineDatation(absDate, 1d, 638.5696040868454); - LineSensor lineSensor = new LineSensor("perfect-line", lineDatation, offset, lineOfSight); + LineSensor lineSensor = new LineSensor("perfect-line", lineDatation, offset, + new LOSBuilder(lineOfSight).build()); builder.addLineSensor(lineSensor); Rugged rugged = builder.build(); @@ -881,14 +882,15 @@ public class RuggedTest { addSatellitePV(gps, eme2000, itrf, satellitePVList, "2013-07-07T17:20:39.857531", -931933.933d, -6354591.778d, 3173886.968d, -1693.833d, -3045.116d, -6595.024d); - List<TimeDependentLOS> lineOfSight = new ArrayList<TimeDependentLOS>(); - lineOfSight.add(new FixedLOS(new Vector3D(0.0046536264d, -0.1851800945d, 1d))); - lineOfSight.add(new FixedLOS(new Vector3D(0.0000001251d, -0.0002815246d, 1d))); - lineOfSight.add(new FixedLOS(new Vector3D(0.0046694108d, 0.1853863933d, 1d))); + List<Vector3D> lineOfSight = new ArrayList<Vector3D>(); + lineOfSight.add(new Vector3D(0.0046536264d, -0.1851800945d, 1d)); + lineOfSight.add(new Vector3D(0.0000001251d, -0.0002815246d, 1d)); + lineOfSight.add(new Vector3D(0.0046694108d, 0.1853863933d, 1d)); AbsoluteDate absDate = new AbsoluteDate("2013-07-07T17:16:36.857", gps); LinearLineDatation lineDatation = new LinearLineDatation(absDate, 0.03125d, 19.95565693384045); - LineSensor lineSensor = new LineSensor("QUICK_LOOK", lineDatation, offset, lineOfSight); + LineSensor lineSensor = new LineSensor("QUICK_LOOK", lineDatation, offset, + new LOSBuilder(lineOfSight).build()); Rugged rugged = new RuggedBuilder(). setAlgorithm(AlgorithmId.IGNORE_DEM_USE_ELLIPSOID). setEllipsoid(EllipsoidId.WGS84, BodyRotatingFrameId.ITRF). @@ -1232,25 +1234,25 @@ public class RuggedTest { } private List<TimeDependentLOS> createLOSPerfectLine(Vector3D center, Vector3D normal, double halfAperture, int n) { - List<TimeDependentLOS> list = new ArrayList<TimeDependentLOS>(n); + List<Vector3D> list = new ArrayList<Vector3D>(n); for (int i = 0; i < n; ++i) { double alpha = (halfAperture * (2 * i + 1 - n)) / (n - 1); - list.add(new FixedLOS(new Rotation(normal, alpha).applyTo(center))); + list.add(new Rotation(normal, alpha).applyTo(center)); } - return list; + return new LOSBuilder(list).build(); } private List<TimeDependentLOS> createLOSCurvedLine(Vector3D center, Vector3D normal, double halfAperture, double sagitta, int n) { Vector3D u = Vector3D.crossProduct(center, normal); - List<TimeDependentLOS> list = new ArrayList<TimeDependentLOS>(n); + List<Vector3D> list = new ArrayList<Vector3D>(n); for (int i = 0; i < n; ++i) { double x = (2.0 * i + 1.0 - n) / (n - 1); double alpha = x * halfAperture; double beta = x * x * sagitta; - list.add(new FixedLOS(new Rotation(normal, alpha).applyTo(new Rotation(u, beta).applyTo(center)))); + list.add(new Rotation(normal, alpha).applyTo(new Rotation(u, beta).applyTo(center))); } - return list; + return new LOSBuilder(list).build(); } private List<TimeStampedPVCoordinates> orbitToPV(Orbit orbit, BodyShape earth, diff --git a/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java b/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java index 845d725e..c5bc5322 100644 --- a/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java +++ b/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java @@ -48,8 +48,7 @@ import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.linesensor.LineSensor; import org.orekit.rugged.linesensor.LinearLineDatation; import org.orekit.rugged.linesensor.SensorMeanPlaneCrossing; -import org.orekit.rugged.los.FixedLOS; -import org.orekit.rugged.los.TimeDependentLOS; +import org.orekit.rugged.los.LOSBuilder; import org.orekit.rugged.utils.SpacecraftToObservedBody; import org.orekit.time.AbsoluteDate; import org.orekit.utils.AngularDerivativesFilter; @@ -64,21 +63,21 @@ public class SensorMeanPlaneCrossingTest { @Test public void testPerfectLine() throws RuggedException, OrekitException { - final Vector3D position = new Vector3D(1.5, Vector3D.PLUS_I); - final Vector3D normal = Vector3D.PLUS_I; - final Vector3D fovCenter = Vector3D.PLUS_K; - final Vector3D cross = Vector3D.crossProduct(normal, fovCenter); + final Vector3D position = new Vector3D(1.5, Vector3D.PLUS_I); + final Vector3D normal = Vector3D.PLUS_I; + final Vector3D fovCenter = Vector3D.PLUS_K; + final Vector3D cross = Vector3D.crossProduct(normal, fovCenter); // build lists of pixels regularly spread on a perfect plane - final List<TimeDependentLOS> los = new ArrayList<TimeDependentLOS>(); + final List<Vector3D> los = new ArrayList<Vector3D>(); for (int i = -1000; i <= 1000; ++i) { final double alpha = i * 0.17 / 1000; - los.add(new FixedLOS(new Vector3D(FastMath.cos(alpha), fovCenter, FastMath.sin(alpha), cross))); + los.add(new Vector3D(FastMath.cos(alpha), fovCenter, FastMath.sin(alpha), cross)); } final LineSensor sensor = new LineSensor("perfect line", - new LinearLineDatation(AbsoluteDate.J2000_EPOCH, 0.0, 1.0 / 1.5e-3), - position, los); + new LinearLineDatation(AbsoluteDate.J2000_EPOCH, 0.0, 1.0 / 1.5e-3), + position, new LOSBuilder(los).build()); Assert.assertEquals("perfect line", sensor.getName()); Assert.assertEquals(AbsoluteDate.J2000_EPOCH, sensor.getDate(0.0)); @@ -100,7 +99,7 @@ public class SensorMeanPlaneCrossingTest { final Vector3D cross = Vector3D.crossProduct(normal, fovCenter); // build lists of pixels regularly spread on a perfect plane - final List<TimeDependentLOS> los = new ArrayList<TimeDependentLOS>(); + final List<Vector3D> los = new ArrayList<Vector3D>(); for (int i = -1000; i <= 1000; ++i) { final double alpha = i * 0.17 / 10 + 1.0e-5 * random.nextDouble(); final double delta = 1.0e-5 * random.nextDouble(); @@ -108,12 +107,12 @@ public class SensorMeanPlaneCrossingTest { final double sA = FastMath.sin(alpha); final double cD = FastMath.cos(delta); final double sD = FastMath.sin(delta); - los.add(new FixedLOS(new Vector3D(cA * cD, fovCenter, sA * cD, cross, sD, normal))); + los.add(new Vector3D(cA * cD, fovCenter, sA * cD, cross, sD, normal)); } final LineSensor sensor = new LineSensor("noisy line", new LinearLineDatation(AbsoluteDate.J2000_EPOCH, 0.0, 1.0 / 1.5e-3), - position, los); + position, new LOSBuilder(los).build()); Assert.assertEquals("noisy line", sensor.getName()); Assert.assertEquals(AbsoluteDate.J2000_EPOCH, sensor.getDate(0.0)); -- GitLab