# Attitude determination with phototransistors and magnetometer

This was originally in Engineering Stack Exchange but someone suggested posting it here.

This is for a University Engineering project. The project is the design of small satellite which would be tested in the environment pictured, with lights acting as a fake sun & star and an induced magnetic field. The satellite must be able to determine where it is facing and then be able to rotate to face a specified location, i.e a latitude/longitude on the map.

I know that I need to use two different frames, one fixed one with the x axis pointing directly at the map and then the body frame which will stay with the satellite. Before the test we are given the elevation/azimuth of the sun/star and so I have two vectors in the fixed frame to those, the magnetic field is always vertical. Through the sensors I can then determine vectors to the sun, star and magnetic field in the body frame. Note that the satellite only rotates about the CG and never moves.

Question 1 - Am I correct in thinking that I would represent attitude as a rotation from the fixed frame to the body frame?

Question 2 - How can I determine that rotation, or other representation, using the described vectors to the sun, star and magnetic field?

• Welcome to space! Please edit your question and indicate what specifically you are asking about. Are you asking how to transform one frame to another, i.e. just how to do the math? Or are you asking what is the definition of 'attitude'? Please ask a specific question. Apr 4, 2021 at 14:02
• @OrganicMarble apologies, I have edited to lay out the two specific questions I need answering Apr 4, 2021 at 15:57
• You should improve your terminology. A vector or euclidean vector has a length and direction, a unit vector has a direction only, the unit length is 1. The sensors you use deliver only a direction but no length or position. An object in 3D space has 3 angles to describe the orientation in space. The distance information, 5m and 3 m in figure do not make sense.
– Uwe
Apr 4, 2021 at 20:40
• @Uwe The 5m and 3m are fixed distances to the sun and star, i.e. no matter the value of elevation and azimuth (the 80 deg and 110 deg pictured) they are that distance from the center of the satellite. Thus I know the vector length to those, however I would assume I only require the direction vectors as I am concerned with orientation/attitude Apr 4, 2021 at 21:01