-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for resetting wind states to external observation (#23277)
* added support for resetting wind states to external observation Signed-off-by: RomanBapst <[email protected]> * moved wind related functions into separate file Signed-off-by: RomanBapst <[email protected]> * added VEHICLE_CMD_EXTERNAL_WIND_ESTIMATE Signed-off-by: RomanBapst <[email protected]> * correctly compute variances Signed-off-by: RomanBapst <[email protected]> * ekf2: implement wind reset Signed-off-by: RomanBapst <[email protected]> * only allow VEHICLE_CMD_EXTERNAL_WIND_ESTIMATE during wind dead-reckoning and increase horizontal velocity variance to allow velocity states to move towards solution that is aligned with the newly set wind Signed-off-by: RomanBapst <[email protected]> * only reset wind on ground * still use wind reset using airspeed when it wasn't initialized * exclude func for rover, change reset interface * handle wind reset in drag-fusion * replace state reset with variance reset in sideslip/drag fusion * remove resetWind function --------- Signed-off-by: RomanBapst <[email protected]> Co-authored-by: Marco Hauswirth <[email protected]>
- Loading branch information
1 parent
ca9948a
commit 1b9f1b7
Showing
14 changed files
with
231 additions
and
59 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
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
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
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
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
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
61 changes: 61 additions & 0 deletions
61
...python/ekf_derivation/generated/compute_wind_init_and_cov_from_wind_speed_and_direction.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,61 @@ | ||
// ----------------------------------------------------------------------------- | ||
// 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_wind_init_and_cov_from_wind_speed_and_direction | ||
* | ||
* Args: | ||
* wind_speed: Scalar | ||
* wind_direction: Scalar | ||
* wind_speed_var: Scalar | ||
* wind_direction_var: Scalar | ||
* | ||
* Outputs: | ||
* wind: Matrix21 | ||
* P_wind: Matrix21 | ||
*/ | ||
template <typename Scalar> | ||
void ComputeWindInitAndCovFromWindSpeedAndDirection( | ||
const Scalar wind_speed, const Scalar wind_direction, const Scalar wind_speed_var, | ||
const Scalar wind_direction_var, matrix::Matrix<Scalar, 2, 1>* const wind = nullptr, | ||
matrix::Matrix<Scalar, 2, 1>* const P_wind = nullptr) { | ||
// Total ops: 14 | ||
|
||
// Input arrays | ||
|
||
// Intermediate terms (5) | ||
const Scalar _tmp0 = std::cos(wind_direction); | ||
const Scalar _tmp1 = std::sin(wind_direction); | ||
const Scalar _tmp2 = std::pow(_tmp0, Scalar(2)); | ||
const Scalar _tmp3 = std::pow(_tmp1, Scalar(2)); | ||
const Scalar _tmp4 = wind_direction_var * std::pow(wind_speed, Scalar(2)); | ||
|
||
// Output terms (2) | ||
if (wind != nullptr) { | ||
matrix::Matrix<Scalar, 2, 1>& _wind = (*wind); | ||
|
||
_wind(0, 0) = _tmp0 * wind_speed; | ||
_wind(1, 0) = _tmp1 * wind_speed; | ||
} | ||
|
||
if (P_wind != nullptr) { | ||
matrix::Matrix<Scalar, 2, 1>& _p_wind = (*P_wind); | ||
|
||
_p_wind(0, 0) = _tmp2 * wind_speed_var + _tmp3 * _tmp4; | ||
_p_wind(1, 0) = _tmp2 * _tmp4 + _tmp3 * wind_speed_var; | ||
} | ||
} // NOLINT(readability/fn_size) | ||
|
||
// NOLINTNEXTLINE(readability/fn_size) | ||
} // namespace sym |
Oops, something went wrong.