Get rotation from local orbital frame to satellite frame


I would like to get the rotation from the local orbital frame to the satellite frame at a given time. I have PVCoordinates of the satellite at a date, and I created a frame representing his attitude. I had two ideas in mind: either to create a frame for the LOF and use getTransformTo to find the transform from a frame to another, or to use a function like rotationFromLOF which gives the rotation of my satellite frame according to a LOFType enumerate.
At the end I want to retrieve a Rotation object.

Thank you for your help.

Hi @Alex_l welcome!
You can look at the toTransform (or toStaticTransform) from the SpacecraftState class.

Thanks @luc for the fast answer.
As I understand the toTransform from SpacecraftState takes a states and returns the Transform to the Spacecraft Frame. As it does not takes arguments, is it used like this : currentState.toTransform() where currentState is a SpacecraftState object.
In this case, where is my LOF ?

The transform returned by toTransform is from inertial frame to spacecraft frame.
You can compute a transform from LOF to inertial frame to using rotationFromInertial in the LOFType enumerate, reverting the rotation, and building a transform containing only this reversed rotation.
Then you can build the transform from LOF to spacecraft frame by combining the transform from LOF to inertial and the transform from inertial to spacecraft frame.

I better understand now. But I do not manage to get rotationFromInertial working. I implemented it like this : LOFType.LVLH.rotationFromInertial(date, pvInertial) because I suppose this method as to be applied on a LOFType object.

try LOFType.LVLH.rotationFromInertial(pvInertial).

It worked, thank you very much. This help me a lot.