Crates.io | dcmimu |
lib.rs | dcmimu |
version | |
source | src |
created_at | 2018-09-01 19:16:33.268709+00 |
updated_at | 2025-03-05 22:34:53.393904+00 |
description | no_std DCM IMU implementation |
homepage | |
repository | https://github.com/copterust/dcmimu |
max_upload_size | |
id | 82541 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
dcmimu
An algorithm for fusing low-cost triaxial MEMS gyroscope and accelerometer measurements.
A no_std
Rust port of the original.
NOTE: libm
still doesn't work with overflow checks,
so you have to compile your project with --release
.
Leave a comment in the linked issue to raise awareness.
Library is available via crates.io .
# Create DCMIMU:
let mut dcmimu = DCMIMU::new();
let mut prev_t_ms = now();
loop {
# get gyroscope and accelerometer measurement from your sensors:
let gyro = sensor.read_gyro();
let accel = sensor.read_accel();
# Convert measurements to SI if needed.
# Get time difference since last update:
let t_ms = now();
let dt_ms = t_ms - prev_t_ms
prev_t_ms = t_ms
# Update dcmimu states (don't forget to use SI):
let (dcm, _gyro_biases) = dcmimu.update((gyro.x, gyro.y, gyro.z),
(accel.x, accel.y, accel.z),
dt_ms.seconds());
println!("Roll: {}; yaw: {}; pitch: {}", dcm.roll, dcm.yaw, dcm.pitch);
# Measurements can also be queried without updating:
println!("{:?} == {}, {}, {}", dcmimu.all(), dcmimu.roll(), dcmimu.yaw(), dcmimu.pitch());
}
Check out mpu9250 for accelerometer/gyroscrope sensors driver.
Available via docs.rs.