From 00a66de47e4b53ac363222648f72774dd666d738 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 21 Apr 2025 14:14:54 -0700 Subject: [PATCH 1/4] Add Katex header and option to include it in Doc.rs --- katex-header.html | 15 +++++++++++++++ swiftnav/Cargo.toml | 5 +++++ 2 files changed, 20 insertions(+) create mode 100644 katex-header.html diff --git a/katex-header.html b/katex-header.html new file mode 100644 index 0000000..cd7fcb3 --- /dev/null +++ b/katex-header.html @@ -0,0 +1,15 @@ + + + + diff --git a/swiftnav/Cargo.toml b/swiftnav/Cargo.toml index 317adca..fc66bb9 100644 --- a/swiftnav/Cargo.toml +++ b/swiftnav/Cargo.toml @@ -17,3 +17,8 @@ strum = { version = "0.27", features = ["derive"] } [dev-dependencies] float_eq = "1.0.1" + +# This tells docs.rs to include the katex header for math formatting +# To do this locally +[package.metadata.docs.rs] +rustdoc-args = [ "--html-in-header", "katex-header.html" ] \ No newline at end of file From e0d5b314dd61e19e9e57693447a026599d2831f0 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 21 Apr 2025 14:15:44 -0700 Subject: [PATCH 2/4] Update documentation to use katex formatting --- swiftnav/src/coords.rs | 16 ++++++------ swiftnav/src/edc.rs | 2 ++ swiftnav/src/reference_frame/mod.rs | 38 ++++++++++++++++++++--------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/swiftnav/src/coords.rs b/swiftnav/src/coords.rs index e0c7906..8d0fca7 100644 --- a/swiftnav/src/coords.rs +++ b/swiftnav/src/coords.rs @@ -17,16 +17,18 @@ //! //! -------- //! Conversion from geodetic coordinates latitude, longitude and height -//! (ϕ, λ, h) into Cartesian coordinates (X, Y, Z) can be +//! ($\phi$, $\lambda$, $h$) into Cartesian coordinates ($X$, $Y$, $Z$) can be //! achieved with the following formulae: -//! * X = (N(ϕ) + h) * cos(ϕ) * cos(λ) -//! * Y = (N(ϕ) + h) * cos(ϕ) * sin(λ) -//! * Z = [(1-e^2) * N(ϕ) + h] * sin(ϕ) //! -//! Where the 'radius of curvature', N(ϕ), is defined as: -//! * N(ϕ) = a / sqrt(1-e^2 / sin^2(ϕ)) +//! $$X = (N(\phi) + h) \cos{\phi}\cos{\lambda}$$ +//! $$Y = (N(\phi) + h) \cos{\phi}\sin{\lambda}$$ +//! $$Z = \left[(1-e^2)N(\phi) + h\right] \sin{\phi}$$ //! -//! and `a` is the WGS84 semi-major axis and `e` is the WGS84 +//! Where the 'radius of curvature', $N(\phi)$, is defined as: +//! +//! $$N(\phi) = \frac{a}{\sqrt{1-e^2\sin^2 \phi}}$$ +//! +//! and $a$ is the WGS84 semi-major axis and $e$ is the WGS84 //! eccentricity. //! //! -------- diff --git a/swiftnav/src/edc.rs b/swiftnav/src/edc.rs index 838d964..fdd271a 100644 --- a/swiftnav/src/edc.rs +++ b/swiftnav/src/edc.rs @@ -14,8 +14,10 @@ /// This CRC is used with the RTCM protocol /// /// The CRC polynomial used is: +/// $$[ /// x^{24} + x^{23} + x^{18} + x^{17} + x^{14} + x^{11} + x^{10} + /// x^7 + x^6 + x^5 + x^4 + x^3 + x+1 +/// ]$$ /// /// Mask 0x1864CFB, not reversed, not XOR'd pub fn compute_crc24q(buf: &[u8], initial_value: u32) -> u32 { diff --git a/swiftnav/src/reference_frame/mod.rs b/swiftnav/src/reference_frame/mod.rs index b9a7c11..1898f95 100644 --- a/swiftnav/src/reference_frame/mod.rs +++ b/swiftnav/src/reference_frame/mod.rs @@ -138,18 +138,34 @@ pub enum ReferenceFrame { /// 15-parameter Helmert transformation parameters /// -/// This transformation consists of a 3 dimensional translation, -/// 3 dimensional rotation, and a universal scaling. All terms, -/// except for the reference epoch, have a an additional time -/// dependent term. The rotations are typically very small, so -/// the small angle approximation is used. +/// This is an extention of the 7-parameter Helmert transformation +/// where each term has an additional time-dependent term. This +/// transformation consists of a 3 dimensional translation, +/// 3 dimensional rotation, and a universal scaling. The tranformation +/// takes the form of: /// -/// There are several sign and scale conventions in use with -/// Helmert transformations. In this implementation we follow -/// the IERS conventions, meaning the translations are in -/// millimeters, the rotations are in milliarcseconds, and -/// the scaling is in parts per billion. We also follow the -/// IERS convention for the sign of the rotation terms. +/// $$ +/// \begin{bmatrix} X \\\\ Y \\\\ Z \end{bmatrix}\_{REF2} = +/// \begin{bmatrix} X \\\\ Y \\\\ Z \end{bmatrix}\_{REF1} + +/// \begin{bmatrix} \bar{t}_x \\\\ \bar{t}_y \\\\ \bar{t}_z \end{bmatrix} + +/// \begin{bmatrix} \bar{s} & -\bar{r}_z & \bar{r}_y \\\\ +/// \bar{r}_z & \bar{s} & -\bar{r}_x \\\\ +/// -\bar{r}_y & \bar{r}_x & \bar{s} \end{bmatrix} +/// \begin{bmatrix} X \\\\ Y \\\\ Z \end{bmatrix}\_{REF1} +/// $$ +/// +/// Where each $\bar{}$ parameter in the transformation is time +/// dependent and is defined to be: +/// +/// $$ \bar{p}(t) = p + \dot{p}(t - \tau) $$ +/// +/// Where $p$ is the constant value, $\dot{p}$ is the rate of +/// change, and $\tau$ is the reference epoch. +/// +/// There are several sign conventions in use for the rotation +/// parameters in Helmert transformations. In this implementation +/// we follow the IERS conventions, which is opposite of the original +/// formulation of the Helmert transformation. #[derive(Debug, PartialEq, PartialOrd, Clone, Copy)] pub struct TimeDependentHelmertParams { tx: f64, From 05a9d31096b6da8d7ab433037aaf388f2232ab50 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Mon, 21 Apr 2025 14:42:55 -0700 Subject: [PATCH 3/4] PR feedback --- swiftnav/src/reference_frame/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swiftnav/src/reference_frame/mod.rs b/swiftnav/src/reference_frame/mod.rs index 1898f95..d3c71b2 100644 --- a/swiftnav/src/reference_frame/mod.rs +++ b/swiftnav/src/reference_frame/mod.rs @@ -138,7 +138,7 @@ pub enum ReferenceFrame { /// 15-parameter Helmert transformation parameters /// -/// This is an extention of the 7-parameter Helmert transformation +/// This is an extension of the 7-parameter Helmert transformation /// where each term has an additional time-dependent term. This /// transformation consists of a 3 dimensional translation, /// 3 dimensional rotation, and a universal scaling. The tranformation From 75aec6752c205743868a6e4891ff35baad589c28 Mon Sep 17 00:00:00 2001 From: Joseph Angelo Date: Wed, 30 Apr 2025 12:59:04 -0700 Subject: [PATCH 4/4] Newline --- swiftnav/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swiftnav/Cargo.toml b/swiftnav/Cargo.toml index fc66bb9..ee393c6 100644 --- a/swiftnav/Cargo.toml +++ b/swiftnav/Cargo.toml @@ -21,4 +21,5 @@ float_eq = "1.0.1" # This tells docs.rs to include the katex header for math formatting # To do this locally [package.metadata.docs.rs] -rustdoc-args = [ "--html-in-header", "katex-header.html" ] \ No newline at end of file +rustdoc-args = [ "--html-in-header", "katex-header.html" ] +