Skip to content
Snippets Groups Projects
Commit 06c5ed0a authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Added detection of wrong position/line-of-sight that misses the ground.

parent 2767ddaa
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,7 @@ public enum RuggedMessages implements Localizable { ...@@ -57,6 +57,7 @@ public enum RuggedMessages implements Localizable {
UNINITIALIZED_CONTEXT("general context has not been initialized"), UNINITIALIZED_CONTEXT("general context has not been initialized"),
EMPTY_TILE("tile is empty: {0} ⨉ {1}"), EMPTY_TILE("tile is empty: {0} ⨉ {1}"),
UNKNOWN_SENSOR("unknown sensor {0}"), UNKNOWN_SENSOR("unknown sensor {0}"),
LINE_OF_SIGHT_DOES_NOT_REACH_GROUND("line-of-sight does not reach ground"),
LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE("line-of-sight never crosses latitude {0}"), LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE("line-of-sight never crosses latitude {0}"),
LINE_OF_SIGHT_NEVER_CROSSES_LONGITUDE("line-of-sight never crosses longitude {0}"), LINE_OF_SIGHT_NEVER_CROSSES_LONGITUDE("line-of-sight never crosses longitude {0}"),
LINE_OF_SIGHT_NEVER_CROSSES_ALTITUDE("line-of-sight never crosses altitude {0}"), LINE_OF_SIGHT_NEVER_CROSSES_ALTITUDE("line-of-sight never crosses altitude {0}"),
......
...@@ -72,6 +72,9 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm { ...@@ -72,6 +72,9 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm {
// compute intersection with ellipsoid // compute intersection with ellipsoid
final GeodeticPoint gp0 = ellipsoid.pointOnGround(position, los); final GeodeticPoint gp0 = ellipsoid.pointOnGround(position, los);
if (gp0 == null) {
throw new RuggedException(RuggedMessages.LINE_OF_SIGHT_DOES_NOT_REACH_GROUND);
}
// locate the entry tile along the line-of-sight // locate the entry tile along the line-of-sight
MinMaxTreeTile tile = cache.getTile(gp0.getLatitude(), gp0.getLongitude()); MinMaxTreeTile tile = cache.getTile(gp0.getLatitude(), gp0.getLongitude());
......
...@@ -19,6 +19,9 @@ EMPTY_TILE = tile is empty: {0} ⨉ {1} ...@@ -19,6 +19,9 @@ EMPTY_TILE = tile is empty: {0} ⨉ {1}
# unknown sensor {0} # unknown sensor {0}
UNKNOWN_SENSOR = unknown sensor {0} UNKNOWN_SENSOR = unknown sensor {0}
# line-of-sight does not reach ground
LINE_OF_SIGHT_DOES_NOT_REACH_GROUND = line-of-sight does not reach ground
# line-of-sight never crosses latitude {0} # line-of-sight never crosses latitude {0}
LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE = line-of-sight never crosses latitude {0} LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE = line-of-sight never crosses latitude {0}
......
...@@ -19,6 +19,9 @@ EMPTY_TILE = la tuile est vide : {0} ⨉ {1} ...@@ -19,6 +19,9 @@ EMPTY_TILE = la tuile est vide : {0} ⨉ {1}
# unknown sensor {0} # unknown sensor {0}
UNKNOWN_SENSOR = capteur {0} inconnu UNKNOWN_SENSOR = capteur {0} inconnu
# line-of-sight does not reach ground
LINE_OF_SIGHT_DOES_NOT_REACH_GROUND = la ligne de visée n''atteint pas le sol
# line-of-sight never crosses latitude {0} # line-of-sight never crosses latitude {0}
LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE = la ligne de visée ne franchit jamais la latitude {0} LINE_OF_SIGHT_NEVER_CROSSES_LATITUDE = la ligne de visée ne franchit jamais la latitude {0}
......
...@@ -29,7 +29,7 @@ public class RuggedMessagesTest { ...@@ -29,7 +29,7 @@ public class RuggedMessagesTest {
@Test @Test
public void testMessageNumber() { public void testMessageNumber() {
Assert.assertEquals(13, RuggedMessages.values().length); Assert.assertEquals(14, RuggedMessages.values().length);
} }
@Test @Test
......
...@@ -18,10 +18,12 @@ package org.orekit.rugged.intersection.duvenhage; ...@@ -18,10 +18,12 @@ package org.orekit.rugged.intersection.duvenhage;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.orekit.bodies.GeodeticPoint; import org.orekit.bodies.GeodeticPoint;
import org.orekit.errors.OrekitException; import org.orekit.errors.OrekitException;
import org.orekit.rugged.api.RuggedException; import org.orekit.rugged.api.RuggedException;
import org.orekit.rugged.api.RuggedMessages;
import org.orekit.rugged.intersection.AbstractAlgorithmTest; import org.orekit.rugged.intersection.AbstractAlgorithmTest;
import org.orekit.rugged.intersection.IntersectionAlgorithm; import org.orekit.rugged.intersection.IntersectionAlgorithm;
import org.orekit.rugged.intersection.duvenhage.DuvenhageAlgorithm; import org.orekit.rugged.intersection.duvenhage.DuvenhageAlgorithm;
...@@ -55,4 +57,18 @@ public class DuvenhageAlgorithmTest extends AbstractAlgorithmTest { ...@@ -55,4 +57,18 @@ public class DuvenhageAlgorithmTest extends AbstractAlgorithmTest {
checkIntersection(position, los, intersection); checkIntersection(position, los, intersection);
} }
@Test
public void testWrongPositionMissesGround() throws RuggedException, OrekitException {
setUpMayonVolcanoContext();
final IntersectionAlgorithm algorithm = createAlgorithm(updater, 8);
Vector3D position = new Vector3D(7.551889113912788E9, -3.173692685491814E10, 1.5727517321541348E9);
Vector3D los = new Vector3D(0.010401349221417867, -0.17836068905951286, 0.9839101973923178);
try {
algorithm.intersection(earth, position, los);
Assert.fail("an exception should have been thrown");
} catch (RuggedException re) {
Assert.assertEquals(RuggedMessages.LINE_OF_SIGHT_DOES_NOT_REACH_GROUND, re.getSpecifier());
}
}
} }
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
<body> <body>
<release version="1.0" date="TBD" <release version="1.0" date="TBD"
description="TBD"> description="TBD">
<action dev="luc" type="fix">
Added detection of wrong position/line-of-sight that misses the ground.
</action>
<action dev="luc" type="add"> <action dev="luc" type="add">
Added a way to reuse transform interpolator from one run to another Added a way to reuse transform interpolator from one run to another
by dumping its state into a file, thus avoiding costly initialization. by dumping its state into a file, thus avoiding costly initialization.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment