-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add geophysical measurement configuration to strapdown-sim #217
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
Changes from all commits
4c96063
086a866
7c1d7be
e6d0e0f
b876f05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: "Copilot Setup Steps" | ||
|
|
||
| # Automatically run the setup steps when they are changed to allow for easy validation, and | ||
| # allow manual testing through the repository's "Actions" tab | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/copilot-setup-steps.yml | ||
|
|
||
| jobs: | ||
| # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | ||
| copilot-setup-steps: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # Set the permissions to the lowest permissions possible needed for your steps. | ||
| # Copilot will be given its own token for its operations. | ||
| permissions: | ||
| # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. | ||
| contents: write | ||
|
|
||
| # You can define any steps you want, and they will run before the agent starts. | ||
| # If you do not check out your code, Copilot will do this for you. | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y pkg-config \ | ||
| libhdf5-dev \ | ||
| libnetcdf-dev \ | ||
| libfreetype6-dev \ | ||
| libfontconfig-dev \ | ||
| gmt | ||
|
|
||
| - name: Install rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy, rustfmt | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,156 @@ | ||||||||||||||||||||||||||||||||||
| # Summary: Geophysical Measurement Configuration for strapdown-sim | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Changes Made | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| This update adds interactive configuration support for geophysical measurements (gravity and magnetic anomaly) to the `strapdown-sim config` command. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 1. Core Library Changes (`core/src/sim.rs`) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #### Added `geophysical` field to `SimulationConfig` | ||||||||||||||||||||||||||||||||||
| - New optional field: `pub geophysical: Option<GeophysicalConfig>` | ||||||||||||||||||||||||||||||||||
| - Updated `Default` implementation to include `geophysical: None` | ||||||||||||||||||||||||||||||||||
| - This allows the main simulation configuration to include geophysical parameters | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 2. CLI Changes (`sim/src/main.rs`) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #### New Prompt Functions | ||||||||||||||||||||||||||||||||||
| Added five new interactive prompt functions: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. **`prompt_enable_geophysical()`** - Asks if user wants to enable geophysical navigation | ||||||||||||||||||||||||||||||||||
| 2. **`prompt_geo_resolution(measurement_type: &str)`** - Prompts for map resolution (15 options from 1° to 1") | ||||||||||||||||||||||||||||||||||
| 3. **`prompt_gravity_config()`** - Configures gravity anomaly measurements: | ||||||||||||||||||||||||||||||||||
| - Map resolution | ||||||||||||||||||||||||||||||||||
| - Measurement bias (mGal) | ||||||||||||||||||||||||||||||||||
| - Noise standard deviation (mGal, default: 100.0) | ||||||||||||||||||||||||||||||||||
| - Map file path (optional, auto-detect if empty) | ||||||||||||||||||||||||||||||||||
| 4. **`prompt_magnetic_config()`** - Configures magnetic anomaly measurements: | ||||||||||||||||||||||||||||||||||
| - Map resolution | ||||||||||||||||||||||||||||||||||
| - Measurement bias (nT) | ||||||||||||||||||||||||||||||||||
| - Noise standard deviation (nT, default: 150.0) | ||||||||||||||||||||||||||||||||||
| - Map file path (optional, auto-detect if empty) | ||||||||||||||||||||||||||||||||||
| 5. **`prompt_geo_measurement_frequency()`** - Sets measurement frequency in seconds | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #### Updated `create_config_file()` Function | ||||||||||||||||||||||||||||||||||
| - Added "Geophysical Navigation Configuration" section | ||||||||||||||||||||||||||||||||||
| - Calls new prompt functions after GNSS degradation config | ||||||||||||||||||||||||||||||||||
| - Validates that at least one measurement type is enabled | ||||||||||||||||||||||||||||||||||
| - Builds and includes `GeophysicalConfig` in final `SimulationConfig` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 3. Documentation | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #### New Documentation File (`docs/GEOPHYSICAL_CONFIG.md`) | ||||||||||||||||||||||||||||||||||
| Comprehensive guide covering: | ||||||||||||||||||||||||||||||||||
| - Overview of geophysical configuration | ||||||||||||||||||||||||||||||||||
| - Step-by-step wizard usage | ||||||||||||||||||||||||||||||||||
| - Configuration file format | ||||||||||||||||||||||||||||||||||
| - Available resolution options | ||||||||||||||||||||||||||||||||||
| - Default values | ||||||||||||||||||||||||||||||||||
| - Example usage | ||||||||||||||||||||||||||||||||||
| - Notes and requirements | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 4. Example Configuration (`examples/configs/geonav_example.toml`) | ||||||||||||||||||||||||||||||||||
| Complete example configuration demonstrating: | ||||||||||||||||||||||||||||||||||
| - Gravity anomaly measurements setup | ||||||||||||||||||||||||||||||||||
| - Magnetic anomaly measurements setup | ||||||||||||||||||||||||||||||||||
| - Integration with closed-loop simulation | ||||||||||||||||||||||||||||||||||
| - TOML format with comments | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 5. Test Script (`test_geo_config_wizard.sh`) | ||||||||||||||||||||||||||||||||||
| Automated test script to verify the wizard functionality with simulated user input. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Features | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### User-Friendly Configuration | ||||||||||||||||||||||||||||||||||
| - Interactive prompts with clear options | ||||||||||||||||||||||||||||||||||
| - Default values for common parameters | ||||||||||||||||||||||||||||||||||
| - Input validation with helpful error messages | ||||||||||||||||||||||||||||||||||
| - Option to quit at any point with 'q' | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Flexible Measurement Configuration | ||||||||||||||||||||||||||||||||||
| - Enable/disable gravity measurements independently | ||||||||||||||||||||||||||||||||||
| - Enable/disable magnetic measurements independently | ||||||||||||||||||||||||||||||||||
| - Must enable at least one type if geophysical navigation is activated | ||||||||||||||||||||||||||||||||||
| - Auto-detection of map files if not specified | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Resolution Options | ||||||||||||||||||||||||||||||||||
| 15 resolution levels available for both gravity and magnetic maps: | ||||||||||||||||||||||||||||||||||
| - From coarse (1 degree) to fine (1 arcsecond) | ||||||||||||||||||||||||||||||||||
| - Default: One Minute (good balance of accuracy and file size) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Integration with Existing Workflow | ||||||||||||||||||||||||||||||||||
| - Seamlessly integrated into existing config wizard | ||||||||||||||||||||||||||||||||||
| - Follows same patterns as other configuration sections | ||||||||||||||||||||||||||||||||||
| - Compatible with all simulation modes | ||||||||||||||||||||||||||||||||||
| - Works with existing TOML/JSON/YAML config formats | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Usage Example | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| # Run the configuration wizard | ||||||||||||||||||||||||||||||||||
| strapdown-sim config | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # When prompted: | ||||||||||||||||||||||||||||||||||
| # 1. Enable geophysical navigation: y | ||||||||||||||||||||||||||||||||||
| # 2. Enable gravity measurements: y | ||||||||||||||||||||||||||||||||||
| # - Select resolution: 11 (OneMinute) | ||||||||||||||||||||||||||||||||||
| # - Set bias: 0.0 | ||||||||||||||||||||||||||||||||||
| # - Set noise std: 100.0 | ||||||||||||||||||||||||||||||||||
| # - Map file: (press Enter for auto-detect) | ||||||||||||||||||||||||||||||||||
| # 3. Enable magnetic measurements: y | ||||||||||||||||||||||||||||||||||
| # - Select resolution: 11 (OneMinute) | ||||||||||||||||||||||||||||||||||
| # - Set bias: 0.0 | ||||||||||||||||||||||||||||||||||
| # - Set noise std: 150.0 | ||||||||||||||||||||||||||||||||||
| # - Map file: (press Enter for auto-detect) | ||||||||||||||||||||||||||||||||||
| # 4. Set measurement frequency: 1.0 (seconds) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Use the generated config | ||||||||||||||||||||||||||||||||||
| strapdown-sim --config your_config.toml | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Configuration File Example | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```toml | ||||||||||||||||||||||||||||||||||
| [geophysical] | ||||||||||||||||||||||||||||||||||
| gravity_resolution = "OneMinute" | ||||||||||||||||||||||||||||||||||
| gravity_bias = 0.0 | ||||||||||||||||||||||||||||||||||
| gravity_noise_std = 100.0 | ||||||||||||||||||||||||||||||||||
| magnetic_resolution = "OneMinute" | ||||||||||||||||||||||||||||||||||
| magnetic_bias = 0.0 | ||||||||||||||||||||||||||||||||||
| magnetic_noise_std = 150.0 | ||||||||||||||||||||||||||||||||||
| geo_frequency_s = 1.0 | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Benefits | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. **Easier Setup**: No need to manually edit configuration files for geophysical measurements | ||||||||||||||||||||||||||||||||||
| 2. **Reduced Errors**: Input validation prevents common configuration mistakes | ||||||||||||||||||||||||||||||||||
| 3. **Better UX**: Interactive wizard guides users through all options | ||||||||||||||||||||||||||||||||||
| 4. **Documentation**: Clear prompts explain each parameter | ||||||||||||||||||||||||||||||||||
| 5. **Flexibility**: Users can enable only the measurements they need | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Testing | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - ✅ Code compiles without errors | ||||||||||||||||||||||||||||||||||
| - ✅ No clippy warnings in modified files | ||||||||||||||||||||||||||||||||||
| - ✅ All existing tests pass | ||||||||||||||||||||||||||||||||||
| - ✅ Markdown documentation passes linting | ||||||||||||||||||||||||||||||||||
| - ✅ Integration with existing config wizard verified | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Files Modified | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. `/home/james/Code/strapdown-rs/core/src/sim.rs` | ||||||||||||||||||||||||||||||||||
| 2. `/home/james/Code/strapdown-rs/sim/src/main.rs` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Files Added | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 1. `/home/james/Code/strapdown-rs/docs/GEOPHYSICAL_CONFIG.md` | ||||||||||||||||||||||||||||||||||
| 2. `/home/james/Code/strapdown-rs/examples/configs/geonav_example.toml` | ||||||||||||||||||||||||||||||||||
| 3. `/home/james/Code/strapdown-rs/test_geo_config_wizard.sh` | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+141
to
+148
|
||||||||||||||||||||||||||||||||||
| 1. `/home/james/Code/strapdown-rs/core/src/sim.rs` | |
| 2. `/home/james/Code/strapdown-rs/sim/src/main.rs` | |
| ## Files Added | |
| 1. `/home/james/Code/strapdown-rs/docs/GEOPHYSICAL_CONFIG.md` | |
| 2. `/home/james/Code/strapdown-rs/examples/configs/geonav_example.toml` | |
| 3. `/home/james/Code/strapdown-rs/test_geo_config_wizard.sh` | |
| 1. `core/src/sim.rs` | |
| 2. `sim/src/main.rs` | |
| ## Files Added | |
| 1. `docs/GEOPHYSICAL_CONFIG.md` | |
| 2. `examples/configs/geonav_example.toml` | |
| 3. `test_geo_config_wizard.sh` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Example configuration with geophysical measurements | ||
| # Generated by strapdown-sim config wizard | ||
|
|
||
| input = "data/input/sample.csv" | ||
| output = "data/output/geonav_result.csv" | ||
| mode = "ClosedLoop" | ||
| seed = 42 | ||
| parallel = false | ||
| generate_plot = false | ||
|
|
||
| [logging] | ||
| level = "info" | ||
|
|
||
| [closed_loop] | ||
| filter = "Ukf" | ||
|
|
||
| [geophysical] | ||
| # Gravity anomaly measurements | ||
| gravity_resolution = "OneMinute" | ||
| gravity_bias = 0.0 | ||
| gravity_noise_std = 100.0 | ||
| # gravity_map_file will be auto-detected if not specified | ||
|
|
||
| # Magnetic anomaly measurements | ||
| magnetic_resolution = "OneMinute" | ||
| magnetic_bias = 0.0 | ||
| magnetic_noise_std = 150.0 | ||
| # magnetic_map_file will be auto-detected if not specified | ||
|
|
||
| # Measurement frequency (seconds) | ||
| geo_frequency_s = 1.0 | ||
|
|
||
| [gnss_degradation] | ||
| seed = 42 | ||
|
|
||
| [gnss_degradation.scheduler] | ||
| type = "Always" | ||
|
|
||
| [gnss_degradation.fault] | ||
| type = "None" | ||
|
Comment on lines
+1
to
+40
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "you'll need the
contents: readpermission" but the actual permission is set tocontents: write. If this workflow only needs to read the repository (checkout and build), thencontents: readwould be more appropriate following the principle of least privilege. If write access is genuinely needed, the comment should be updated to explain why.