Skip to main content

Crate ekf2_sys

Crate ekf2_sys 

Source
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:

FeatureDefaultC define
gnssyesCONFIG_EKF2_GNSS
gnss-yawnoCONFIG_EKF2_GNSS_YAW
magnetometeryesCONFIG_EKF2_MAGNETOMETER
barometeryesCONFIG_EKF2_BAROMETER
baro-compensationnoCONFIG_EKF2_BARO_COMPENSATION
airspeednoCONFIG_EKF2_AIRSPEED
range-findernoCONFIG_EKF2_RANGE_FINDER
optical-flownoCONFIG_EKF2_OPTICAL_FLOW
external-visionnoCONFIG_EKF2_EXTERNAL_VISION
aux-velnoCONFIG_EKF2_AUXVEL
drag-fusionnoCONFIG_EKF2_DRAG_FUSION
windnoCONFIG_EKF2_WIND
terrainnoCONFIG_EKF2_TERRAIN
gravity-fusionnoCONFIG_EKF2_GRAVITY_FUSION
sideslipnoCONFIG_EKF2_SIDESLIP
loggingno-
c-stubsno-

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§

EkfAidSource1d
1-D aid source (baro height, range height, airspeed, sideslip, …)
EkfAidSource2d
2-D aid source (GNSS position, optical flow, EV position, …) Note: observation uses double precision (lat/lon).
EkfAidSource3d
3-D aid source (GNSS velocity, magnetometer, EV velocity, gravity, …)
EkfAllocator
EkfBaroSample
Barometric altitude sample
EkfBiasEstimatorStatus
Scalar bias-estimator diagnostic status.
EkfGnssSample
GNSS position/velocity sample
EkfImuSample
IMU delta-angle / delta-velocity sample
EkfMagSample
Magnetometer sample
EkfSystemFlagUpdate
Vehicle/system flags used by EKF mode control.
GlobalOrigin
WGS-84 origin used by the EKF for local↔global position conversion.

Enums§

HeightSensor
Active primary height sensor reference.
PositionFrame
Position reference frame for external vision samples.
VelocityFrame
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.

Type Aliases§

EkfAllocateFn
EkfDeallocateFn