Skip to content

Commit c78a402

Browse files
committed
Fix compilation errors
1 parent bf54558 commit c78a402

File tree

5 files changed

+17
-43
lines changed

5 files changed

+17
-43
lines changed

swiftnav-sys/build.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ fn main() {
5454
"{}/include/swiftnav/single_epoch_solver.h",
5555
dst.display()
5656
))
57-
.header(format!(
58-
"{}/include/swiftnav/correct_iono_tropo.h",
59-
dst.display()
60-
))
6157
// Tell cargo to invalidate the built crate whenever any of the
6258
// included header files changed.
6359
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
@@ -164,14 +160,13 @@ fn main() {
164160
.allowlist_var("NAV_MEAS_FLAG_CODE_VALID")
165161
.allowlist_var("NAV_MEAS_FLAG_MEAS_DOPPLER_VALID")
166162
.allowlist_var("NAV_MEAS_FLAG_CN0_VALID")
163+
.allowlist_type("obs_mask_config_t")
167164
.allowlist_function("sid_set_init")
168165
.allowlist_function("sid_set_get_sat_count")
169166
.allowlist_function("sid_set_get_sig_count")
170167
.allowlist_function("sid_set_contains")
171168
.allowlist_function("calc_PVT")
172169
.allowlist_var("pvt_err_msg")
173-
.allowlist_function("correct_iono")
174-
.allowlist_function("correct_tropo")
175170
.allowlist_type("geoid_model_t")
176171
.allowlist_function("get_geoid_offset")
177172
.allowlist_function("get_geoid_model")

swiftnav/src/ionosphere.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! # References
1717
//! * IS-GPS-200H, Section 20.3.3.5.2.5 and Figure 20-4
1818
19-
use crate::{coords::ECEF, navmeas::NavigationMeasurement, time::GpsTime};
19+
use crate::time::GpsTime;
2020
use std::error::Error;
2121
use std::fmt::{Display, Formatter};
2222

@@ -37,10 +37,6 @@ impl Display for IonoDecodeFailure {
3737
impl Error for IonoDecodeFailure {}
3838

3939
impl Ionosphere {
40-
fn as_ptr(&self) -> *const swiftnav_sys::ionosphere_t {
41-
&self.0
42-
}
43-
4440
/// Construct an ionosphere model from already decoded parameters
4541
#[allow(clippy::too_many_arguments)]
4642
pub fn new(
@@ -110,19 +106,6 @@ impl Ionosphere {
110106
pub fn calc_delay(&self, t: &GpsTime, lat_u: f64, lon_u: f64, a: f64, e: f64) -> f64 {
111107
unsafe { swiftnav_sys::calc_ionosphere(t.c_ptr(), lat_u, lon_u, a, e, &self.0) }
112108
}
113-
114-
/// Apply ionosphere corrections to a set of measurements
115-
pub fn correct_measurements(&self, pos: ECEF, measurements: &mut [NavigationMeasurement]) {
116-
assert!(measurements.len() <= std::u8::MAX as usize);
117-
unsafe {
118-
swiftnav_sys::correct_iono(
119-
pos.as_single_ptr(),
120-
self.as_ptr(),
121-
measurements.len() as u8,
122-
measurements.as_mut_ptr() as *mut swiftnav_sys::navigation_measurement_t,
123-
);
124-
}
125-
}
126109
}
127110

128111
#[cfg(test)]

swiftnav/src/navmeas.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ impl NavigationMeasurement {
4141
///
4242
/// Units of meters, time of flight multiplied by speed of light
4343
pub fn set_pseudorange(&mut self, value: f64) {
44-
self.0.pseudorange = value;
44+
self.0.raw_pseudorange = value;
4545
self.0.flags |= NAV_MEAS_FLAG_CODE_VALID;
4646
}
4747

4848
/// Gets the pseudorange measurement, if a valid one has been set
4949
pub fn pseudorange(&self) -> Option<f64> {
5050
if self.0.flags & NAV_MEAS_FLAG_CODE_VALID != 0 {
51-
Some(self.0.pseudorange)
51+
Some(self.0.raw_pseudorange)
5252
} else {
5353
None
5454
}
@@ -63,14 +63,14 @@ impl NavigationMeasurement {
6363
///
6464
/// Units of Hertz
6565
pub fn set_measured_doppler(&mut self, value: f64) {
66-
self.0.measured_doppler = value;
66+
self.0.raw_measured_doppler = value;
6767
self.0.flags |= NAV_MEAS_FLAG_MEAS_DOPPLER_VALID;
6868
}
6969

7070
/// Gets the measured doppler measurement, if a valid one has been set
7171
pub fn measured_doppler(&self) -> Option<f64> {
7272
if self.0.flags & NAV_MEAS_FLAG_MEAS_DOPPLER_VALID != 0 {
73-
Some(self.0.measured_doppler)
73+
Some(self.0.raw_measured_doppler)
7474
} else {
7575
None
7676
}

swiftnav/src/solver.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,14 @@ pub fn calc_pvt(
402402
let mut dops = Dops::new();
403403
let mut sidset = SidSet::new();
404404

405+
// TODO expose this via the PvtSettings
406+
let obs_config = swiftnav_sys::obs_mask_config_t {
407+
cn0_mask: swiftnav_sys::cn0_mask_t {
408+
enable: false,
409+
threshold_dbhz: 0.0,
410+
},
411+
};
412+
405413
let result = unsafe {
406414
let meas_ptr =
407415
measurements.as_ptr() as *const [swiftnav_sys::navigation_measurement_t; 0usize];
@@ -411,6 +419,7 @@ pub fn calc_pvt(
411419
tor.c_ptr(),
412420
settings.disable_raim,
413421
settings.disable_velocity,
422+
&obs_config,
414423
settings.strategy.to_processing_strategy_t(),
415424
&mut solution.0,
416425
&mut dops.0,

swiftnav/src/troposphere.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,13 @@
1515
//! # References
1616
//! * UNB Neutral Atmosphere Models: Development and Performance. R Leandro,
1717
//! M Santos, and R B Langley
18-
use crate::{coords::ECEF, navmeas::NavigationMeasurement, time::GpsTime};
1918
2019
/// Calculate tropospheric delay using UNM3m model.
2120
///
2221
/// Requires the time of the delay, the latitude (rad) and height (m) of the
2322
/// receiver, and the elevation of the satellite (rad)
24-
pub fn calc_delay(t: &GpsTime, lat: f64, h: f64, el: f64) -> f64 {
25-
unsafe { swiftnav_sys::calc_troposphere(t.c_ptr(), lat, h, el) }
26-
}
27-
28-
/// Apply troposphere corrections to a set of measurements
29-
pub fn correct_measurements(pos: ECEF, measurements: &mut [NavigationMeasurement]) {
30-
assert!(measurements.len() <= std::u8::MAX as usize);
31-
unsafe {
32-
swiftnav_sys::correct_tropo(
33-
pos.as_single_ptr(),
34-
measurements.len() as u8,
35-
measurements.as_mut_ptr() as *mut swiftnav_sys::navigation_measurement_t,
36-
);
37-
}
23+
pub fn calc_delay(doy: f64, lat: f64, h: f64, el: f64) -> f64 {
24+
unsafe { swiftnav_sys::calc_troposphere(doy, lat, h, el) }
3825
}
3926

4027
#[cfg(test)]

0 commit comments

Comments
 (0)