ON THE AUTOMATIC GENERATION OF RECURSIVE ATTITUDE DETERMINATION ALGORITHMS Presented at the AAS GN&C Conference in Breckenridge, CO, on February the 7th, 2017 by Tucker McClure @ An Uncommon Lab
WHAT ARE THE GOALS? EXAMINE METHODOLOGY Early Single Run Attitude Error (~deg) 0.4 MRP 1 ▸ Create a filter early with 0.2 MRP 2 MRP 3 0 95% ST Boresight Errors very little wasted effort. 95% ST Cross Errors -0.2 0 20 40 60 Time (s) 0.2 Bias Error (deg/s) b 1 0.1 ▸ Create a more mature b 2 0 b 3 -0.1 95% Bias Errors filter later. -0.2 0 10 20 30 40 50 60 Time (s) ▸ Try variations on the filter. Later Mature Results 1000-Run Normalized Mean Estimate Error 0.1 0.08 Nondimensionalized State Error 0.06 1000-run NE for x 1 1000-run NE for x 2 0.04 1000-run NE for x 3 0.02 1000-run NE for x 4 1000-run NE for x 5 0 1000-run NE for x 6 -0.02 95.0% Bounds (Theoretical) 95.0% Bounds (Empirical) -0.04 -0.06 -0.08 0 20 40 60 Time (s)
WHAT KIND OF FILTER? CLASSIC ATTITUDE ERROR & BIAS ESTIMATOR ▸ Filter state is attitude error and gyro bias ▸ Gyro for propagation ▸ Star tracker for attitude measurements This example is kept simple to focus on the process, but the process works well when the problem is more complicated.
WHAT ARE THE DEVELOPMENT PATHS FOR DIFFERENT FILTERS? UKF EKF UDKF Spacecraft Simulator Filter Wrapper (Attitude Propagation) Propagation & Propagation Jacobian Observation Functions & Effective Process Noise UKF Implementation EKF Implementation UDKF Implementation Unit Testing Unit Testing Unit Testing Integration & Testing in Simulation
WHAT ARE THE DEVELOPMENT PATHS FOR DIFFERENT FILTERS? UKF EKF UDKF Spacecraft Simulator SUNK COSTS Filter Wrapper (Attitude Propagation) Propagation & Propagation Jacobian Observation Functions & Effective Process Noise UKF Implementation EKF Implementation UDKF Implementation Unit Testing Unit Testing Unit Testing Integration & Testing in Simulation
WHAT ARE THE DEVELOPMENT PATHS FOR DIFFERENT FILTERS? UKF EKF UDKF Spacecraft Simulator SUNK COSTS Filter Wrapper (Attitude Propagation) Propagation & Propagation Jacobian Observation Functions & Effective Process Noise AUTOMATED UKF Implementation EKF Implementation UDKF Implementation Unit Testing Unit Testing Unit Testing Integration & Testing in Simulation
WHAT ARE THE DEVELOPMENT PATHS FOR DIFFERENT FILTERS? UKF EKF UDKF Spacecraft Simulator SUNK COSTS Filter Wrapper (Attitude Propagation) MANUAL Propagation & Propagation Jacobian Observation Functions & Effective Process Noise AUTOMATED UKF Implementation EKF Implementation UDKF Implementation Unit Testing Unit Testing Unit Testing Integration & Testing in Simulation
HOW ARE ALGORITHMS GENERATED? POTENTIAL FILTER GENERATORS D E T C E L AUTOFILTER E *kf S Generates custom code; has run in embedded environment. Filter architecture is emergent, Uses template for architecture. not specified. Pieces together best “snippets” Fills in architecture with best that fit user’s “assumptions”. components for user’s functions. Integrates user’s functions Manipulates fully symbolic as black boxes. user functions. Currently supported; has flight Not funded; Dr. Johann Schumann heritage may be able to provide code. J. Whittle & J. Schumann, “Automating the Implementation of Kalman Filter Algorithms”
UKF
WHAT’S THE FILTER WRAPPER DO? FILTER WRAPPER: PROPAGATE, RUN FILTER, & CORRECT ▸ Subtract estimated bias from gyro measurement. ▸ Propagate the attitude. ▸ Calculate measurement residual (innovation vector). ▸ Run the UKF/EKF/UDKF filter. ▸ Correct the propagated attitude and bias.
WHAT’S NEEDED FOR THE UKF? TWO FUNCTIONS FOR THE UKF f h Follows Crassidis & Markley, “Unscented Filtering for Spacecraft Attitude Estimation”.
WHAT’S NEEDED FOR THE UKF? TWO FUNCTIONS FOR THE UKF ẟ x i,k = f ( ẟ x i,k -1, 𝜉 i,k -1 ) ▸ Propagation function ▸ Given hypothetical attitude error, bias, and gyro noise for last sample, determine current attitude error and bias (~six lines). ẟ z i,k = h ( ẟ x i,k ) ▸ Observation function ▸ Given hypothetical attitude error and bias, determine current measurement error (one line). Follows Crassidis & Markley, “Unscented Filtering for Spacecraft Attitude Estimation”
HOW TO IMPLEMENT THE UKF? UKF IMPLEMENTATION ▸ Sigma point propagation function name: f ▸ Sigma point observation function name: h ▸ Process noise covariance: Q (constant in workspace) ▸ Measurement noise covariance: R (constant in workspace) ▸ Measurement noise: additive (simplifies calculations) ▸ Specify when a new measurement is available. ▸ Output innovation covariance (for analysis).
HOW TO IMPLEMENT THE UKF? GENERATED FILES ▸ Initialization function (sets parameters, constants) ▸ Filter function (performs one step of the filter algorithm) ▸ Example simulation (used to unit-test filter) ▸ Example Monte-Carlo wrapper (used to unit-test filter consistency)
DOES IT WORK? UKF UNIT TESTING ▸ Does filter appear to work? ▸ Is the covariance matrix consistent with real errors? 50-Run Normalized Estimation Error Squared 7 0.02 0.04 State 1 State 2 0 0.02 6 -0.02 0 0 5 10 15 0 5 10 15 5 Time Time 10 -3 0 2 4 State 3 State 4 50-run Average NE -0.02 0 95.0% Bounds (Theoretical) 95.0% Bounds (Empirical) 3 -0.04 -2 0 5 10 15 0 5 10 15 Time Time 2 10 -3 10 -3 1 2 State 5 State 6 Truth 0 0 1 Estimate -1 -2 0 5 10 15 0 5 10 15 0 0 5 10 15 Time Time Time (s)
HOW’D WE DO? Single Run UKF SIMULATION RESULTS Attitude Error (~deg) 0.4 MRP 1 0.2 MRP 2 ▸ Results are as expected. MRP 3 0 95% ST Boresight Errors 95% ST Cross Errors ▸ Filter is consistent. -0.2 0 20 40 60 Time (s) 0.2 Bias Error (deg/s) MC Results b 1 0.1 b 2 0 b 3 1000-Run Normalized Estimate Error Squared 8 -0.1 95% Bias Errors -0.2 0 10 20 30 40 50 60 Total Error Squared 6 Time (s) 1000-run Average NE 4 95.0% Bounds (Theoretical) 95.0% Bounds (Empirical) 2 0 0 10 20 30 40 50 60 Time (s)
EKF
WHY TRY AN EKF? EKF VS. UKF ▸ Embedded performance ▸ EKFs are much faster, especially when using sequential scalar updates. ▸ EKFs require less RAM.
WHAT’S NEEDED FOR THE EKF? TWO MATRICES FOR THE EKF Q eff F Follows Lefferts, Markley, & Shuster, “Kalman Filtering for Spacecraft Attitude Estimation”.
WHAT’S NEEDED FOR THE EKF? TWO MATRICES FOR THE EKF ẟ x k ≅ F ẟ x k -1 ▸ Propagation Jacobian Function ▸ Produces Jacobian matrix for given state. ▸ Easy for this example problem; more difficult for bigger states. Q eff = F q Q F q T ▸ Effective process noise ▸ Based on gyro’s angular random walk and bias random walk. Follows Lefferts, Markley, & Shuster, “Kalman Filtering for Spacecraft Attitude Estimation”
ARE THE JACOBIAN AND PROCESS NOISE RIGHT? QUICK VERIFICATION OF JACOBIAN AND PROCESS NOISE ▸ Can use finite-difference method with the UKF’s propagation function to spot check Jacobian and effective process noise covariance matrix — a nice advantage to starting with the UKF.
HOW TO IMPLEMENT THE EKF? EKF IMPLEMENTATION ▸ Propagation function: none (filter wrapper does this) ▸ Propagation Jacobian function: F (our custom function) ▸ Process noise covariance: Q eff (constant in workspace) ▸ Observation function: first 3 indices of error state (simplifies calculation) ▸ Measurement noise covariance: R (constant in workspace) ▸ Correction method: sequential scalar updates ▸ Specify when a new measurement is available. ▸ Output innovation covariance (for analysis)
HOW’D WE DO? Single Run EKF RESULTS 0.4 Attitude Error (~deg) MRP 1 0.2 MRP 2 ▸ Virtually identical to MRP 3 0 95% ST Boresight Errors UKF. 95% ST Cross Errors -0.2 0 20 40 60 Time (s) 0.2 Bias Error (deg/s) b 1 0.1 b 2 MC Results 0 b 3 -0.1 95% Bias Errors 1000-Run Normalized Estimate Error Squared 7 -0.2 0 10 20 30 40 50 60 6 Time (s) Total Error Squared 5 1000-run Average NE 4 95.0% Bounds (Theoretical) 3 95.0% Bounds (Empirical) 2 1 0 0 20 40 60 Time (s)
HOW’D WE DO? EKF RESULTS 1000-Run State Autocorrelation of Residuals 0.015 y 1 0.01 y 2 Total Autocorrelation y 3 0.005 0 -0.005 1000-Run Normalized Mean Estimate Error -0.01 0.1 0 10 20 30 40 50 60 Samples of Lag 0.08 Nondimensionalized State Error 0.06 1000-run NE for x 1 1000-run NE for x 2 0.04 1000-run NE for x 3 0.02 1000-run NE for x 4 1000-run NE for x 5 0 1000-run NE for x 6 -0.02 95.0% Bounds (Theoretical) 95.0% Bounds (Empirical) -0.04 -0.06 -0.08 0 20 40 60 Time (s)
UDKF
WHY TRY A UDKF? UDKF VS. EKF ▸ Operates directly on UD factors of covariance matrix ▸ Better stability of underlying covariance ▸ Little additional run-time cost ▸ Much longer to code by hand
WHAT’S NEEDED FOR THE UDKF? NOTHING ELSE NEEDED FOR UDKF ▸ Just change an option in *kf from “Covariance” to “UDU”. Follows Bierman, Factorization Methods for Discrete Sequential Estimation
Recommend
More recommend