pds-data-dictionaries / PDS4-LDD-Issue-Repo

Issue repository for tracking all PDS4 Discipline Dictionary-related issues, new feature requests, and releases.
Apache License 2.0
2 stars 1 forks source link

[ldd-geom] Add generalized quaternion class #263

Open neese opened 1 year ago

neese commented 1 year ago

Issue Type This is an enhancement for ldd-geom

Describe the issue identified (if applicable) NEAR Multi-Spectral Imager (MSI) PDS3 product labels have a quaternion to describe the spacecraft pointing. To migrate this PDS3 data set to PDS4, an appropriate quaternion class will be needed. in the geometry dictionary looks structurally sufficient to map the PDS3 keyword, but it is in class and is used to describe the display orientation of the image, and thus cannot be used for spacecraft orientation.

Describe the solution you'd like Add the quaternion class to a class where it can be used for spacecraft pointing. Adding it to the orbiter class may be a good approach as it could make it available for more general use, not restricted specifically to spacecraft pointing.

Describe alternatives you've considered N/A

LDD Dictionary Version For bug fixes, note the LDD dictionary version in question.

PDS4 IM Version Current IM version

Need-by Date We are in progress on migrating the NEAR MSI data sets to PDS4 and request to have the enhancement included in the December 2023 build.

Additional context Add any other context or examples products

cgobat commented 9 months ago

Just FYI, I believe the existing Quaternion_Plus_To_From class is capable of doing what you describe (if I understand your use case correctly). For example:

<geom:Quaternion_Plus_To_From>
    <geom:qcos>1.0</geom:qcos>
    <geom:qsin1>0.0</geom:qsin1>
    <geom:qsin2>0.0</geom:qsin2>
    <geom:qsin3>0.0</geom:qsin3>
    <geom:Rotate_From>
        <geom:frame_spice_name>J2000</geom:frame_spice_name>
        <geom:name>J2000, EME 2000, ICRF, or whatever you want to call it</geom:name>
    </geom:Rotate_From>
    <!-- ↑ or vice versa ↓ -->
    <geom:Rotate_To>
        <geom:frame_spice_name>NEAR_SC_BUS</geom:frame_spice_name> <!-- or maybe _PRIME ? -->
        <geom:name>NEAR Spacecraft</geom:name>
    </geom:Rotate_To>
</geom:Quaternion_Plus_To_From>

Rotate_From and Rotate_To can specify any two frames—it doesn't have to be image orientation-specific.

rgdeen commented 9 months ago

In the Mars surface world we use quaternions all over the place to represent spacecraft orientation as well as device orientation w.r.t. the spacecraft. For example:

<geom:Coordinate_Space_Definition>
    <local_identifier>
        ROVER_NAV_FRAME_9_0_510_1934_1294_952_4992_1712_82_42
    </local_identifier>
...
    <geom:Coordinate_Space_Present>...</geom:Coordinate_Space_Present>
...
    <geom:Quaternion_Plus_Direction>
        <geom:qcos>0.42841</geom:qcos>
        <geom:qsin1>0.0715653</geom:qsin1>
        <geom:qsin2>0.0258216</geom:qsin2>
        <geom:qsin3>-0.900376</geom:qsin3>
        <geom:rotation_direction>Forward</geom:rotation_direction>
    </geom:Quaternion_Plus_Direction>
...
    <geom:Coordinate_Space_Reference>...</geom:Coordinate_Space_Reference>

which defines a coordinate space in terms of another, which implicitly gives the spacecraft orientation. In this case the Rover frame being defined, identified in Coordinate_Space_Present, is rigidly attached to the rover and the Site frame reference, identified in Coordinate_Space_Reference, is a north-east-down frame).

Quaternion_Plus_Direction, like Quaternion_Plus_To_From, derives from Quaternion_Base.