Table of contents
CSPICE_SPKGPS computes the geometric position 3-vector
of a target body relative to an observing body.
Given:
targ the standard NAIF ID code for a target body.
help, targ
LONG = Scalar
et the epoch (ephemeris time) at which the position of the target
body is to be computed.
help, et
DOUBLE = Scalar
ref the name of the reference frame to which the vectors returned by
the routine should be rotated.
help, ref
STRING = Scalar
This may be any frame supported by the SPICELIB routine REFCHG.
obs the standard NAIF ID code for an observing body.
help, obs
LONG = Scalar
the call:
cspice_spkgps, targ, et, ref, obs, pos, ltime
returns:
pos a 3-dimensional vector that contains the position of the target
body, relative to the observing body.
help, pos
DOUBLE = Array[3]
This vector is rotated into the specified reference frame.
Units are always km.
ltime the one-way light time from the observing body to the geometric
position of the target body at the specified epoch.
help, ltime
DOUBLE = Scalar
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Return the geometric position vector of Mars (499) as seen from
Earth (399) in the J2000 frame and the one-way light time
between them at the epoch July 4, 2003 11:00 AM PST.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File: spkgps_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The kernels shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
In order for an application to use this meta-kernel, the
kernels referenced here must be present in the user's
current working directory.
The names and contents of the kernels referenced
by this meta-kernel are as follows:
File name Contents
--------- --------
de430.bsp Planetary ephemeris
mar097.bsp Mars satellite ephemeris
naif0011.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de430.bsp',
'mar097.bsp',
'naif0011.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO spkgps_ex1
;;
;; Load kernels.
;;
cspice_furnsh, 'spkgps_ex1.tm'
;;
;; Define parameters for a position lookup:
;;
target = 499
epoch = 'July 4, 2003 11:00 AM PST'
frame = 'J2000'
observer = 399
;;
;; Convert the epoch to ephemeris time.
;;
cspice_str2et, epoch, et
;;
;; Look-up the state for the defined parameters.
;;
cspice_spkgps, target, et, frame, observer, $
pos, ltime
;;
;; Output...
;;
print, 'The position of : ', target
print, 'As observed from : ', observer
print, 'In reference frame : ', frame
print, 'At epoch : ', epoch
print
print, FORMAT='(A,3F18.6)', 'R (km): ', pos
print
print, 'Light time (s) between observer and target: ', ltime
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
The position of : 499
As observed from : 399
In reference frame : J2000
At epoch : July 4, 2003 11:00 AM PST
R (km): 73826216.435288 -27128030.732406 -18741973.868287
Light time (s) between observer and target: 269.70265
cspice_spkgps computes the geometric position, T(t), of the target
body and the geometric position, O(t), of the observing body
relative to the first common center of motion. Subtracting
O(t) from T(t) gives the geometric position of the target
body relative to the observer.
center ----- O(t)
| /
| /
| /
| / T(t) - O(t)
| /
T(t)
The one-way light time, `tau', is given by
| T(t) - O(t) |
tau = -----------------
C
For example, if the observing body is -94, the Mars Observer
spacecraft, and the target body is 401, Phobos, then the
first common center is probably 4, the Mars Barycenter.
O(t) is the position of -94 relative to 4 and T(t) is the
position of 401 relative to 4.
The center could also be the Solar System Barycenter, body 0.
For example, if the observer is 399, Earth, and the target
is 299, Venus, then O(t) would be the position of 399 relative
to 0 and T(t) would be the position of 299 relative to 0.
Ephemeris data from more than one segment may be required
to determine the positions of the target body and observer
relative to a common center. cspice_spkgps reads as many segments
as necessary, from as many files as necessary, using files
that have been loaded by previous calls to cspice_spklef (load
ephemeris file).
cspice_spkgps is similar to cspice_spkgeo but returns geometric positions
only.
1) If insufficient ephemeris data has been loaded to compute
the necessary positions, the error SPICE(SPKINSUFFDATA) is
signaled by a routine in the call tree of this routine.
2) If any of the input arguments, `targ', `et', `ref' or `obs',
is undefined, an error is signaled by the IDL error handling
system.
3) If any of the input arguments, `targ', `et', `ref' or `obs',
is not of the expected type, or it does not have the expected
dimensions and size, an error is signaled by the Icy
interface.
4) If any of the output arguments, `pos' or `ltime', is not a
named variable, an error is signaled by the Icy interface.
See -Restrictions.
1) The ephemeris files to be used by cspice_spkgps must be loaded
by cspice_spklef before cspice_spkgps is called.
ICY.REQ
SPK.REQ
FRAMES.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.1, 01-JUN-2021 (JDR)
Added argument type and size information in the -I/O section.
Edited the header to comply with NAIF standard. Added example's
problem statement and meta-kernel. Reformatted example's output
and added call to cspice_kclear.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
geometric position of one body relative to another
|