Skip to content

Commit 4615b2e

Browse files
committed
update docs
1 parent 41d9292 commit 4615b2e

File tree

11 files changed

+119
-18
lines changed

11 files changed

+119
-18
lines changed

components/filters/include/kalman_filter.hpp

+27-18
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,34 @@ namespace espp {
1010
/// @tparam N Number of states
1111
///
1212
/// This class implements a simple Kalman filter for estimating the state of a
13-
/// variable, such as the angle of a system. The filter is based on the
13+
/// variable, such as the orientation of a system. The filter is based on the
1414
/// following state-space model:
15-
/// x(k+1) = A * x(k) + B * u(k) + w(k)
16-
/// z(k) = H * x(k) + v(k)
17-
/// where:
18-
/// - x(k) is the state vector at time k
19-
/// - u(k) is the control input at time k
20-
/// - z(k) is the measurement at time k
21-
/// - w(k) is the process noise at time k
22-
/// - v(k) is the measurement noise at time k
23-
/// - A, B, and H are matrices
24-
/// - A is the state transition matrix
25-
/// - B is the control input matrix
26-
/// - H is the measurement matrix
27-
/// The Kalman filter estimates the state x(k) based on the measurements z(k).
28-
/// The filter is implemented in two steps: prediction and correction.
29-
/// The prediction step estimates the state at the next time step based on the
30-
/// current state and the control input. The correction step updates the state
31-
/// estimate based on the measurement.
15+
/// \f[
16+
/// X' = X + U \cdot dt
17+
/// \f]
18+
/// \f[
19+
/// P' = P + Q
20+
/// \f]
21+
/// \f[
22+
/// Y = Z - X
23+
/// \f]
24+
/// \f[
25+
/// K = P / (P + R)
26+
/// \f]
27+
/// \f[
28+
/// X = X + K \cdot Y
29+
/// \f]
30+
/// \f[
31+
/// P = (1 - K) \cdot P
32+
/// \f]
33+
/// where:
34+
/// - \f$X\f$ is the state vector
35+
/// - \f$P\f$ is the covariance matrix
36+
/// - \f$Q\f$ is the process noise
37+
/// - \f$R\f$ is the measurement noise
38+
/// - \f$U\f$ is the control input
39+
/// - \f$dt\f$ is the time step
40+
/// - \f$Z\f$ is the measurement
3241
template <size_t N> class KalmanFilter {
3342
public:
3443
/// Constructor

components/icm42607/include/icm42607.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ namespace espp {
4343
///
4444
/// For more information see, the datasheet:
4545
/// https://invensense.tdk.com/wp-content/uploads/2021/07/ds-000451_icm-42670-p-datasheet.pdf
46+
///
47+
/// \section icm42607_example Example
48+
/// \snippet icm42607_example.cpp icm42607 example
4649
template <icm42607::Interface Interface = icm42607::Interface::I2C>
4750
class Icm42607 : public espp::BasePeripheral<uint8_t, Interface == icm42607::Interface::I2C> {
4851
// Since the BasePeripheral is a dependent base class (e.g. its template

doc/Doxyfile

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ EXAMPLE_PATH += $(PROJECT_PATH)/components/gt911/example/main/gt911_example.cpp
5252
EXAMPLE_PATH += $(PROJECT_PATH)/components/hid-rp/example/main/hid_rp_example.cpp
5353
EXAMPLE_PATH += $(PROJECT_PATH)/components/hid_service/example/main/hid_service_example.cpp
5454
EXAMPLE_PATH += $(PROJECT_PATH)/components/i2c/example/main/i2c_example.cpp
55+
EXAMPLE_PATH += $(PROJECT_PATH)/components/icm42607/example/main/icm42607_example.cpp
5556
EXAMPLE_PATH += $(PROJECT_PATH)/components/interrupt/example/main/interrupt_example.cpp
5657
EXAMPLE_PATH += $(PROJECT_PATH)/components/joystick/example/main/joystick_example.cpp
5758
EXAMPLE_PATH += $(PROJECT_PATH)/components/kts1622/example/main/kts1622_example.cpp
@@ -144,7 +145,10 @@ INPUT += $(PROJECT_PATH)/components/event_manager/include/event_manager.hpp
144145
INPUT += $(PROJECT_PATH)/components/file_system/include/file_system.hpp
145146
INPUT += $(PROJECT_PATH)/components/filters/include/biquad_filter.hpp
146147
INPUT += $(PROJECT_PATH)/components/filters/include/butterworth_filter.hpp
148+
INPUT += $(PROJECT_PATH)/components/filters/include/complementary_filter.hpp
149+
INPUT += $(PROJECT_PATH)/components/filters/include/kalman_filter.hpp
147150
INPUT += $(PROJECT_PATH)/components/filters/include/lowpass_filter.hpp
151+
INPUT += $(PROJECT_PATH)/components/filters/include/madgwick_filter.hpp
148152
INPUT += $(PROJECT_PATH)/components/filters/include/simple_lowpass_filter.hpp
149153
INPUT += $(PROJECT_PATH)/components/filters/include/sos_filter.hpp
150154
INPUT += $(PROJECT_PATH)/components/filters/include/transfer_function.hpp
@@ -162,6 +166,8 @@ INPUT += $(PROJECT_PATH)/components/hid-rp/include/hid-rp-xbox.hpp
162166
INPUT += $(PROJECT_PATH)/components/hid_service/include/hid_service.hpp
163167
INPUT += $(PROJECT_PATH)/components/i2c/include/i2c.hpp
164168
INPUT += $(PROJECT_PATH)/components/i2c/include/i2c_menu.hpp
169+
INPUT += $(PROJECT_PATH)/components/icm42607/include/icm42607.hpp
170+
INPUT += $(PROJECT_PATH)/components/icm42607/include/icm42607_detail.hpp
165171
INPUT += $(PROJECT_PATH)/components/interrupt/include/interrupt.hpp
166172
INPUT += $(PROJECT_PATH)/components/input_drivers/include/encoder_input.hpp
167173
INPUT += $(PROJECT_PATH)/components/input_drivers/include/keypad_input.hpp

doc/en/filters/complementary.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Complementary Filter
2+
********************
3+
4+
The `ComplementaryFilter` provides a simple implementation of a filter
5+
specifically designed to combine the outputs of a gyroscope and an accelerometer
6+
to produce a more accurate estimate of the orientation of an object. This filter
7+
is provided for completeness and simplicity, but the `KalmanFilter` or
8+
`MadgwickFilter` are generally preferred for this purpose.
9+
10+
.. ---------------------------- API Reference ----------------------------------
11+
12+
API Reference
13+
-------------
14+
15+
.. include-build-file:: inc/complementary_filter.inc

doc/en/filters/index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ Filter APIs
77
filters_example
88
biquad
99
butterworth
10+
complementary
11+
kalman
1012
lowpass
13+
madgwick
1114
simple_lowpass
1215
sos
1316
transfer_function

doc/en/filters/kalman.rst

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Kalman Filter
2+
*************
3+
4+
The `KalmanFilter` class implements a Kalman filter for linear systems. The
5+
filter can be used to estimate the state of a linear system given noisy
6+
measurements. The filter can be configured for an arbitrary number of states
7+
and measurements. You can also specify the process noise and measurement noise
8+
covariances.
9+
10+
To use the filter, you must first create an instance of the `KalmanFilter`
11+
class, then call the `predict` and `update` methods to estimate the state of
12+
the system. To get the current state estimate, call the `get_state` method.
13+
14+
.. ---------------------------- API Reference ----------------------------------
15+
16+
API Reference
17+
-------------
18+
19+
.. include-build-file:: inc/kalman_filter.inc

doc/en/filters/madgwick.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Madgwick Filter
2+
***************
3+
4+
The `MadgwickFilter` implements the Madgwick algorithm for orientation
5+
estimation using an IMU. The algorithm is based on the paper `An efficient
6+
orientation filter for inertial and inertial/magnetic sensor arrays`_ by
7+
Sebastian Madgwick. It supports state / orientation estimation for both 6-axis
8+
IMUs as well as for 9-axis IMUs.
9+
10+
.. ---------------------------- API Reference ----------------------------------
11+
12+
API Reference
13+
-------------
14+
15+
.. include-build-file:: inc/madgwick_filter.inc

doc/en/imu/icm42607.rst

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ICM42607 6-Axis IMU
2+
*******************
3+
4+
The `Icm42607` component provides a driver for the ICM42607 and ICM42670 6-Axis
5+
Inertial Measurement Units (IMUs).
6+
7+
.. ------------------------------- Example -------------------------------------
8+
9+
.. toctree::
10+
11+
icm42607_example
12+
13+
.. ---------------------------- API Reference ----------------------------------
14+
15+
API Reference
16+
-------------
17+
18+
.. include-build-file:: inc/icm42607.inc
19+
.. include-build-file:: inc/icm42607_detail.inc

doc/en/imu/icm42607_example.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```{include} ../../../components/icm42607/example/README.md
2+
```

doc/en/imu/index.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
IMU APIs
2+
********
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
icm42607
8+
9+
Code examples for the IMU APIs are provided in the respective component folders.

doc/en/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This is the documentation for esp-idf c++ components, ESPP (`espp <https://githu
3232
haptics/index
3333
hid/index
3434
i2c
35+
imu/index
3536
interrupt
3637
input/index
3738
io_expander/index

0 commit comments

Comments
 (0)