Printable Version of Topic

Click here to view this topic in its original format

Unmanned Spaceflight.com _ Cassini general discussion and science results _ Cassini SPICE problem

Posted by: Bjorn Jonsson May 14 2006, 12:22 AM

This is a slightly unusual topic wink.gif.

I have been writing a utility program to extract lots of information from the Cassini SPICE kernels, for example determining exactly what Cassini's cameras 'see' at a given time. I'm using the CSPICE toolkit.

I have had no problems determining Cassini's location in either the J2000 or the IAU_<target> reference frames and subsequently the subspacecraft longitude/latitude, distance and illumination geometry using spkezr_c, subpt_c etc.

However, determining the camera pointing and then using it to determine the location of the subspacecraft point in the image as well as the north azimuth has been problematic. This is trivial if I know the camera angles (right ascension, declination and twist), see e.g. appendix A in Cooper et. al., Icarus 181 (2006), 223-234. However if I don't know these angles I need to extract a C-matrix from one of the CK kernel files. This works but these files contain only the rotation of the entire spacecraft (this is not unexpected since the instruments are body fixed so this can be used to determine where they are looking). However, I have had problems using this C-matrix to determine the exact viewing geometry. I need to somehow 'convert' it to a C-matrix that gives me the camera angles. My code is very close to working but one of the camera angles is always off by 180 degrees. I will probably eventually figure this out but I know there are some people here who have done something similar, in particular jmknapp (however, he has been inactive for several weeks now) so I decided to try asking here.

Has anyone here done something similar to what I'm doing ?

Posted by: pat May 15 2006, 01:47 PM

QUOTE (Bjorn Jonsson @ May 14 2006, 01:22 AM) *
This is a slightly unusual topic wink.gif.

I have been writing a utility program to extract lots of information from the Cassini SPICE kernels, for example determining exactly what Cassini's cameras 'see' at a given time. I'm using the CSPICE toolkit.

I have had no problems determining Cassini's location in either the J2000 or the IAU_<target> reference frames and subsequently the subspacecraft longitude/latitude, distance and illumination geometry using spkezr_c, subpt_c etc.

However, determining the camera pointing and then using it to determine the location of the subspacecraft point in the image as well as the north azimuth has been problematic. This is trivial if I know the camera angles (right ascension, declination and twist), see e.g. appendix A in Cooper et. al., Icarus 181 (2006), 223-234. However if I don't know these angles I need to extract a C-matrix from one of the CK kernel files. This works but these files contain only the rotation of the entire spacecraft (this is not unexpected since the instruments are body fixed so this can be used to determine where they are looking). However, I have had problems using this C-matrix to determine the exact viewing geometry. I need to somehow 'convert' it to a C-matrix that gives me the camera angles. My code is very close to working but one of the camera angles is always off by 180 degrees. I will probably eventually figure this out but I know there are some people here who have done something similar, in particular jmknapp (however, he has been inactive for several weeks now) so I decided to try asking here.

Has anyone here done something similar to what I'm doing ?


The problem is probably due to the camera frame definition JPL uses (and defined in the Cassini SPICE frames kernel) being different to the camera frame thats actually being used by the ISS scientists. The transformation from the 'JPL frame' to the frame used by the ISS people involves an additional 180 deg rotation about the camera frame 'Z' axis after the transformation from the spacecraft bus frame (which is the frame of the C-kernels) to the 'JPL camera frame' as per the Cassini SPICE frames kernel.

The coordinate system being used by the ISS team members has the origin in the top left of the image with line(y) increasing downwards and sample(x) increasing to the right. This is the same as the Voyager convention.

For some weird reason the 'JPL camera frame' has line increasing upwards and sample increasing to the left

Like all the imaging scientists you are probably used to the Voyager convention. Adding an an additional 180 deg rotation around the camera frame 'Z' axis to the transformation will probably solve your problem. This is what the software being used by ISS team members does.

Posted by: tallbear May 16 2006, 08:59 PM

QUOTE (pat @ May 15 2006, 06:47 AM) *
The problem is probably due to the camera frame definition JPL uses (and defined in the Cassini SPICE frames kernel) being different to the camera frame thats actually being used by the ISS scientists. The transformation from the 'JPL frame' to the frame used by the ISS people involves an additional 180 deg rotation about the camera frame 'Z' axis after the transformation from the spacecraft bus frame (which is the frame of the C-kernels) to the 'JPL camera frame' as per the Cassini SPICE frames kernel.

The coordinate system being used by the ISS team members has the origin in the top left of the image with line(y) increasing downwards and sample(x) increasing to the right. This is the same as the Voyager convention.

For some weird reason the 'JPL camera frame' has line increasing upwards and sample increasing to the left

Like all the imaging scientists you are probably used to the Voyager convention. Adding an an additional 180 deg rotation around the camera frame 'Z' axis to the transformation will probably solve your problem. This is what the software being used by ISS team members does.






The Instrument Frame kernels document this system...

for furthere instructions on how to do the transforms look at the SPICE instructional materials
... doing the transform correctly using the SPICE sytem should get you the correct pointing
... just load the correct instrument frame kernel and do the transform....

sort of sounds like you are not doing the transform correctly ...
but I'd strongly suggest re reading the SPICE docs on the use of the instrument
fram kernels...

Posted by: Bjorn Jonsson May 16 2006, 09:39 PM

Thanks for very useful bits of information. It was very nice to get a (probable) confirmation of what I was starting to suspect. I didn't want to add any 'magic constants' (e.g. 180 degrees) to my code without first knowing what was going on - when one needs these it often means that something is wrong somewhere.

My code now apparently works perfectly and returns from the SPICE kernels *exactly* the camera angles I expected for the PDS images I have checked my code against.


EDIT: Despite the fact that everything seems to work I strongly suspect my code could be streamlined a bit once I have read more of the SPICE docs.

Posted by: tallbear May 17 2006, 04:33 AM

QUOTE (Bjorn Jonsson @ May 16 2006, 02:39 PM) *
EDIT: Despite the fact that everything seems to work I strongly suspect my code could be streamlined a bit once I have read more of the SPICE docs.




<GGG> I was shown a bit ago how replacing many of the simpler SPICE transforms and calculations with your own code could greatly speed up SPICE based programs.... The code is super ROBUST but it can slow things down... I'ts probably good to start out using the SPICE modules just to get things correct ... but thenif you need more speed and can do a bunch of the transforms on your own....pulling out some of the super robust SPICE routines and replacing thiem with simpler routines can really speed a program up...

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)