Hello!
I want to rotate satellites at a certain time to take photos on the target point on the ground.
I tried the following methods, but it was inconsistent with the results of STK.
var pointingVector = new GroundPointTarget(OrekitUtil.EARTH.transform(new GeodeticPoint(lon,lat,alt)));
AlignedAndConstrained attitudeProvider = new AlignedAndConstrained(
Vector3D.PLUS_K,
pointingVector,
Vector3D.PLUS_I,
PredefinedTarget.EARTH,
OrekitUtil.SUN,
OrekitUtil.EARTH
);
propagator.setAttitudeProvider(attitudeProvider);
I’m not sure about STK setting VVLH.X. In VVLH, it is -Z that points to Earth, not +X. Could you select as “Reference Vector” directly something like Earth center instead of using an intermediate local orbital frame like VVLH (or LVLH, or VNC, or anything similar).
Hello, thank you for your reply.
I want the+Z-axis of the satellite to point towards the ground target, and the+X-axis to be as close to the direction of flight as possible, so that the satellite’s rotation angle is minimized.
But I tried setting the reference vectors to Earth, East, Sun, Nadir, North, Velocity, etc. in STK, but the results were not correct. Is there any error in my code?
Your code seems consistent with what you want, i.e. +Z towards target that is a constant vector in Earth frame and +X as close as possible to velocity. I guess in STK you should also put +X and velocity as the constraint.
Beware that STK uses the convention (q₁, q₂, q₃, q₄) to represent the quaternion (i.e. the scalar component is named q₄ and is the fourth component) whereas Orekit/Hipparchus use the convention (q₀, q₁, q₂, q₃) (i.e. the scalar component is named q₀ and is the first component). So when comparing, you should reorder the components (the values don’t change, q₄=q₀, only the order changes). Another point when comparing quaternions is that the global sign is irrelevant, so one program could compute (q₀, q₁, q₂, q₃) and the other one could compute (-q₀, -q₁, -q₂, -q₃), this would still represent the same rotation.
Thank you for your patient guidance!
I also noticed the difference in expression between quaternions in STK and in Orekit. The current issue is that there is a significant difference between my calculation results and those in STK。 The +Z-axis also does not face the ground target point, which did not achieve my goal.
This is my first time using Orekit and I am not very familiar with this aspect. Is there any other way to achieve my goal?
What you could do in order to track down what happens is to first ignore the quaternions itself and just rely on Orekit API to check everything is fine.
You can for example extract the Transform from inertial frame to spacecraft frame and combine it with the transform between Earth frame and inertial frame to have the complete transform between Earth frame and spacecraft frame. Then you could check where your Z axis points on Earth and compare this to your target.
Here is one way to achieve this verification, assuming state contains some intermediate state computed by the propagator, i.e. something that contains both orbit and attitude data consistent with the propagator settings:
Note also that the attitude output from a propagator is always based on inertial frame. If you compare with an attitude for example computed with reference to an Earth frame, you will have to convert it.