Skip to content

Commit 21aad98

Browse files
committed
removed debugging println!s
1 parent 72a11d4 commit 21aad98

3 files changed

Lines changed: 17 additions & 27 deletions

File tree

core/src/filter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ impl UKF {
444444
for sigma_point in &mut sigma_points {
445445
sigma_point.forward(imu_data, dt, None);
446446
}
447-
println!("predicted sigma points");
448447
let mut mu_bar = DVector::<f64>::zeros(self.state_size);
449448
// Update the mean state through a naive loop
450449
for (i, sigma_point) in sigma_points.iter().enumerate() {

core/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,15 @@ fn write_results_to_csv(
3535
}
3636
fn main() -> Result<(), Box<dyn Error>> {
3737
let args = Args::parse();
38-
3938
// Read the input CSV file
40-
let mut rdr = ReaderBuilder::new().from_path(args.input)?;
41-
39+
let mut rdr = ReaderBuilder::new().from_path(&args.input)?;
4240
// Validate the mode
4341
if args.mode != "open-loop" && args.mode != "closed-loop" {
4442
return Err("Invalid mode specified. Use 'open-loop' or 'closed-loop'.".into());
4543
}
46-
4744
let records: Vec<TestDataRecord> = rdr.deserialize().collect::<Result<_, _>>()?;
45+
println!("Read {} records from {}", records.len(), &args.input.display());
4846
let results: Vec<NavigationResult>;
49-
5047
if args.mode == "closed-loop" {
5148
results = closed_loop(&records);
5249
match write_results_to_csv(&results, &args.output) {

core/src/sim.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -570,22 +570,17 @@ pub fn closed_loop(records: &[TestDataRecord]) -> Vec<NavigationResult> {
570570
// Iterate through the records, updating the UKF with each IMU measurement
571571
let total: usize = records.len();
572572
let mut i: usize = 1;
573-
println!("Initialized UKF: \n {:?}", ukf);
574-
// clip to first 10 records for testing
575-
//let records = records.iter().take(10).collect::<Vec<_>>();
576-
577573
for record in records.iter().skip(1) {
578-
println!("Processing record {}/{}", i, total);
579574
// Print progress every 100 iterations
580-
581-
// if i % 10 == 0 || i == total - 1 {
582-
// print!(
583-
// "\rProcessing data {:.2}%...",
584-
// (i as f64 / total as f64) * 100.0
585-
// );
586-
// use std::io::Write;
587-
// std::io::stdout().flush().ok();
588-
// }
575+
if i % 10 == 0 || i == total - 1 {
576+
print!(
577+
"\rProcessing data {:.2}%...",
578+
(i as f64 / total as f64) * 100.0
579+
);
580+
//print_ukf(&ukf, record);
581+
use std::io::Write;
582+
std::io::stdout().flush().ok();
583+
}
589584
// Calculate time difference from the previous record
590585
let current_timestamp = record.time;
591586
let dt = (current_timestamp - previous_timestamp).as_seconds_f64();
@@ -605,8 +600,7 @@ pub fn closed_loop(records: &[TestDataRecord]) -> Vec<NavigationResult> {
605600
);
606601
// Update the UKF with the IMU data
607602
ukf.predict(&imu_data, dt);
608-
println!("predicted!");
609-
print_ukf(&ukf, record);
603+
610604
// If GPS data is available, update the UKF with the GPS measurement
611605
if !record.latitude.is_nan() && !record.longitude.is_nan() && !record.altitude.is_nan() {
612606
let measurement = DVector::from_vec(vec![
@@ -638,7 +632,7 @@ pub fn closed_loop(records: &[TestDataRecord]) -> Vec<NavigationResult> {
638632
results
639633
}
640634
pub fn print_ukf(ukf: &UKF, record: &TestDataRecord) {
641-
println!("UKF position: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4} | Error: {:.4e}, {:.4e}, {:.4}",
635+
println!("\rUKF position: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4} | Error: {:.4e}, {:.4e}, {:.4}",
642636
ukf.get_mean()[0].to_degrees(),
643637
ukf.get_mean()[1].to_degrees(),
644638
ukf.get_mean()[2],
@@ -649,7 +643,7 @@ pub fn print_ukf(ukf: &UKF, record: &TestDataRecord) {
649643
ukf.get_mean()[1].to_degrees() - record.longitude,
650644
ukf.get_mean()[2] - record.altitude
651645
);
652-
println!("UKF velocity: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4}, {:.4}, {:.4} | Error: {:.4}, {:.4}, {:.4}",
646+
println!("\rUKF velocity: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4}, {:.4}, {:.4} | Error: {:.4}, {:.4}, {:.4}",
653647
ukf.get_mean()[3],
654648
ukf.get_mean()[4],
655649
ukf.get_mean()[5],
@@ -660,7 +654,7 @@ pub fn print_ukf(ukf: &UKF, record: &TestDataRecord) {
660654
ukf.get_mean()[4] - record.speed * record.bearing.sin(),
661655
ukf.get_mean()[5] - 0.0 // Assuming no vertical velocity
662656
);
663-
println!("UKF attitude: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4}, {:.4}, {:.4} | Error: {:.4}, {:.4}, {:.4}",
657+
println!("\rUKF attitude: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4}, {:.4}, {:.4} | Error: {:.4}, {:.4}, {:.4}",
664658
ukf.get_mean()[6],
665659
ukf.get_mean()[7],
666660
ukf.get_mean()[8],
@@ -671,15 +665,15 @@ pub fn print_ukf(ukf: &UKF, record: &TestDataRecord) {
671665
ukf.get_mean()[7] - record.pitch,
672666
ukf.get_mean()[8] - record.yaw
673667
);
674-
println!("UKF accel biases: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4e}",
668+
println!("\rUKF accel biases: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4e}",
675669
ukf.get_mean()[9],
676670
ukf.get_mean()[10],
677671
ukf.get_mean()[11],
678672
ukf.get_covariance()[(9,9)],
679673
ukf.get_covariance()[(10,10)],
680674
ukf.get_covariance()[(11,11)]
681675
);
682-
println!("UKF gyro biases: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4e}",
676+
println!("\rUKF gyro biases: ({:.4}, {:.4}, {:.4}) | Covariance: {:.4e}, {:.4e}, {:.4e}",
683677
ukf.get_mean()[12],
684678
ukf.get_mean()[13],
685679
ukf.get_mean()[14],

0 commit comments

Comments
 (0)