Skip to content

Commit

Permalink
Improve CGGTTS formatting (#211)
Browse files Browse the repository at this point in the history
- sort solutions in time
  - open file when -q is not active

Signed-off-by: Guillaume W. Bres <[email protected]>
  • Loading branch information
gwbres authored Mar 18, 2024
1 parent 418ae3b commit 754b134
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 0 additions & 2 deletions rinex-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ plotly = "0.8.4"

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

# cggtts
cggtts = { version = "4.1.4", features = ["serde", "scheduler"] }
# cggtts = { git = "https://github.com/gwbres/cggtts", branch = "develop", features = ["serde", "scheduler"] }
# cggtts = { path = "../../cggtts/cggtts", features = ["serde", "scheduler"] }
19 changes: 16 additions & 3 deletions rinex-cli/src/positioning/cggtts/post_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ pub enum Error {
IoError(#[from] std::io::Error),
}

use crate::fops::open_with_web_browser;

/*
* CGGTTS file generation and solutions post processing
*/
pub fn post_process(ctx: &Context, tracks: Vec<Track>, matches: &ArgMatches) -> Result<(), Error> {
pub fn post_process(
ctx: &Context,
mut tracks: Vec<Track>,
matches: &ArgMatches,
) -> Result<(), Error> {
/*
* CGGTTS formation and customization
*/
Expand Down Expand Up @@ -51,11 +57,11 @@ pub fn post_process(ctx: &Context, tracks: Vec<Track>, matches: &ArgMatches) ->
.receiver(rcvr.clone())
.ims(rcvr.clone()) // TODO : improve this ?
.apc_coordinates({
// TODO: wrong, CGGTTS wants ITRF: need some conversion
// TODO: wrong, coordinates should be expressed in ITRF: need some conversion
let (x, y, z) = ctx.rx_ecef.unwrap(); // infallible at this point
Coordinates { x, y, z }
})
.reference_frame("WGS84") //TODO incorrect
.reference_frame("WGS84") //TODO: ITRF
.reference_time({
if let Some(utck) = matches.get_one::<String>("utck") {
ReferenceTime::UTCk(utck.clone())
Expand All @@ -70,6 +76,8 @@ pub fn post_process(ctx: &Context, tracks: Vec<Track>, matches: &ArgMatches) ->
env!("CARGO_PKG_VERSION")
));

tracks.sort_by(|a, b| a.epoch.cmp(&b.epoch));

for track in tracks {
cggtts.tracks.push(track);
}
Expand All @@ -79,5 +87,10 @@ pub fn post_process(ctx: &Context, tracks: Vec<Track>, matches: &ArgMatches) ->
write!(fd, "{}", cggtts)?;
info!("{} has been generated", filename.to_string_lossy());

if !ctx.quiet {
let path = filename.to_string_lossy().to_string();
open_with_web_browser(&path);
}

Ok(())
}

0 comments on commit 754b134

Please sign in to comment.