Skip to content

Commit 87d4469

Browse files
Copilotjbrodovsky
andcommitted
Add documentation for HDF5 data format support
Co-authored-by: jbrodovsky <57160841+jbrodovsky@users.noreply.github.com>
1 parent aca3615 commit 87d4469

2 files changed

Lines changed: 86 additions & 6 deletions

File tree

core/README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,54 @@ The toolbox is designed for research, teaching, and development purposes and aim
2020

2121
The simulation program provides a simple command line interface for running various configurations of the INS. In can run in open-loop (dead reckoning) mode or closed-loop (full state loosely couple UKF) mode. It can simulate various scenarios such as intermittent GPS, GPS degradation, and more. The simulation is designed to be easy to use and provides a simple API for generating datsets for further navigation processing or research.
2222

23-
Both `strapdown-sim` and `geonav-sim` include built-in logging capabilities using the Rust `log` crate. Library functions use log macros for diagnostic output that can be captured by any logging backend.
23+
Both `strapdown-sim` and `geonav-sim` include built-in logging capabilities using the Rust `log` crate. Library functions use log macros for diagnostic output that can be captured by any logging backend.
24+
25+
## Data Formats
26+
27+
The library supports both CSV and HDF5 file formats for input and output data.
28+
29+
### CSV Format
30+
31+
CSV is the default format for compatibility and ease of inspection. The library can read and write:
32+
- **TestDataRecord**: Input sensor data (IMU, GNSS, magnetometer, barometer) from apps like Sensor Logger
33+
- **NavigationResult**: Output navigation solutions (position, velocity, attitude, biases, and covariances)
34+
35+
```rust
36+
use strapdown::sim::{TestDataRecord, NavigationResult};
37+
38+
// Read CSV files
39+
let input_data = TestDataRecord::from_csv("sensor_data.csv")?;
40+
let results = NavigationResult::from_csv("nav_results.csv")?;
41+
42+
// Write CSV files
43+
TestDataRecord::to_csv(&input_data, "sensor_data_out.csv")?;
44+
NavigationResult::to_csv(&results, "nav_results_out.csv")?;
45+
```
46+
47+
### HDF5 Format
48+
49+
HDF5 provides efficient storage for large datasets with better compression and faster I/O:
50+
51+
```rust
52+
use strapdown::sim::{TestDataRecord, NavigationResult};
53+
54+
// Read HDF5 files
55+
let input_data = TestDataRecord::from_hdf5("sensor_data.h5")?;
56+
let results = NavigationResult::from_hdf5("nav_results.h5")?;
57+
58+
// Write HDF5 files
59+
TestDataRecord::to_hdf5(&input_data, "sensor_data_out.h5")?;
60+
NavigationResult::to_hdf5(&results, "nav_results_out.h5")?;
61+
```
62+
63+
**HDF5 File Structure:**
64+
- TestDataRecord data is stored in a `/test_data` group
65+
- NavigationResult data is stored in a `/navigation_results` group
66+
- Each field is stored as a separate dataset within the group
67+
- Timestamps are stored as RFC3339-formatted strings
68+
69+
The HDF5 format is particularly useful for:
70+
- Large datasets that benefit from compression
71+
- Integration with scientific computing workflows (Python, MATLAB, Julia)
72+
- Parallel I/O operations
73+
- Hierarchical data organization

core/src/sim.rs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,42 @@
1-
//! Simulation utilities and CSV data loading for strapdown inertial navigation.
1+
//! Simulation utilities and data I/O for strapdown inertial navigation.
22
//!
33
//! This module provides tools for simulating and evaluating strapdown inertial navigation systems.
44
//! It is primarily designed to work with data produced from the [Sensor Logger](https://www.tszheichoi.com/sensorlogger)
55
//! app, as such it makes assumptions about the data format and structure that that corresponds to
6-
//! how that app records data. That data is typically stored in CSV format and is represented by the
7-
//! `TestDataRecord` struct. This struct is fairly comprehensive and should be easily reusable for
8-
//! other applications. Modeling off of that struct is the `NavigationResult` struct which is used
9-
//! to store navigation solutions from simulations, such as dead reckoning or Kalman filtering.
6+
//! how that app records data.
7+
//!
8+
//! # Data Structures
9+
//!
10+
//! - **`TestDataRecord`**: Input sensor data including IMU, GNSS, magnetometer, and barometer measurements
11+
//! - **`NavigationResult`**: Output navigation solutions including position, velocity, attitude, biases, and covariances
12+
//!
13+
//! Both structures support CSV and HDF5 file formats for input and output:
14+
//!
15+
//! ## CSV Format
16+
//! ```no_run
17+
//! use strapdown::sim::{TestDataRecord, NavigationResult};
18+
//!
19+
//! // Read and write CSV files
20+
//! let data = TestDataRecord::from_csv("sensor_data.csv").unwrap();
21+
//! TestDataRecord::to_csv(&data, "output.csv").unwrap();
22+
//!
23+
//! let results = NavigationResult::from_csv("nav_results.csv").unwrap();
24+
//! NavigationResult::to_csv(&results, "output.csv").unwrap();
25+
//! ```
26+
//!
27+
//! ## HDF5 Format
28+
//! ```no_run
29+
//! use strapdown::sim::{TestDataRecord, NavigationResult};
30+
//!
31+
//! // Read and write HDF5 files
32+
//! let data = TestDataRecord::from_hdf5("sensor_data.h5").unwrap();
33+
//! TestDataRecord::to_hdf5(&data, "output.h5").unwrap();
34+
//!
35+
//! let results = NavigationResult::from_hdf5("nav_results.h5").unwrap();
36+
//! NavigationResult::to_hdf5(&results, "output.h5").unwrap();
37+
//! ```
38+
//!
39+
//! # Simulation Functions
1040
//!
1141
//! This module also provides basic functionality for analyzing canonical strapdown inertial navigation
1242
//! systems via the `dead_reckoning` and `closed_loop` functions. The `closed_loop` function in particular

0 commit comments

Comments
 (0)