Sun pointing attitude mode with Nadir constraint

Hello Orekit community,

I was wondering if there is a way to model the sun pointing attitude with nadir constraint. The CelestialBodyPointed attitude aligns one of the axis with the sun and has a phasing constraint on the other.

What I would like to achieve is to align one of the axes with sun and the phasing axis needs to be constrained with nadir (instead of a fixed vector).

Thanks in advance!

There is no direct way to do it now, but a simple fix would be to change the Vector3D phasingCel parameter in the CelestialBodyPointed to PVCoordinatesProvider target and to recompute the phasingCel direction in the getAttitude method by simply computing the direction from satellite to target.

Thank you @Luc. I will surely try that out.

Along the same lines, won’t it be easy to derive it from the YawSteering attitude provider, because that attitude mode is nothing but NadirPointing with Sun phasing right? Just the opposite of what I would like to achieve I guess.

You are right, YawSteering is nadir plus Sun phasing. However, since the exact pointing
vector (Sun in one case, nadir in the other case) are different, they deserve dedicated

Thank you @Luc. I am currently heading in the similar lines suggested by you. But I feel it can be interesting to work out a generic interface, say TwoVectorAttitudeProvider, where in we need two vectors or vector providers (like PVCoordinatesProvider), one for pointing and other for phasing.

This will make sure the CelestialBodyPointed, NadirPointing and YawSteering can implement this particular interface and simplify. I will await for your thoughts on this.

This seems a very good idea to me!
Would you like to contribute it?

That sounds exciting, I would be extremely glad to contribute with some help and guidance (especially with the Field versions).

Fine. You can open an feature request on our gitlab and assign it to yourself.
For the contribution, you can either attach your code to the request or fork the
repository and make a pull request.
Please take a look at the Contributor License Agreement in the appendices
of the Orekit Governance,
as we will need one for including your contribution.