Expand description

embedded-flight

A #![no_std] flight software library for embedded rust

Examples

For more check out the basic example on GitHub.

Create and run a MultiCopter from a motor matrix, inertial sensor, clock, and frequency (in hz).

    use embedded_flight::MultiCopter;
    use embedded_flight::motors::MotorMatrix;
     
    // Create a quad-copter motor matrix from 4 ESCs
    let motor_matrix = MotorMatrix::quad(ESC(0), ESC(1), ESC(2), ESC(3));

    // Create the quad-copter
    let mut copter = MultiCopter::new(
        motor_matrix,
        ExampleInertialSensor,
        ExampleClock,
        400
    );

    // Run the tasks in the scheduler and output to the motors in a loop
    // By default this will stabilize the attitude
    copter.run();

Use the lower level MultiCopterAttitudeController to get the motor output for a desired attitude:

use embedded_flight::control::attitude::MultiCopterAttitudeController;
use nalgebra::{Vector3, Quaternion};

let mut controller = MultiCopterAttitudeController::default();

// Input the desired attitude and angular velocity with the current attitude
controller.attitude_controller.input(
    Quaternion::default(),
    Vector3::default(),
    Quaternion::default(),
);

// Output the control to the motors with the current gyroscope data.
let output = controller.motor_output(Vector3::default(), 1);
dbg!(output);

Re-exports

pub use embedded_flight_control as control;
pub use embedded_flight_core as core;
pub use embedded_flight_motors as motors;
pub use copter::MultiCopter;

Modules