got embassy compass outputting a heading number.
This commit is contained in:
parent
6f6660fd6a
commit
45578958a6
8 changed files with 103 additions and 76 deletions
2
independent_logic/.cargo/config.toml
Normal file
2
independent_logic/.cargo/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
target = "x86_64-unknown-linux-gnu"
|
|
@ -6,4 +6,5 @@ edition = "2024"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
defmt = "1.0.1"
|
||||
libm = "0.2.1"
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use defmt::Format;
|
||||
use libm::{atan2f, atanf, cosf, sinf};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Format)]
|
||||
pub struct Attitude {
|
||||
pub pitch: f32,
|
||||
pub roll: f32,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Format)]
|
||||
pub struct NedMeasurement {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
|
@ -14,6 +15,7 @@ pub struct NedMeasurement {
|
|||
}
|
||||
|
||||
///theta=0 at north, pi/-pi at south, pi/2 at east, and -pi/2 at west
|
||||
#[derive(Debug, Format)]
|
||||
pub struct Heading(pub f32);
|
||||
|
||||
pub fn calc_attitude(measurement: &NedMeasurement) -> Attitude {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue