1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! ```
//! use embedded_flight::control::PositionController;
//! use nalgebra::Vector3;
//!
//! // Current state of the craft
//! let position = Vector3::zeros();
//! let velocity = Vector3::new(1., 1., 1.);
//! let attitude = Vector3::zeros();
//! let gyro = Vector3::zeros();
//!
//! // Jerk moments of position and velocity to apply
//! let position_cmd = Vector3::new(1., 1., 1.);
//! let velocity_cmd = Vector3::new(0., 0., 1.);
//!
//! let controller = PositionController::default();
//!
//! let moment = controller.position_control(
//!     position_cmd,
//!     velocity_cmd,
//!     position,
//!     velocity,
//!     attitude,
//!     gyro
//! );
//! dbg!(moment);
//! ```

#![no_std]

pub use embedded_flight_control as control;
pub use embedded_flight_motors as motors;

pub mod copter;
pub use copter::Copter;

use nalgebra::Vector3;

pub trait AHRS {
    fn angle_rates(&mut self) -> Vector3<f32>;

    fn attitude(&mut self) -> Vector3<f32>;

    fn local_position(&mut self) -> Vector3<f32>;

    fn local_velocity(&mut self) -> Vector3<f32>;
}