Skip to content

Commit bf991c6

Browse files
committed
refactored attitude update
1 parent 33a22cc commit bf991c6

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

core/src/strapdown.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -519,19 +519,19 @@ pub fn forward(state: StrapdownState, imu_data: IMUData, dt: f64) {
519519
/// * A Matrix3 representing the updated attitude matrix in the NED frame.
520520
fn attitude_update(state: &StrapdownState, gyros: Vector3<f64>, dt: f64) -> Matrix3<f64> {
521521
let transport_rate: Matrix3<f64> = earth::vector_to_skew_symmetric(&earth::transport_rate(
522-
&self.latitude.to_degrees(),
523-
&self.altitude,
522+
&state.latitude.to_degrees(),
523+
&state.altitude,
524524
&Vector3::from_vec(vec![
525-
self.velocity_north,
526-
self.velocity_east,
527-
self.velocity_down,
525+
state.velocity_north,
526+
state.velocity_east,
527+
state.velocity_down,
528528
]),
529529
));
530530
let rotation_rate: Matrix3<f64> =
531-
earth::vector_to_skew_symmetric(&earth::earth_rate_lla(&self.latitude.to_degrees()));
532-
let omega_ib: Matrix3<f64> = earth::vector_to_skew_symmetric(gyros);
533-
let c_1: Matrix3<f64> = self.attitude * (Matrix3::identity() + omega_ib * dt)
534-
- (rotation_rate + transport_rate) * self.attitude * dt;
531+
earth::vector_to_skew_symmetric(&earth::earth_rate_lla(&state.latitude.to_degrees()));
532+
let omega_ib: Matrix3<f64> = earth::vector_to_skew_symmetric(&gyros);
533+
let c_1: Matrix3<f64> = state.attitude * (Matrix3::identity() + omega_ib * dt)
534+
- (rotation_rate + transport_rate) * state.attitude * dt;
535535
c_1
536536
}
537537
/// Velocity update in NED

0 commit comments

Comments
 (0)