-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ekf2: do not pre-compute airspeed Kalman gain
The generated code is not much faster than the simple matrix-vector multiplication
- Loading branch information
Showing
4 changed files
with
62 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/modules/ekf2/EKF/python/ekf_derivation/generated/compute_airspeed_h.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// ----------------------------------------------------------------------------- | ||
// This file was autogenerated by symforce from template: | ||
// function/FUNCTION.h.jinja | ||
// Do NOT modify by hand. | ||
// ----------------------------------------------------------------------------- | ||
|
||
#pragma once | ||
|
||
#include <matrix/math.hpp> | ||
|
||
namespace sym { | ||
|
||
/** | ||
* This function was autogenerated from a symbolic function. Do not modify by hand. | ||
* | ||
* Symbolic function: compute_airspeed_h | ||
* | ||
* Args: | ||
* state: Matrix25_1 | ||
* epsilon: Scalar | ||
* | ||
* Outputs: | ||
* res: Matrix24_1 | ||
*/ | ||
template <typename Scalar> | ||
matrix::Matrix<Scalar, 24, 1> ComputeAirspeedH(const matrix::Matrix<Scalar, 25, 1>& state, | ||
const Scalar epsilon) { | ||
// Total ops: 14 | ||
|
||
// Input arrays | ||
|
||
// Intermediate terms (5) | ||
const Scalar _tmp0 = -state(23, 0) + state(5, 0); | ||
const Scalar _tmp1 = -state(22, 0) + state(4, 0); | ||
const Scalar _tmp2 = std::pow(Scalar(std::pow(_tmp0, Scalar(2)) + std::pow(_tmp1, Scalar(2)) + | ||
epsilon + std::pow(state(6, 0), Scalar(2))), | ||
Scalar(Scalar(-1) / Scalar(2))); | ||
const Scalar _tmp3 = _tmp1 * _tmp2; | ||
const Scalar _tmp4 = _tmp0 * _tmp2; | ||
|
||
// Output terms (1) | ||
matrix::Matrix<Scalar, 24, 1> _res; | ||
|
||
_res.setZero(); | ||
|
||
_res(3, 0) = _tmp3; | ||
_res(4, 0) = _tmp4; | ||
_res(5, 0) = _tmp2 * state(6, 0); | ||
_res(21, 0) = -_tmp3; | ||
_res(22, 0) = -_tmp4; | ||
|
||
return _res; | ||
} // NOLINT(readability/fn_size) | ||
|
||
// NOLINTNEXTLINE(readability/fn_size) | ||
} // namespace sym |
116 changes: 0 additions & 116 deletions
116
src/modules/ekf2/EKF/python/ekf_derivation/generated/compute_airspeed_h_and_k.h
This file was deleted.
Oops, something went wrong.