 # Use of TimeStampedAngularCoordinates solely with quaternion knowledge

Hi everyone,

I’m using an external file to provide the attitude of the spacecraft and I used to provide a full description of the angular state (rotation, angular velocity and angular acceleration), using this definition: `TimeStampedAngularCoordinates​(AbsoluteDate date, Rotation rotation, Vector3D rotationRate, Vector3D rotationAcceleration)`. I would like to change this to a provider only providing the rotation with a quaternion.

I believe I should be able to build such a provider with `TimeStampedAngularCoordinates​(AbsoluteDate date, FieldRotation<DerivativeStructure> r)` but I am very much not used to the kind of structure `FieldRotation<DerivativeStructure>` and don’t know how to build it from the knowledge of a list of `q = [q0, q1, q2, q3]`.

How you have an example of how to implement it? It would be very helpful!

Thank you very much.

Kind regards,

B.

Hi @benoist,

From what I understand you want to build your provider from a list of quaternions right ? There is a dedicated class in Orekit for this, the TabulatedProvider class. Check also the related test class for examples.

If you still need to develop your own provider you will find a lot of example of attitude provider in the attitude package of Orekit. Here you will find out how to implement the `Field` method.

Regards,
Maxime

Hi @benoist and @MaximeJ

Does your file give you an information only about the quaternions (q0, q1, q2 and q3) or the quaternions plus their derivatives (q0, q1, q2, q3, q0Dot, q1Dot, q2Dot and q3Dot)?

For the first case, you have to build the `TimeStampedAngularCoordinates​` object as followed:

``````        // Build the needed objects
final AbsoluteDate date = // The date of the quaternions in the file
final boolean normalized = false; // You have to change this value to true if the quaternion are not normalized
final Rotation rotation = new Rotation(q0, q1, q2 q3, normalized);

// Return
final TimeStampedAngularCoordinates tsac =  TimeStampedAngularCoordinates(date, rotation, Vector3D.ZERO, Vector3D.ZERO);
``````

For the second case, you can build the `TimeStampedAngularCoordinates​` object by using `FieldRotation<DerivativeStructure>` as followed:

``````        // Date
final AbsoluteDate date = // The date of the quaternions in the file
// Quaternion components
final boolean normalized = false; // You have to change this value to true if the quaternion are not normalized
final DSFactory factory = new DSFactory(1, 1);
final DerivativeStructure q0DS = factory.build(q0, q0Dot);
final DerivativeStructure q1DS = factory.build(q1, q1Dot);
final DerivativeStructure q2DS = factory.build(q2, q2Dot);
final DerivativeStructure q3DS = factory.build(q3, q3Dot);

// Rotation
final FieldRotation<DerivativeStructure> fieldRotation = new FieldRotation<>(q0DS, q1DS, q2DS, q3DS, normalized);

// Return
return new TimeStampedAngularCoordinates(date, fieldRotation);
``````

Is your file a CCSDS Attitude Data Message file ? If yes, we will add, probably next week, a parser for this type of files. Before Orekit 10.2 the parser will be available in our develop branch. The parser will directly give you the list of `TimeStampedAngularCoordinated` to build the `TabulatedProvider`.

Hi @MaximeJ and @bcazabonne,