Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

copterust/dcmimu

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dcmimu

An algorithm for fusing low-cost triaxial MEMS gyroscope and accelerometer measurements.

A no_std Rust port of the original.

Build Status

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.

Credentials

Heikki Hyyti and Arto Visala, "A DCM Based Attitude Estimation Algorithm for Low-Cost MEMS IMUs," International Journal of Navigation and Observation, vol. 2015, Article ID 503814, 18 pages, 2015.

Usage

Library is available via crates.io 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):
    dcmimu.update_only((gyro.x, gyro.y, gyro.z), (accel.x, accel.y, accel.z), dt_ms.seconds());
    let dcm = dcmimu.to_euler_angles();
    println!("Roll: {}; yaw: {}; pitch: {}", dcm.roll, dcm.yaw, dcm.pitch);
}

Check out mpu9250 for accelerometer/gyroscrope sensors driver.

Documentation

Available via docs.rs.

License

MIT license.

About

An algorithm for fusing low-cost triaxial MEMS gyroscope and accelerometer measurements.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.