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] add value type template support #30

Merged
merged 1 commit into from
May 9, 2022
Merged
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
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ A generic Kalman filter.
## One-Dimensional

```cpp
using kalman = fcarouge::kalman<double>;

kalman k;
fcarouge::kalman k;

k.x(60.);
k.p(225.);
k.r(25.);

k.update(48.54);
k(48.54);
```

## Multi-Dimensional
Expand Down Expand Up @@ -95,8 +93,6 @@ k.r(400);

k.predict(delta_time, gravitational_acceleration);
k.update(-32.40 );
k.predict(delta_time, 39.72);
k.update(-11.1);
```

# Library
Expand Down Expand Up @@ -131,7 +127,8 @@ This package explores what could be a Kalman filter implementation a la standard
Defined in header [fcarouge/kalman.hpp](include/fcarouge/kalman.hpp)

```cpp
template <typename State, typename Output = State, typename Input = State,
template <typename Type, typename State = Type, typename Output = State,
typename Input = State,
template <typename> typename Transpose = internal::transpose,
template <typename> typename Symmetrize = internal::symmetrize,
template <typename, typename> typename Divide = internal::divide,
Expand All @@ -142,6 +139,18 @@ class kalman

### Template Parameters

| Template Parameter | Definition |
| --- | --- |
| `Type` | The type template parameter of the value type of the filter. |
| `State` | The type template parameter of the state vector x. State variables can be observed (measured), or hidden variables (infeered). This is the the mean of the multivariate Gaussian. |
| `Output` | The type template parameter of the measurement vector z. |
| `Input` | The type template parameter of the control u. |
| `Transpose` | The template template parameter of the matrix transpose functor. |
| `Symmetrize` | The template template parameter of the matrix symmetrization functor. |
| `Divide` | The template template parameter of the matrix division functor. |
| `Identity` | The template template parameter of the matrix identity functor. |
| `PredictionArguments...` | The variadic type template parameter for additional prediction function parameters. Time, or a delta thereof, is often a prediction parameter. The parameters are propagated to the function objects used to compute the process noise Q, the state transition F, and the control transition G matrices. |

### Member Types

| Member Type | Definition |
Expand All @@ -166,7 +175,7 @@ class kalman

#### Characteristics

| Modifier | Definition |
| Characteristic | Definition |
| --- | --- |
| `x` | Manages the state estimate vector. |
| `z` | Manages the observation vector. |
Expand All @@ -182,6 +191,7 @@ class kalman

| Modifier | Definition |
| --- | --- |
| `operator()` | Runs a step of the filter. Predicts and updates the estimates per prediction arguments, control input, and measurement output. |
| `update` | Updates the estimates with the outcome of a measurement. |
| `predict` | Produces estimates of the state variables and uncertainties. |

Expand Down
3 changes: 3 additions & 0 deletions include/fcarouge/internal/kalman_operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ namespace fcarouge::internal
//! @brief Function object for performing matrix transposition.
//!
//! @tparam Type The type template parameter of the matrix.
//!
//! @todo Should/could the operator be template instead of the class? If not,
//! record rational.
template <typename Type> struct transpose {
//! @brief Returns the transpose of `value`.
//!
Expand Down
Loading