Hello,
I’m new to Orekit and all things space related really. I have been asked to convert some Python code that uses pymap3d to transform AER to ECI, among other things.
If you want to compute the position vector from a ground location and a time-stamped azimuth+elevation+range measurement, please look here.
The only prerequisite is to create a TopocentricFrame attached to the longitude+latitude+altitude information, represented in Orekit by GeodeticPoint.
Note that the class TrackingCoordinates is only available in version 12.0, but you don’t have to use it to perform these calculations, it’s just a data container.
public static void main(String[] args) {
// Orekit setup data
File orekitData = new File("/Users/gormanst/orekit-data");
DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
manager.addProvider(new DirectoryCrawler(orekitData));
// Define the Earth ellipsoid (WGS84 in this case)
OneAxisEllipsoid earth = new OneAxisEllipsoid(
Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
FramesFactory.getITRF(IERSConventions.IERS_2010, true)
);
// Define the date for the transformation
var unix_timestamp = 1695854094;
Instant instant = Instant.ofEpochSecond((long) unix_timestamp);
ZonedDateTime utcDateTime = ZonedDateTime.ofInstant(instant, ZoneId.of("UTC"));
AbsoluteDate date = new AbsoluteDate(utcDateTime.getYear(),
utcDateTime.getMonthValue(),
utcDateTime.getDayOfMonth(),
utcDateTime.getHour(),
utcDateTime.getMinute(),
utcDateTime.getSecond(),
TimeScalesFactory.getUTC());
// Observer position on Earth
GeodeticPoint observer = new GeodeticPoint(38.1400000152 , -78.449999981, 190.9961962523);
// Create a topo-centric frame centered at the observer's location
TopocentricFrame topocentricFrame = new TopocentricFrame(earth, observer, "Observer");
/**
How do I utilize my AER values to get something like:
topocentricPosition = something(azimuth, elevation, range);
so I can execute the below code?
*/
Vector3D eciPosition = topocentricFrame.getTransformTo(eciFrame, date).transformPosition(topocentricPosition)
With a little help from chatGPT I cobbled together a complete example that might be what I need? Attached is my complete example code but the main functionality comes from this method.
private static PVCoordinates aerToECI(AbsoluteDate date, double observerLatitude, double observerLongitude,
double observerAltitude, double azimuth, double elevation, double range) {
// Define the Earth ellipsoid (WGS84 in this case)
OneAxisEllipsoid earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));
// Create a TopocentricFrame for the observer location
GeodeticPoint observerLocation = new GeodeticPoint(observerLatitude, observerLongitude, observerAltitude);
TopocentricFrame topocentricFrame = new TopocentricFrame(earth, observerLocation, "ObserverTopocentricFrame");
// Transform AER to ECI coordinates
PVCoordinates pvECI = topocentricFrame.getTransformTo(earth.getBodyFrame(), date)
.transformPVCoordinates(new PVCoordinates(new Vector3D(range * Math.cos(elevation) * Math.sin(azimuth),
range * Math.cos(elevation) * Math.cos(azimuth), range * Math.sin(elevation)),
new Vector3D(0, 0, 0))); // Velocity is assumed to be zero in this example
return pvECI;
}
Is this even close? It seems like the post you reference, but way more verbose.