A method for avoiding singularities in the movement of CMGs in an array of
CMGs in a spacecraft includes a first step where a maneuver command to
rotate a spacecraft orientation is received. Then, the torque needed to
rotate the spacecraft's orientation is determined. Then, the torque is
integrated to determine a momentum path. The momentum path is decomposed
into a sequence of straight line segments. For each line segment, a unit
vector along the straight line segments is determined. Then, it is
determined if there is a continuous path connecting a start point and an
end point of the line segment in a plane perpendicular to the unit
vector. For each point along the path in the plane perpendicular to the
unit vector, a set of gimbal angles is determined.