Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade #260

Merged
merged 6 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ If you need to reference this work, please use the following model:

`GeoRust RINEX Team (2023), RINEX: analysis and processing (Apache-2/MIT), https://georust.org`

RINEX-Cli
=========

`rinex-cli` is our main application, build it without any features to obtain its smallest form.
The available options are:

- `kml`: allows formatting PPP solutions as KML tracks
- `gpx`: allows formatting PPP solutions as GPX tracks
- `cggtts`: enable CGGTTS solutions solver

Formats & revisions
===================

Expand Down
2 changes: 1 addition & 1 deletion qc-traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ rustdoc-args = ["--cfg", "docrs", "--generate-link-to-definition"]
[dependencies]
thiserror = "1"
hifitime = { version = "4.0.0-alpha", optional = true }
gnss-rs = { version = "2.2", features = ["serde", "domes", "cospar"], optional = true }
gnss-rs = { version = "2.2.1", features = ["serde", "domes", "cospar"], optional = true }
17 changes: 9 additions & 8 deletions rinex-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ rust-version = "1.64"

[dependencies]
log = "0.4"
gpx = "0.10"
kml = "0.8"
walkdir = "2.4.0"
geo-types = "0.7.11"
env_logger = "0.11"
Expand All @@ -34,22 +32,25 @@ maud = "0.26"
clap = { version = "4.4.13", features = ["derive", "color"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }

kml = { version = "0.8", optional = true }
gpx = { version = "0.10", optional = true }

# plotly = "0.9"
# plotly = { path = "../../plotly-rs/plotly" }
plotly = { git = "https://github.com/gwbres/plotly", branch = "scattergeo" }

anise = { version = "0.4.2", features = ["embed_ephem"] }
hifitime = { version = "4.0.0-alpha", features = ["serde", "std"] }

gnss-rs = { version = "2.2.0", features = ["serde"] }
gnss-rs = { version = "2.2.1", features = ["serde"] }

# gnss-rtk = { version = "0.4.5", features = ["serde"] }
gnss-rtk = { version = "0.5.0", features = ["serde"] }
# gnss-rtk = { path = "../../rtk-rs/gnss-rtk", features = ["serde"] }
gnss-rtk = { git = "https://github.com/rtk-rs/gnss-rtk", branch = "main", features = ["serde"] }
# gnss-rtk = { git = "https://github.com/rtk-rs/gnss-rtk", branch = "main", features = ["serde"] }

# cggtts = { version = "4.1.4", features = ["serde", "scheduler"] }
# cggtts = { path = "../../cggtts/cggtts", features = ["serde", "scheduler"] }
cggtts = { git = "https://github.com/gwbres/cggtts", branch = "main", features = ["serde", "scheduler"] }
cggtts = { version = "4.1.5", features = ["serde", "scheduler"], optional = true }
# cggtts = { path = "../../cggtts/cggtts", features = ["serde", "scheduler"], optional = true }
# cggtts = { git = "https://github.com/gwbres/cggtts", branch = "main", features = ["serde", "scheduler"], optional = true }

rinex = { path = "../rinex", version = "=0.16.1", features = ["full"] }
sp3 = { path = "../sp3", version = "=1.0.8", features = ["serde", "flate2"] }
Expand Down
83 changes: 0 additions & 83 deletions rinex-cli/src/cli/identify.rs

This file was deleted.

115 changes: 76 additions & 39 deletions rinex-cli/src/cli/positioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use clap::{value_parser, Arg, ArgAction, Command};
use rinex::prelude::Duration;

pub fn subcommand() -> Command {
Command::new("ppp")
let cmd = Command::new("ppp")
.arg_required_else_help(false)
.about("Post Processed Positioning. Use this mode to deploy the precise position solver.
The solutions are added to the final report as an extra chapter. See --help")
Expand All @@ -22,42 +22,79 @@ Use --cggtts to convert solutions to CGGTTS special format.")
Read the [https://github.com/georust/rinex/wiki/Positioning] tutorial.
Use [https://github.com/georust/rinex/config] as a starting point.
[https://docs.rs/gnss-rtk/latest/gnss_rtk/prelude/struct.Config.html] is the structure to represent in JSON.
"))
.arg(Arg::new("gpx")
.long("gpx")
.action(ArgAction::SetTrue)
.help("Format PVT solutions as GPX track."))
.arg(Arg::new("kml")
.long("kml")
.action(ArgAction::SetTrue)
.help("Format PVT solutions as KML track."))
.next_help_heading("CGGTTS (special resolution for clock comparison / time transfer)")
.arg(Arg::new("cggtts")
.long("cggtts")
.action(ArgAction::SetTrue)
.help("Activate CGGTTS special solver. See --help.")
.long_help("Refer to the [https://github.com/georust/rinex/wiki/CGGTTS] tutorial."))
.arg(Arg::new("tracking")
.long("trk")
.short('t')
.value_parser(value_parser!(Duration))
.action(ArgAction::Set)
.help("CGGTTS custom tracking duration.
Otherwise, the default tracking duration is used. Refer to [https://docs.rs/cggtts/latest/cggtts/track/struct.Scheduler.html]."))
.arg(Arg::new("lab")
.long("lab")
.action(ArgAction::Set)
.help("Define the name of your station or laboratory here."))
.arg(Arg::new("utck")
.long("utck")
.action(ArgAction::Set)
.conflicts_with("clock")
.help("If the local clock tracks a local UTC replica, you can define the name
of this replica here."))
.arg(Arg::new("clock")
.long("clk")
.action(ArgAction::Set)
.conflicts_with("utck")
.help("If the local clock is not a UTC replica and has a specific name, you
can define it here."))
"));

let cmd = if cfg!(feature = "kml") {
cmd.arg(
Arg::new("kml")
.long("kml")
.action(ArgAction::SetTrue)
.help("Format PVT solutions as KML track."),
)
} else {
cmd.arg(
Arg::new("kml")
.long("kml")
.action(ArgAction::SetTrue)
.help("[NOT AVAILABLE] requires kml compilation option"),
)
};

let cmd = if cfg!(feature = "gpx") {
cmd.arg(
Arg::new("gpx")
.long("gpx")
.action(ArgAction::SetTrue)
.help("Format PVT solutions as GPX track."),
)
} else {
cmd.arg(
Arg::new("gpx")
.long("gpx")
.action(ArgAction::SetTrue)
.help("[NOT AVAILABLE] requires gpx compilation option"),
)
};

let cmd =
cmd.next_help_heading("CGGTTS (special resolution for clock comparison / time transfer)");

if cfg!(not(feature = "cggtts")) {
cmd.arg(
Arg::new("cggtts")
.long("cggtts")
.action(ArgAction::SetTrue)
.help("[NOT AVAILABLE] requires cggtts compilation option"),
)
} else {
cmd
.arg(Arg::new("cggtts")
.long("cggtts")
.action(ArgAction::SetTrue)
.help("Activate CGGTTS special solver. See --help.")
.long_help("Refer to the [https://github.com/georust/rinex/wiki/CGGTTS] tutorial."))
.arg(Arg::new("tracking")
.long("trk")
.short('t')
.value_parser(value_parser!(Duration))
.action(ArgAction::Set)
.help("CGGTTS custom tracking duration.
Otherwise, the default tracking duration is used. Refer to [https://docs.rs/cggtts/latest/cggtts/track/struct.Scheduler.html]."))
.arg(Arg::new("lab")
.long("lab")
.action(ArgAction::Set)
.help("Define the name of your station or laboratory here."))
.arg(Arg::new("utck")
.long("utck")
.action(ArgAction::Set)
.conflicts_with("clock")
.help("If the local clock tracks a local UTC replica, you can define the name
of this replica here."))
.arg(Arg::new("clock")
.long("clk")
.action(ArgAction::Set)
.conflicts_with("utck")
.help("If the local clock is not a UTC replica and has a specific name, you
can define it here."))
}
}
54 changes: 42 additions & 12 deletions rinex-cli/src/positioning/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ use std::fs::read_to_string;
// use anise::almanac::Almanac;

mod ppp; // precise point positioning
use ppp::Report as PPPReport;
use ppp::{
post_process::{post_process as ppp_post_process, Error as PPPPostError},
Report as PPPReport,
};

#[cfg(feature = "cggtts")]
mod cggtts; // CGGTTS special solver

#[cfg(feature = "cggtts")]
use cggtts::{post_process as cggtts_post_process, Report as CggttsReport};

use rinex::{
Expand Down Expand Up @@ -41,6 +47,8 @@ pub enum Error {
NoSolutions,
#[error("i/o error")]
StdioError(#[from] std::io::Error),
#[error("post process error")]
PPPPost(#[from] PPPPostError),
}

/*
Expand Down Expand Up @@ -227,9 +235,14 @@ pub fn precise_positioning(ctx: &Context, matches: &ArgMatches) -> Result<QcExtr
/*
* CGGTTS special case
*/
#[cfg(feature = "cggtts")]
if matches.get_flag("cggtts") {
cfg.sol_type = PVTSolutionType::TimeOnly;
}
#[cfg(not(feature = "cggtts"))]
if matches.get_flag("cggtts") {
panic!("--cggtts option not available: compile with cggtts option");
}

info!("Using custom solver configuration: {:#?}", cfg);
cfg
Expand All @@ -241,9 +254,14 @@ pub fn precise_positioning(ctx: &Context, matches: &ArgMatches) -> Result<QcExtr
/*
* CGGTTS special case
*/
#[cfg(feature = "cggtts")]
if matches.get_flag("cggtts") {
cfg.sol_type = PVTSolutionType::TimeOnly;
}
#[cfg(not(feature = "cggtts"))]
if matches.get_flag("cggtts") {
panic!("--cggtts option not available: compile with cggtts option");
}

info!("Using {:?} default preset: {:#?}", method, cfg);
cfg
Expand Down Expand Up @@ -297,6 +315,7 @@ pub fn precise_positioning(ctx: &Context, matches: &ArgMatches) -> Result<QcExtr

// The CGGTTS opmode (TimeOnly) is not designed
// to support lack of apriori knowledge
#[cfg(feature = "cggtts")]
let apriori = if matches.get_flag("cggtts") {
if let Some((x, y, z)) = ctx.rx_ecef {
let apriori_ecef = Vector3::new(x, y, z);
Expand All @@ -312,6 +331,9 @@ a static reference position"
None
};

#[cfg(not(feature = "cggtts"))]
let apriori = None;

//let almanac = Almanac::until_2035()
// .unwrap_or_else(|e| panic!("failed to retrieve latest Almanac: {}", e));

Expand All @@ -322,22 +344,30 @@ a static reference position"
|t, sv, _order| orbit.borrow_mut().next_at(t, sv),
)?;

#[cfg(feature = "cggtts")]
if matches.get_flag("cggtts") {
/* CGGTTS special opmode */
//* CGGTTS special opmode */
let tracks = cggtts::resolve(ctx, solver, matches)?;
cggtts_post_process(&ctx, &tracks, matches)?;
let report = CggttsReport::new(&ctx, &tracks);
Ok(report.formalize())
} else {
/* PPP */
let solutions = ppp::resolve(ctx, solver);
if solutions.len() > 0 {
let report = PPPReport::new(&cfg, &ctx, &solutions);
Ok(report.formalize())
if !tracks.is_empty() {
cggtts_post_process(&ctx, &tracks, matches)?;
let report = CggttsReport::new(&ctx, &tracks);
return Ok(report.formalize());
} else {
error!("solver did not generate a single solution");
error!("verify your input data and configuration setup");
Err(Error::NoSolutions)
return Err(Error::NoSolutions);
}
}

/* PPP */
let solutions = ppp::resolve(ctx, solver);
if !solutions.is_empty() {
ppp_post_process(&ctx, &solutions, matches)?;
let report = PPPReport::new(&cfg, &ctx, &solutions);
Ok(report.formalize())
} else {
error!("solver did not generate a single solution");
error!("verify your input data and configuration setup");
Err(Error::NoSolutions)
}
}
2 changes: 2 additions & 0 deletions rinex-cli/src/positioning/ppp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use rinex::{carrier::Carrier, observation::LliFlags, prelude::SV};
mod report;
pub use report::Report;

pub mod post_process;

use rtk::prelude::{
Candidate, Epoch, InterpolationResult, IonosphereBias, PVTSolution, PhaseRange, PseudoRange,
Solver, TroposphereBias,
Expand Down
Loading
Loading