pub struct StrapdownState {
pub latitude: f64,
pub longitude: f64,
pub altitude: f64,
pub velocity_north: f64,
pub velocity_east: f64,
pub velocity_down: f64,
pub attitude: Rotation3<f64>,
pub coordinate_convention: bool,
}
Expand description
Basic structure for holding the strapdown mechanization state in the form of position, velocity, and attitude.
Attitude is stored in matrix form (rotation or direction cosine matrix) and position and velocity are stored as vectors. The order or the states depends on the coordinate system used. The struct does not care, but the coordinate system used will determine which functions you should use. Default is NED but nonetheless must be assigned. For computational simplicity, latitude and longitude are stored as radians.
Fields§
§latitude: f64
Latitude in radians
longitude: f64
Longitude in radians
altitude: f64
Altitude in meters
velocity_north: f64
Velocity north in m/s (NED frame)
velocity_east: f64
Velocity east in m/s (NED frame)
velocity_down: f64
Velocity down in m/s (NED frame)
attitude: Rotation3<f64>
Attitude as a rotation matrix (unchanged)
coordinate_convention: bool
Coordinate convention used for the state vector (NED or ENU; NED is true by default)
Implementations§
Source§impl StrapdownState
impl StrapdownState
Sourcepub fn new() -> StrapdownState
pub fn new() -> StrapdownState
Create a new StrapdownState with all zeros
Sourcepub fn new_from_components(
latitude: f64,
longitude: f64,
altitude: f64,
velocity_north: f64,
velocity_east: f64,
velocity_down: f64,
attitude: Rotation3<f64>,
in_degrees: bool,
ned: bool,
) -> StrapdownState
pub fn new_from_components( latitude: f64, longitude: f64, altitude: f64, velocity_north: f64, velocity_east: f64, velocity_down: f64, attitude: Rotation3<f64>, in_degrees: bool, ned: bool, ) -> StrapdownState
Create a new StrapdownState from explicit position and velocity components, and attitude
§Arguments
latitude
- Latitude in radians or degrees (seein_degrees
).longitude
- Longitude in radians or degrees (seein_degrees
).altitude
- Altitude in meters.velocity_north
- North velocity in m/s.velocity_east
- East velocity in m/s.velocity_down
- Down velocity in m/s.attitude
- Rotation3attitude matrix. in_degrees
- If true, angles are provided in degrees and will be converted to radians.ned
- If true, the coordinate convention is NED (North, East, Down), otherwise ENU (East, North, Up).
Sourcepub fn new_from_vector(
state: SVector<f64, 9>,
in_degrees: bool,
) -> StrapdownState
pub fn new_from_vector( state: SVector<f64, 9>, in_degrees: bool, ) -> StrapdownState
Create a StrapdownState from a canonical state vector (NED order: lat, lon, alt, v_n, v_e, v_d, roll, pitch, yaw)
§Arguments
state
- SVector<f64, 9> in the order [lat, lon, alt, v_n, v_e, v_d, roll, pitch, yaw]in_degrees
- If true, angles are provided in degrees and will be converted to radians.
pub fn get_velocity(&self) -> Vector3<f64>
Sourcepub fn forward(&mut self, imu_data: &IMUData, dt: f64)
pub fn forward(&mut self, imu_data: &IMUData, dt: f64)
NED form of the forward kinematics equations. Corresponds to section 5.4 Local-Navigation Frame Equations from the book Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems, Second Edition by Paul D. Groves; Second Edition.
This function implements the forward kinematics equations for the strapdown navigation system. It takes the IMU data and the time step as inputs and updates the position, velocity, and attitude of the system. The IMU data is assumed to be pre-processed and ready for use in the mechanization equations (i.e. the gravity vector has already been filtered out and the data represents relative motion).
§Arguments
imu_data
- A reference to an IMUData instance containing the acceleration and gyro data in the body frame.dt
- A f64 representing the time step in seconds.
§Example
use strapdown::{StrapdownState, IMUData};
use nalgebra::Vector3;
let mut state = StrapdownState::new();
let imu_data = IMUData::new_from_vector(
Vector3::new(0.0, 0.0, -9.81), // free fall acceleration in m/s^2
Vector3::new(0.0, 0.0, 0.0) // No rotation
);
let dt = 0.1; // Example time step in seconds
state.forward(&imu_data, dt);
Trait Implementations§
Source§impl Clone for StrapdownState
impl Clone for StrapdownState
Source§fn clone(&self) -> StrapdownState
fn clone(&self) -> StrapdownState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StrapdownState
impl Debug for StrapdownState
Source§impl Default for StrapdownState
impl Default for StrapdownState
impl Copy for StrapdownState
Auto Trait Implementations§
impl Freeze for StrapdownState
impl RefUnwindSafe for StrapdownState
impl Send for StrapdownState
impl Sync for StrapdownState
impl Unpin for StrapdownState
impl UnwindSafe for StrapdownState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.