# sun pointing coordinate system design

I am trying to program slew maneuver procedure for a spacecraft. My goal is to define a target coordinate system that is aligned with sun vector so that the spacecraft can slew its attitude to always point at the sun.

An example I came across on the internet is describing slew maneuvers for a spacecraft, pointing earth center all the time.

Target coordinate system's first axis is defined by the earth pointing vector drawn from the center of the spacecraft. Second axis is defined by cross product of this vector by velocity vector, and third axis is the cross product of the first two axes.

This works perfectly, but when I try to implement this to generate a sun pointing spacecraft, it only works until the velocity vector is aligned with sun-to-spacecraft vector. That makes sense, because after that the direction of the velocity vector changes with respect to sun-to-spacecraft vector.

I will upload an image to show what I mean.

As you can see, the cross product of sun-to-spacecraft vector by velocity vector has 2 different direction depending on its position around the world.

As a result spacecraft makes a 180 degree rotation whenever these 2 vectors are aligned.

How can I define my target coordinate system to avoid this problem?

• "I am trying to program slew maneuver procedure for a spacecraft. My goal is to define a target coordinate system that is aligned with sun vector so that the spacecraft can slew its attitude to always point at the sun." Why do you want a whole coordinate system for this? You have your sun vector, you can point at the sun. Nov 29, 2023 at 8:16
• Because I'm using a script in which you can only set orientation of the spacecraft by creating a target coord system, Body x-y-z vectors of the spacecraft will coincide with this defined coordinate system. Nov 29, 2023 at 10:58

For a real mission, there would probably be more pointing constraints than just sun-pointing (likely for communication, thermal, or power reasons). However, for your purposes, you could do this:

• Construct a rotation between whichever body axis you need pointed at the sun and the sun pointing vector in the same coordinates. If they happen to be coincident, that's not a problem, because you're already pointing at the sun.

There are a number of ways to do this which don't bear going over here, but as a general tip, the cross product between the start vector and the end vector gives an axis to rotate around, and you can solve for the angle to rotate using the definition of the dot product.

• Apply the same rotation to all of the existing principal axes of your spacecraft body coordinate system. This results in a new coordinate system oriented toward the sun.

Not only does this simplify your choices, this eliminates any risk of happening to choose a vector that will happen to stop your calculations, because it's entirely based on the vector you want to align with in the first place.

To orient the ship to face the sun steadily, try the vector of the ship to the sun, and cross that with the velocity vector of the earth relative to the sun (not the ship relative to earth).

Alternatively, try the velocity vector of the ship relative to the sun. This would have a slight daily wobble to it, which might be hard to notice visually. The wobble would depend on its inclination and eccentricity, and even with a circular equatorial orbit it would still wobble.

Another idea is to create a vector to a distant star, such as the north star, or the whole star field, or the cosmic microwave background radiation (UPDATE: the CMBR is nonsense, see comment), and use that. That would be the least wobbly solution because even the earth gets pushed around by other planets.

I don't know which might yeild the best results for your application.

• Did you mean to say "tie the vector of the ship relative to the Sun and "tie the velocity vector of the ship relative to the Sun"? Nov 29, 2023 at 21:27
• no, i meant try, because i don't know if it will work for the asker. but yes, try tying one vector of the ship to the sun-ship vector, with the 2nd vector of the ship using the earth's velocity vector. Nov 30, 2023 at 2:21
• what does it mean to create a vector to "the cosmic microwave background radiation?" isn't that behind the entire sky? Dec 1, 2023 at 9:05
• yes. i think i've heard it's more stationary than stars or galaxies, that's why i mentioned it. but i didn't define what direction to point to. it's just the idea of stability i was getting at. Dec 2, 2023 at 9:55
• UPDATE: the CMBR is nonsense. See works by Pierre-Marie Robitaille, PhD, a Professor of Radiology at The Ohio State University Dec 17, 2023 at 22:22

For HETE-2, the onboard ACS computed in body coordinates, and, in effect, rotated the universe to put the Sun where it wanted when not in eclipse. That, of course, does not control rotation about the Sun vector.

For ops purposes, it was useful to have a complete Sun-oriented frame. We used the projection of a vector pointing at the north celestial pole on the plane perpendicular to the Sun vector as our second axis. Since from the vicinity of of Earth, the Sun can never approach the pole, that's always a good axis to use.