cspice_pxfrm2 |
|||

## AbstractCSPICE_PXFRM2 returns the 3x3 matrix that transforms position vectors from one specified frame at a specified epoch to another specified frame at another specified epoch. ## I/OGiven: from name of a reference frame recognized by spicelib that corresponds to the input 'etfrom'. [1,m] = size(from); char = class(from) to name of a reference frame recognized by spicelib that corresponds to the desired output at 'etto''. [1,l] = size(to); char = class(to) etfrom epoch in ephemeris seconds past the epoch of J2000 (TDB) corresponding to the 'from' reference frame. [1,n] = size(etfrom); double = class(etfrom) etto epoch in ephemeris seconds past the epoch of J2000 (TDB) that corresponds to the 'to' reference frame. [1,n] = size(etto); double = class(etto) the call: result = ## ExamplesAny 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. Suppose that MGS has taken a picture of Mars at time 'etrec' with the MOC narrow angle camera. We want to know the latitude and longitude associated with two pixels projected to Mars' surface: the boresight and one along the boundary of the field of view (FOV). Due to light time, the photons taken in the picture left Mars at time 'etemit', when Mars was at a different state than at time 'etrec'. In order to solve this problem, we could use the 'cspice_sincpt' routine for both pixels, but this would be slow. Instead, we will assume that the light time for each pixel is the same. We will call 'cspice_sincpt' once to get the light time and surface point associated with the boresight. Then, we will rotate the first FOV boundary vector from the camera frame at 'etrec' to the body-fixed Mars frame at 'etemit', and call the faster routine 'cspice_surfpt' to retrieve the surface point for the FOV boundary vector. This example problem could be extended to find the latitude and longitude associated with every pixel in an instrument's field of view, but this example is simplified to only solve for two pixels: the boresight and one along the boundary of the field of view. Assumptions: 1) The light times from the surface points in the camera's field of view to the camera are equal. 2) The camera offset from the center of gravity of the spacecraft is zero. If the data are more accurate and precise, this assumption can be easily discarded. 3) An ellipsoid shape model for the target body is sufficient. 4) The boundary field of view vector returned from 'cspice_getfov' is associated with a boundary field of view pixel. If this example were extended to include a geometric camera model, this assumption would not be needed since the direction vectors associated with each pixel would be calculated from the geometric camera model. Example program starts here. % --------------------- Program Setup --------------------- metakr = 'mgs_ex.tm'; camera = 'MGS_MOC_NA'; NCORNR = 4; ABCORR = 'CN+S'; % % Load kernels % cspice_furnsh( metakr ); % % Convert the time the picture was taken from a % UTC time string to seconds past J2000, TDB. % etrec = cspice_str2et( '2003 OCT 13 06:00:00 UTC' ); % % Assume the one-way light times from different % surface points on Mars to MGS within the camera's % FOV are equal. This means the photons that make % up different pixels were all emitted from Mars at % 'etemit' and received by MGS at 'etrec'. It would be % slow to process images using 'cspice_sincpt' for every % pixel. Instead, we will use 'cspice_sincpt' on the % boresight pixel and use 'cspice_surfpt' for the first FOV % boundary pixel. If this example program were extended % to include all of the camera's pixels, 'cspice_surfpt' would % be used for the remaining pixels. % % Get the MGS MOC Narrow angle camera (MGS_MOC_NA) % ID code. Then look up the field of view (FOV) % parameters by calling 'cspice_getfov'. % [camid, found] = cspice_bodn2c( camera ); if ( ~found ) txt = sprintf( ['SPICE(NOTRANSLATION)' ... 'Could not find ID code for instrument %s.' ], ... camera ); error( txt ) end % % 'cspice_getfov' will return the name of the camera-fixed frame % in the string OBSREF, the camera boresight vector in % the array BSIGHT, and the FOV corner vectors in the % array BOUNDS. % [shape, obsref, bsight, bounds] = cspice_getfov( camid, NCORNR); fprintf( '\nObservation Reference Frame: %s\n', obsref ); % % ----------- Boresight Surface Intercept ----------- % % Retrieve the time, surface intercept point, and vector % from MGS to the boresight surface intercept point % in IAU_MARS coordinates. % [ spoint, etemit, srfvec, found ] = ... cspice_sincpt( 'Ellipsoid', 'Mars', etrec, 'IAU_MARS', ... ABCORR, 'MGS' , obsref, bsight ); if ( ~found ) txt = sprintf( ['SPICE(NOINTERCEPT)' ... 'Intercept not found for boresight vector.' ]); error( txt ) end % % Convert the intersection point of the boresight % vector and Mars from rectangular into latitudinal % coordinates. Convert radians to degrees. % [ radius, lon, lat ] = cspice_reclat( spoint ); lon = lon * cspice_dpr; lat = lat * cspice_dpr; fprintf( ['\n' ... 'Boresight surface intercept coordinates:\n' ... ' Radius (km) : %f\n' ... ' Latitude (deg): %f\n' ... ' Longitude (deg): %f\n' ], ... radius, lat, lon ); % % ------ 1st Boundary FOV Surface Intercept (cspice_surfpt) ----- % % Now we will transform the first FOV corner vector into the % IAU_MARS frame so the surface intercept point can be % calculated using cspice_surfpt, which is faster than % cspice_subpnt. % % If this example program were extended to include all % of the pixels in the camera's FOV, a few steps, such as % finding the rotation matrix from the camera frame to the % IAU_MARS frame, looking up the semi-axis values for Mars, % and finding the position of MGS with respect to Mars could % be done once and used for every pixel. % % Find the rotation matrix from the ray's reference % frame at the time the photons were received (etrec) % to IAU_MARS at the time the photons were emitted % (etemit). % [rotate] = ## ParticularsNone. ## Required ReadingFor important details concerning this module's function, please refer to the CSPICE routine pxfrm2_c. MICE.REQ FRAMES ## Version-Mice Version 1.0.0 12-MAR-2012 SCK (JPL) ## Index_EntriesPosition transformation matrix for different epochs |

Wed Apr 5 18:00:34 2017