Finding Sat roll angle to topocentric frame

Hello!

I just want to say firstly, I know that no one is making you help us here, so I want to thank you up front for your time!!

What I want to do is find out what roll angle is needed for a satellite to see a Topocentric frame. I’m having trouble figuring out how to find the roll angle from a satellite position to a Topocentric frame translated to the sat’s orbital frame. To determine the desired angle I have this (borrowed from the forums here):

LofOffset VVLH = new LofOffset(s.getFrame(), LOFType.VVLH);
SpacecraftState converted = new SpacecraftState(s.getOrbit(), VVLH.getAttitude(s.getOrbit(), s.getDate(), s.getFrame()));
		    	
TimeStampedPVCoordinates pv2 = converted.toTransform().transformPVCoordinates(farmFrame.getPVCoordinates(s.getDate(), s.getFrame()));

double xAngleFromSpaceCraft = Vector3D.angle(pv2.getPosition(), Vector3D.PLUS_K);

From what I understand, this should give us an angle from the Topocentric frame to the z axis in the satellite’s orbital frame, which should be pointing towards the earth.

Right now, i’m triggering this code when the Topocentric frame triggers a field of view detector with a Nadir attitude. The angle I get appears to be off. Furthermore, when I make the field of view detector larger (like increasing the half-aperture angle) the ‘angle’ I get from the code above grows too. Is there a way to do what I am trying to do?

How should I be thinking about this problem?

Thanks again for your support on everything we space junkies try to do here.
Orekit 10.3

Thank you for your time!!!

Evan

Hi Evan,

I think the answer depends on other constraints on the satellite attitude or how you define the roll angle. For example, the boresight of an instrument could be made to point in any direction using only pitch and yaw.

One option could be to create a Rotation that rotates from the LOF frame to the correct attitude. Then the Rotation class has methods to get the angles according to different conventions. E.g.

new Rotation(boresightInBodyFrame, directionToGroundSite).getAngles(...)

Note that this example leaves the clock angle around the boresight unspecified. It can be defined using the four vector constructor of Rotation.

Perhaps another convention would be to project the direction to the ground site to the radial/cross-track plane and then take the angle w.r.t. the nadir vector.

Best Regards,
Evan