embedded_flight_core/
lib.rs

1#![cfg_attr(not(test), no_std)]
2
3use nalgebra::{Quaternion, Vector3};
4
5pub mod filter;
6
7pub trait InertialSensor {
8    fn attitude(&mut self) -> Quaternion<f32>;
9
10    fn gyro(&mut self) -> Vector3<f32>;
11}
12
13/// Motor output containing the desired pitch, roll, and yaw control and feed forward in -1 ~ +1.
14#[derive(Debug)]
15pub struct MotorOutput<T> {
16    pub control: Vector3<T>,
17    pub feed_forward: Vector3<T>,
18}
19
20impl<T> MotorOutput<T> {
21    pub fn new(control: Vector3<T>, feed_forward: Vector3<T>) -> Self {
22        Self {
23            control,
24            feed_forward,
25        }
26    }
27}
28
29#[cfg(test)]
30mod tests {
31    #[test]
32    fn it_works() {
33        let result = 2 + 2;
34        assert_eq!(result, 4);
35    }
36}