Expand description
Raw FFI bindings for the PX4 EKF2 C++ library.
This crate is a low-level unsafe interface. Most users should use the
safe ekf2 crate instead.
§Feature flags
Each sensor type and integration option is guarded by a Cargo feature. The
sensor features map 1-to-1 to the corresponding CONFIG_EKF2_* C
preprocessor define:
| Feature | Default | C define |
|---|---|---|
gnss | yes | CONFIG_EKF2_GNSS |
gnss-yaw | no | CONFIG_EKF2_GNSS_YAW |
magnetometer | yes | CONFIG_EKF2_MAGNETOMETER |
barometer | yes | CONFIG_EKF2_BAROMETER |
baro-compensation | no | CONFIG_EKF2_BARO_COMPENSATION |
airspeed | no | CONFIG_EKF2_AIRSPEED |
range-finder | no | CONFIG_EKF2_RANGE_FINDER |
optical-flow | no | CONFIG_EKF2_OPTICAL_FLOW |
external-vision | no | CONFIG_EKF2_EXTERNAL_VISION |
aux-vel | no | CONFIG_EKF2_AUXVEL |
drag-fusion | no | CONFIG_EKF2_DRAG_FUSION |
wind | no | CONFIG_EKF2_WIND |
terrain | no | CONFIG_EKF2_TERRAIN |
gravity-fusion | no | CONFIG_EKF2_GRAVITY_FUSION |
sideslip | no | CONFIG_EKF2_SIDESLIP |
logging | no | - |
c-stubs | no | - |
range-finder and optical-flow imply terrain. drag-fusion and
sideslip imply wind; airspeed implies all three of those features.
§Memory
ekf2_create_heap uses the Rust global allocator through the exported
ekf2_rust_alloc callbacks. ekf2_create_heap_with_allocator accepts an
explicit callback table instead. C++ stores that table in the EKF object
and uses it for all dynamic storage owned by the object.
The ekf2_create variants place the EKF object in caller-provided storage;
its internal dynamic storage still uses the selected callback table.
Structs§
- EkfAid
Source1d - 1-D aid source (baro height, range height, airspeed, sideslip, …)
- EkfAid
Source2d - 2-D aid source (GNSS position, optical flow, EV position, …) Note: observation uses double precision (lat/lon).
- EkfAid
Source3d - 3-D aid source (GNSS velocity, magnetometer, EV velocity, gravity, …)
- EkfAllocator
- EkfBaro
Sample - Barometric altitude sample
- EkfBias
Estimator Status - Scalar bias-estimator diagnostic status.
- EkfGnss
Sample - GNSS position/velocity sample
- EkfImu
Sample - IMU delta-angle / delta-velocity sample
- EkfMag
Sample - Magnetometer sample
- EkfSystem
Flag Update - Vehicle/system flags used by EKF mode control.
- Global
Origin - WGS-84 origin used by the EKF for local↔global position conversion.
Enums§
- Height
Sensor - Active primary height sensor reference.
- Position
Frame - Position reference frame for external vision samples.
- Velocity
Frame - Velocity reference frame for external vision samples.
Functions§
- ekf2_
rust_ ⚠alloc - C ABI allocator shim used by C++ glue code.
- ekf2_
rust_ ⚠alloc_ zeroed - C ABI zeroed allocator shim used by C++ glue code.
- ekf2_
rust_ ⚠dealloc - C ABI deallocator shim used by C++ glue code.