Skip to main content

rust_gnc/navigation/
mod.rs

1//! # Navigation and State Estimation
2//! 
3//! This module defines the "Perception" layer of the flight stack. It aggregates 
4//! data from various estimators to provide a high-fidelity representation of 
5//! the vehicle's physical state.
6//!
7//! ### Coordinate System
8//! All spatial data (Position, Velocity) is expressed in the **NED (North-East-Down)** //! frame. Attitudes are expressed as Tait-Bryan Euler angles.
9
10use crate::{Attitude, units::{Position, Radians, Velocity}};
11
12/// Represents the instantaneous rotational velocity of the aircraft.
13/// 
14/// These values represent the "Body Rate" of the vehicle, typically sourced 
15/// directly from a filtered 3-axis Gyroscope.
16#[derive(Debug, Clone, Copy, Default)]
17pub struct AngularRate {
18    /// Rotational velocity around the longitudinal axis (X).
19    pub roll_rate: Radians,
20    /// Rotational velocity around the lateral axis (Y).
21    pub pitch_rate: Radians,
22    /// Rotational velocity around the vertical axis (Z).
23    pub yaw_rate: Radians,
24}
25
26/// The complete navigational state of the vehicle.
27/// 
28/// Known as the **Navigation Solution**, this struct is the "Single Source of Truth" 
29/// for the Control and Guidance modules. It must be updated at a high frequency 
30/// to ensure stability.
31#[derive(Debug, Clone, Copy)]
32pub struct DroneState {
33    /// Current angular velocities, used primarily for D-term (Derivative) control.
34    pub angular_rate: AngularRate,
35    /// Current Euler angles, used for P-term (Proportional) attitude correction.
36    pub attitude: Attitude,
37    /// Linear velocity vector, essential for position hold and GPS missions.
38    pub velocity: Velocity,
39    /// 3D coordinates relative to the home point or global datum.
40    pub position: Position,
41}