-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guillaume W. Bres <[email protected]>
- Loading branch information
Showing
8 changed files
with
272 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use nalgebra::base::{Matrix4xX, Vector4}; | ||
/* | ||
* Solver solution estimate | ||
* is always expressed as a correction of an 'a priori' position | ||
*/ | ||
#[derive(Debug, Copy, Clone, Default)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct SolverEstimate { | ||
/// X coordinates correction | ||
pub dx: f64, | ||
/// Y coordinates correction | ||
pub dy: f64, | ||
/// Z coordinates correction | ||
pub dz: f64, | ||
/// Time correction | ||
pub dt: f64, | ||
/// Position Dilution of Precision | ||
pub tdop: f64, | ||
/// Time (only) Dilution of Precision | ||
pub pdop: f64, | ||
} | ||
|
||
impl SolverEstimate { | ||
/* | ||
* Builds a new SolverEstimate from `g` Nav Matrix, | ||
* and `y` Nav Vector | ||
*/ | ||
pub fn new(g: Matrix4xX<f64>, y: Vector4<f64>) -> Option<Self> { | ||
let g_prime = g.transpose(); | ||
let q = (g.clone() * g_prime.clone()).try_inverse()?; | ||
let x = q * g_prime.clone() * y; | ||
let pdop = (q[(1, 1)] + q[(2, 2)] + q[(3, 3)]).sqrt(); | ||
let tdop = q[(4, 4)].sqrt(); | ||
Some(Self { | ||
dx: x[0], | ||
dy: x[1], | ||
dz: x[2], | ||
dt: x[3], | ||
tdop, | ||
pdop, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.