3
$\begingroup$

Using the library OrbitTools I can input a TLE and get back ECI coordinates. I want to find the RA DEC though, so I use

right_ascension = atan(y / x) * 180.0 / PI;

declination = acos(z/ sqrt(x* x + y * y + z * z)) * 180.0 / PI;

I figure there is likely some constant I need to add (PI/2, PI, etc.) but comparing the calculated RA to that in the TLE, there is no constant that would fix it.

I also noticed x,y,z can be very low (on the order of ~100 km in some cases) which would suggest its measured from earth's surface, so I would need to add the earth's radius to x,y,z, but this also doesn't fix my problem.

Alternatively, I tried using the built in look angle function from OrbitTools, assuming that (0,0,0) (latitude, longitude, height) would be equivalent to RA DEC but... its not. Thanks!

$\endgroup$
  • $\begingroup$ Have you factored in your location on Earth relative to the coordinates of your target? $\endgroup$ – Mick Jul 25 '18 at 7:59
  • $\begingroup$ Hi: you should always spell out your abbreviations (TLE, ECI). Don't assume everyone is aware of them. Now, what is the source of your formulas? Are they in the same unit system as the values OrbitTools accepts as input and generates as output? $\endgroup$ – Carl Witthoft Jul 25 '18 at 15:20
  • $\begingroup$ Minor thing that jumped out at me: you almost definitely need the two argument form of arctangent (atan2, not atan), otherwise your right ascension will end up in the wrong "quadrant" half the time. $\endgroup$ – barrycarter Jul 25 '18 at 17:21
1
$\begingroup$

Assuming you are calling cEci and have the units and sign conventions correct (longitudes are notoriously inconsistent as to which way is positive) then you should be able to calculate it almost as you have as:

distance = sqrt(x*x + y*y + z*z)
RA = atan2(y/x)
# Normalize right ascension into the 0..2*PI range
if ( RA < 0. ) 
  RA += PI + PI
Dec = asin(z/distance)
# Convert radians to hms and or degrees to taste

This code was taken from Bill Gray's sat_code, specifically observe.cpp. Other bits of that code handle the conversion from a latitude, longitude, height (geodetic coordinates) to a X,Y,Z vector from the Earth center to the observing site (geocentric co-ordinates) and then the rotation by the Local Mean Sidereal Time (site longitude + GMST, where GMST is the Greenwich Mean Sidereal Time) and then the 2 vectors (Geocenter->Site and Geocenter->Sattelite) are added. However it looks cEci already has this as I see references to the flattening factor and LMST.

One thing to note with TLEs is they are not a very good representation of the satellite motion/orbit over long periods of times. You should make sure your TLEs are up-to-date or use something like SGP4 to apply the perturbations and update the TLEs.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.