Hi all,
I am new to this topic and Orekit. I am trying perform IOD using the IodGibbs method. From my understanding this method can take the following call: estimate(Frame frame, Position p1, Position p2, Position p3)
I have right ascension and declination measurements of a satellite and the latitude, longitude and altitude of the ground station. The radec measurements are from the ground station and therefore taken from a topocentric frame. As seen in the code below I use the radec measurement to create a vector of the observation and am trying to create a Vector3D position in the ECI frame so that I can input the position for 3 observations into the iodGibbs function. Could I please get some validation on whether this method of doing a frame conversion is correct? I seem to be getting coordinates that are in the same order of magnitude of the actual J2000 coordinates of the satellite at the specific epoch that I am testing… but the numbers are still fairly off as shown below.
utc_time_scale = TimeScalesFactory.getUTC()
ECI = FramesFactory.getEME2000() # Define ECI reference frame.
ECEF = FramesFactory.getITRF(IERSConventions.IERS_2010, True) # Define ECEF reference frame.
earth = OneAxisEllipsoid(
Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
ECEF,
)
def create_sat_position(ra, dec, lat, lon, alt, rng, earth: OneAxisEllipsoid, date: AbsoluteDate):
range_in_m = rng * 1000
alt_in_m = alt * 1000
ra = radians(ra)
dec = radians(dec)
lat = radians(lat)
lon = radians(lon)
# Create the topocentric frame of the observer
observer_point = GeodeticPoint(lat, lon, alt_in_m)
observer_topo_frame = TopocentricFrame(earth, observer_point, "Observer")
# Convert Ra and Dec to a direction vector in the topocentric frame
sat_direction_topo = Vector3D(
cos(dec) * cos(ra),
cos(dec) * sin(ra),
sin(dec)
)
# Transform observer's position to ECEF frame
observer_position_ecef = earth.transform(observer_point)
# Transform observer's position from ECEF frame to ECI frame.
ecef_to_eci_transform = FramesFactory.getITRF(IERSConventions.IERS_2010, True).getStaticTransformTo(ECI, date)
observer_position_eci = ecef_to_eci_transform.transformPosition(observer_position_ecef)
# Transform direction from topocentric to ECI frame
topocentric_to_eci_transform = observer_topo_frame.getStaticTransformTo(ECI, date)
satellite_direction_eci = topocentric_to_eci_transform.transformVector(sat_direction_topo)
# Scale the direction vector by the range
satellite_relative_position_eci = satellite_direction_eci.scalarMultiply(range_in_m)
# Combine observer's ECEF position with the satellite's relative position
satellite_position_eci = observer_position_eci.add(satellite_relative_position_eci)
# The satellite's position in ECEF coordinates
print("Satellite Position in ECI (X, Y, Z):", satellite_position_eci)
g = input()
Position = create_sat_position(
327.850223,
36.185382,
38.994194,
-104.6365,
2.237,
1120.4,
earth,
AbsoluteDate(2023, 6, 23, 4, 46, 38.674272, utc_time_scale),
)
I am expecting a position output of X=-1873.775, Y = -4683.677, Z = 4658.770 (km) but I am getting:
Satellite Position in ECI (X, Y, Z): {-2,421,665.6076448183; -5,302,058.939778156; 4,041,127.0943075754}
Thank you for your time.