Wahba's problem seeks to find a $3 \times 3$ orthonormal rotation matrix that minimizes
$$ J(\mathbf{R}) = \frac{1}{2} \sum_{k=1}^{N} a_k\| \mathbf{w}_k - \mathbf{R} \mathbf{v}_k \|^2 $$
I want to solve a version of this for $N \in \{2,3\}$ and weights $\frac{a_k}{a_{k+1}} = \infty$. The geometrical interpretation of this is to form a rotation matrix to maximally align $w_1$ to $v_1$, then rotate about that vector to maximally align $w_2$ with $v_2$. If $w_3$ and $v_3$ are provided, then they have an effective weight of 0 and the solution is unchanged.
In this scipy.spatial.transform.Rotation issue I lay out an algorithm to solve this exactly on SO(3):
- Create orthonormal frames from the base and reference unit vectors.
# Do the below for R_w and R_v
w_3 = np.cross(w_1, w_2)
w_2 = np.cross(w_3, w_1)
R_w = Rotation.from_matrix([w_1, w_2, w_3])
- Compute the rotation between them, eg:
R = R_w * R_v.inv()
I believe it shouldn't be too hard to extend this method to higher dimensions as well. Is there a name for this problem/solution? I doubt I'm the first one to think about it.
After some more searching I found this described as an "align-constrain" process in Magner, "Extending Target Tracking Capabilities through Trajectory and Momentum Setpoint Optimization", 2018, but am having trouble finding an original source, a generalization to higher dimensions, or a previous connection to Whaba's problem. This seems like a fairly fundamental problem to kinematics, so I'd be surprised if it doesn't have earlier roots.
Update: After more searching, I believe this is best thought of as using the Gram-Schmidt process to orthogonalize the two sets of vectors as desired here, and the rotation matrix can be formed as above. For higher dimensions, this question has a more rigorous procedure. Solved, unless someone has another name for this!