Problems in setting timespan in rugged builder

Hi,

I am new to use rugged module (in python environment) and was testing a simple case of getting a direct location (mainly given in the tutorial) on ground. I am facing errors related to the “date is out of time span”. I could not find the reason of errors or how to fix it?. Any help will be highly appreciated.

Following are my lines of code and errors:

fov_angle = 20.0 # in degrees
Npixel = 200
delta = FastMath.toRadians(fov_angle) / Npixel
rawDirs = ArrayList()
for i in range(Npixel):
sc = (i - Npixel / 2.) * delta
rawDirs.add(Vector3D( 0.0, math.sin(sc), math.cos(sc) ))

losBuilder = LOSBuilder(rawDirs)
losBuilder.addTransform(FixedRotation(“10-degrees-rotation”, Vector3D.PLUS_I, radians(10.)))
lineOfSight = losBuilder.build()

gpsDateAsString = “2020-01-01T00:00:00.000”
absDate = AbsoluteDate(gpsDateAsString, TimeScalesFactory.getGPS())
lineDatation = LinearLineDatation(absDate, 1., 20.)
lineSensor = LineSensor(“mySensor”, lineDatation, Vector3D.ZERO, lineOfSight)

satelliteQList = ArrayList()
attitudeDate = AbsoluteDate(gpsDateAsString, TimeScalesFactory.getGPS())
rotation = Rotation(0., 0., 0., radians(10.), True) # q0 is the scalar term.
rotationRate = Vector3D.ZERO
rotationAccleration = Vector3D.ZERO
pair = TimeStampedAngularCoordinates(attitudeDate, rotation, rotationRate, rotationAccleration)
satelliteQList.add(pair)

satellitePVList = ArrayList()
ephemerisDate = AbsoluteDate(gpsDateAsString, TimeScalesFactory.getGPS())
position = Vector3D(6,644,881.750862456; 806,960.6174752496; 2,406,138.8029101086) # in ITRF, unit: m
velocity = Vector3D(-2,342.5567256115; -1,468.2756079966; 6,961.6640667119); # in ITRF, unit: m/s
pvITRF = PVCoordinates(position, velocity)
transform = ITRF.getTransformTo(inertialFrame, ephemerisDate)
pvEME2000 = transform.transformPVCoordinates(pvITRF)
satellitePVList.add(TimeStampedPVCoordinates(ephemerisDate, pvEME2000.getPosition(), pvEME2000.getVelocity(), Vector3D.ZERO))

acquisitionStartDate = absDate
acquisitionStopDate = absDate.shiftedBy(1.)
tStep = 0.1
timeTolerance = 5 / lineSensor.getRate(0.)
nbPVPoints = 1
nbQPoints = 1
ruggedbuilder = RuggedBuilder()
ruggedbuilder.setAlgorithm(AlgorithmId.IGNORE_DEM_USE_ELLIPSOID)
ruggedbuilder.setDigitalElevationModel(None, 0)
ruggedbuilder.setEllipsoid(EllipsoidId.WGS84, BodyRotatingFrameId.ITRF)
ruggedbuilder.setTimeSpan(acquisitionStartDate, acquisitionStopDate, tStep, timeTolerance)
ruggedbuilder.setTrajectory(InertialFrameId.EME2000,
satellitePVList, nbPVPoints, CartesianDerivativesFilter.USE_P,
satelliteQList, nbQPoints, AngularDerivativesFilter.USE_R)
ruggedbuilder.addLineSensor(lineSensor)

rugged = ruggedbuilder.build()

---------------------------------------------------

*******The errors are:


JavaError Traceback (most recent call last)
in
21 ruggedbuilder.addLineSensor(lineSensor)
22
—> 23 rugged = ruggedbuilder.build()

JavaError: <super: <class ‘JavaError’>, >
Java stacktrace:
org.orekit.rugged.errors.RuggedException: date 2019-12-31T23:59:43.000 is out of time span [2019-12-31T23:59:42.000, 2019-12-31T23:59:42.000] (UTC)
at org.orekit.rugged.utils.SpacecraftToObservedBody.(SpacecraftToObservedBody.java:110)
at org.orekit.rugged.api.RuggedBuilder.createInterpolator(RuggedBuilder.java:702)
at org.orekit.rugged.api.RuggedBuilder.createInterpolatorIfNeeded(RuggedBuilder.java:663)
at org.orekit.rugged.api.RuggedBuilder.build(RuggedBuilder.java:989)

The satelllitePVList list should contain several points and should at list cover the time span of your locatios requests. This list is used for interpolating sensor position and orientation. I would suggest having at least 8 points or so, to have an accurate interpolation.

Hi Luc,

Thanks a lot for your message. It worked now and it gives a location (lat-lon) for number of pixels. But I am also curious to know, if rugged can provide four corners of the ground pixel (i,j)?. I shall be thankful for your response.

Also, I am not able to import PythonTileUpdater from “org.orekit.rugged.raster”. How can I get it?. I am using python wrapper of orekit (provided by conda).

Thanks and regards
sarvesh

If you want the four corners, you can use a trick: shift you pixels by half width and half length,
then the center of a shifted pixel corresponds to the corner of four unshifted pixels.

I am not sure about Python. Beware that TileUpdater is an interface, and I think you can’t import a Java interface, I think you can only import a class that implements the interface. As TileUpdater is really bound to the tile data format, it is not provided directly by Rugged as it would add hard dependencies (like gdal for example) and we thought users would rather manage these dependencies and their versioning by themselves.

Thanks again Luc for the quick response.