DavenportQMethod¶
giant.stellar_opnav.estimators
:
This class estimates the rotation quaternion that best aligns unit vectors from one frame with unit vectors in another frame using Davenport’s Q-Method solution to Wahba’s problem.
This class is relatively easy to use. When you initialize the class, simply specify the
target_frame_directions
unit vectors (\(\textbf{a}_i\) from theestimators
documentation) as a 3xn array of vectors (each column is a vector) and thebase_frame_directions
unit vectors (\(\textbf{b}_i\) from theestimators
documentation) as a 3xn array of vectors (each column is a vector). Here thetarget_frame_directions
unit vectors are expressed in the end frame (the frame you want to rotate to) and thebase_frame_directions
unit vectors are expressed in the starting frame (the frame you want to rotate from). You can also leave these inputs to beNone
and then set the attributes directly. Each column oftarget_frame_directions
andbase_frame_directions
should correspond to each other as a pair (i.e. column 1 intarget_frame_directions
is paired with column ` inbase_frame_directions
.Optionally, either at initialization or by setting the attributes, you can set the
weighted_estimation
andweights
values to specify whether to use weighted estimation or not, and what weights to use if you are using weighted estimation. When performing weighted estimation you should setweighted_estimation
toTrue
and specifyweights
to be a length n array of the weights to apply to each unit vector pair.Once the appropriate values are set, the
estimate()
method can be called to compute the attitude quaternion that best aligns the two frames. When theestimate()
method completes, the solved for rotation can be found as anRotation
object in therotation
attribute of the class. In addition, the formal post fit covariance matrix of the estimate can be found in thepost_fit_covariance
attribute. Note that as will all attitude quaternions, the post fit covariance matrix will be rank deficient since there are only 3 true degrees of freedom.A description of the math behind the DavenportQMethod Solution can be found here.
- Parameters:
target_frame_directions (ndarray) – A 3xn array of unit vectors expressed in the camera frame
base_frame_directions (ndarray) – A 3xn array of unit vectors expressed in the catalogue frame corresponding the the
target_frame_directions
unit vectorsweighted_estimation (bool) – A flag specifying whether to weight the estimation routine by unit vector pairs
weights (ndarray) – The weights to apply to the unit vectors if the
weighted_estimation
flag is set toTrue
.
The unit vectors in the target frame as a 3xn array (\(\mathbf{a}_i\)).
Each column should represent the pair of the corresponding column in
base_frame_directions
.
The unit vectors in the base frame as a 3xn array (\(\mathbf{b}_i\)).
Each column should represent the pair of the corresponding column in
target_frame_directions
.
A length n array of the weights to apply if weighted_estimation is True. (\(w_i\))
Each element should represent the pair of the corresponding column in
target_frame_directions
andbase_frame_directions
.
A flag specifying whether to use weights in the estimation of the rotation.
The solved for rotation that best aligns the
base_frame_directions
andtarget_frame_directions
after callingestimate()
.This rotation goes go from the base frame to the target frame.
If
estimate()
has not been called yet then this will be set toNone
.
This returns the post-fit covariance after calling the
estimate
method as a 4x4 numpy array.This should be only be called after the estimate method has been called, otherwise it raises a ValueError
Summary of Methods
This method computes the residuals between the aligned unit vectors according to Wahba's problem definitions. |
|
This method solves for the rotation matrix that best aligns the unit vectors in |