Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[filter] transition and observation runtime change support #564

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ The member types are optionally present according to the filter configuration.
| `x` | Manages the state estimate column vector *X*. Gets or sets the value. The default value is the null column vector. |
| `y` | Manages the innovation column vector *Y*. Gets the value last computed during the update. The default value is the null column vector. |
| `z` | Manages the observation column vector *Z*. Gets the value last used during the update. The default value is the null column vector. |
| `transition` | Manages the state transition function object *f*. Configures the callable object of expression `state(const state &, const input &, const PredictionTypes &...)` to compute the transition state value. The default value is the equivalent to *f(x) = F * X*. The default function is suitable for linear systems. For extended filters `transition` is a linearization of the state transition while *F* is the Jacobian of the transition function: *F = ∂f/∂X = ∂fj/∂xi* that is each row *i* contains the derivatives of the state transition function for every element *j* in the state column vector *X*. |
| `observation` | Manages the state observation function object *h*. Configures the callable object of expression `output(const state &, const UpdateTypes &...arguments)` to compute the observation state value. The default value is the equivalent to *h(x) = H * X*. The default function is suitable for linear systems. For extended filters `observation` is a linearization of the state observation while *H* is the Jacobian of the observation function: *H = ∂h/∂X = ∂hj/∂xi* that is each row *i* contains the derivatives of the state observation function for every element *j* in the state vector *X*. |

The characteristics are optionally present according to the filter configuration.

Expand Down
10 changes: 10 additions & 0 deletions include/fcarouge/internal/kalman.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ kalman<Filter>::s() const -> const innovation_uncertainty & {
return filter.s;
}

template <typename Filter>
inline constexpr void kalman<Filter>::transition(const auto &callable) {
filter.transition = callable;
}

template <typename Filter>
inline constexpr void kalman<Filter>::observation(const auto &callable) {
filter.observation = callable;
}

template <typename Filter>
inline constexpr void kalman<Filter>::update(const auto &...arguments) {
filter.update(arguments...);
Expand Down
28 changes: 28 additions & 0 deletions include/fcarouge/kalman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,34 @@ class kalman final : public internal::conditional_member_types<Filter> {
inline constexpr auto s() const -> const innovation_uncertainty &;
//! @}

//! @brief Sets the extended state transition function f(x).
//!
//! @param callable The copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be called to compute the next state X on
//! prediction steps of expression `state(const state &, const input &, const
//! PredictionTypes &...)`. The default function `f(x) = F * X` is suitable
//! for linear systems. For non-linear system, or extended filter, implement a
//! linearization of the transition function f and the state transition F
//! matrix is the Jacobian of the state transition function.
//!
//! @complexity Constant.
inline constexpr void transition(const auto &callable);

//! @brief Sets the extended state observation function h(x).
//!
//! @param callable The copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be called to compute the observation Z
//! on update steps of expression `output(const state &, const UpdateTypes
//! &...arguments)`. The default function `h(x) = H * X` is suitable for
//! linear systems. For non-linear system, or extended filter, the client
//! implements a linearization of the observation function hand the state
//! observation H matrix is the Jacobian of the state observation function.
//!
//! @complexity Constant.
inline constexpr void observation(const auto &callable);

//! @name Public Filtering Member Functions
//! @{

Expand Down
Loading