Skip to content

Commit 164b459

Browse files
authored
Merge branch 'main' into jbrodovsky/issue216
2 parents bca669a + dd0777f commit 164b459

32 files changed

Lines changed: 794 additions & 1 deletion
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for your steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
# 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.
23+
contents: write
24+
25+
# You can define any steps you want, and they will run before the agent starts.
26+
# If you do not check out your code, Copilot will do this for you.
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Install system dependencies
32+
run: |
33+
sudo apt update
34+
sudo apt install -y pkg-config \
35+
libhdf5-dev \
36+
libnetcdf-dev \
37+
libfreetype6-dev \
38+
libfontconfig-dev \
39+
gmt
40+
41+
- name: Install rust
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
components: clippy, rustfmt

GEOPHYSICAL_CONFIG_CHANGES.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# Summary: Geophysical Measurement Configuration for strapdown-sim
2+
3+
## Changes Made
4+
5+
This update adds interactive configuration support for geophysical measurements (gravity and magnetic anomaly) to the `strapdown-sim config` command.
6+
7+
### 1. Core Library Changes (`core/src/sim.rs`)
8+
9+
#### Added `geophysical` field to `SimulationConfig`
10+
- New optional field: `pub geophysical: Option<GeophysicalConfig>`
11+
- Updated `Default` implementation to include `geophysical: None`
12+
- This allows the main simulation configuration to include geophysical parameters
13+
14+
### 2. CLI Changes (`sim/src/main.rs`)
15+
16+
#### New Prompt Functions
17+
Added five new interactive prompt functions:
18+
19+
1. **`prompt_enable_geophysical()`** - Asks if user wants to enable geophysical navigation
20+
2. **`prompt_geo_resolution(measurement_type: &str)`** - Prompts for map resolution (15 options from 1° to 1")
21+
3. **`prompt_gravity_config()`** - Configures gravity anomaly measurements:
22+
- Map resolution
23+
- Measurement bias (mGal)
24+
- Noise standard deviation (mGal, default: 100.0)
25+
- Map file path (optional, auto-detect if empty)
26+
4. **`prompt_magnetic_config()`** - Configures magnetic anomaly measurements:
27+
- Map resolution
28+
- Measurement bias (nT)
29+
- Noise standard deviation (nT, default: 150.0)
30+
- Map file path (optional, auto-detect if empty)
31+
5. **`prompt_geo_measurement_frequency()`** - Sets measurement frequency in seconds
32+
33+
#### Updated `create_config_file()` Function
34+
- Added "Geophysical Navigation Configuration" section
35+
- Calls new prompt functions after GNSS degradation config
36+
- Validates that at least one measurement type is enabled
37+
- Builds and includes `GeophysicalConfig` in final `SimulationConfig`
38+
39+
### 3. Documentation
40+
41+
#### New Documentation File (`docs/GEOPHYSICAL_CONFIG.md`)
42+
Comprehensive guide covering:
43+
- Overview of geophysical configuration
44+
- Step-by-step wizard usage
45+
- Configuration file format
46+
- Available resolution options
47+
- Default values
48+
- Example usage
49+
- Notes and requirements
50+
51+
### 4. Example Configuration (`examples/configs/geonav_example.toml`)
52+
Complete example configuration demonstrating:
53+
- Gravity anomaly measurements setup
54+
- Magnetic anomaly measurements setup
55+
- Integration with closed-loop simulation
56+
- TOML format with comments
57+
58+
### 5. Test Script (`test_geo_config_wizard.sh`)
59+
Automated test script to verify the wizard functionality with simulated user input.
60+
61+
## Features
62+
63+
### User-Friendly Configuration
64+
- Interactive prompts with clear options
65+
- Default values for common parameters
66+
- Input validation with helpful error messages
67+
- Option to quit at any point with 'q'
68+
69+
### Flexible Measurement Configuration
70+
- Enable/disable gravity measurements independently
71+
- Enable/disable magnetic measurements independently
72+
- Must enable at least one type if geophysical navigation is activated
73+
- Auto-detection of map files if not specified
74+
75+
### Resolution Options
76+
15 resolution levels available for both gravity and magnetic maps:
77+
- From coarse (1 degree) to fine (1 arcsecond)
78+
- Default: One Minute (good balance of accuracy and file size)
79+
80+
### Integration with Existing Workflow
81+
- Seamlessly integrated into existing config wizard
82+
- Follows same patterns as other configuration sections
83+
- Compatible with all simulation modes
84+
- Works with existing TOML/JSON/YAML config formats
85+
86+
## Usage Example
87+
88+
```bash
89+
# Run the configuration wizard
90+
strapdown-sim config
91+
92+
# When prompted:
93+
# 1. Enable geophysical navigation: y
94+
# 2. Enable gravity measurements: y
95+
# - Select resolution: 11 (OneMinute)
96+
# - Set bias: 0.0
97+
# - Set noise std: 100.0
98+
# - Map file: (press Enter for auto-detect)
99+
# 3. Enable magnetic measurements: y
100+
# - Select resolution: 11 (OneMinute)
101+
# - Set bias: 0.0
102+
# - Set noise std: 150.0
103+
# - Map file: (press Enter for auto-detect)
104+
# 4. Set measurement frequency: 1.0 (seconds)
105+
106+
# Use the generated config
107+
strapdown-sim --config your_config.toml
108+
```
109+
110+
## Configuration File Example
111+
112+
```toml
113+
[geophysical]
114+
gravity_resolution = "OneMinute"
115+
gravity_bias = 0.0
116+
gravity_noise_std = 100.0
117+
magnetic_resolution = "OneMinute"
118+
magnetic_bias = 0.0
119+
magnetic_noise_std = 150.0
120+
geo_frequency_s = 1.0
121+
```
122+
123+
## Benefits
124+
125+
1. **Easier Setup**: No need to manually edit configuration files for geophysical measurements
126+
2. **Reduced Errors**: Input validation prevents common configuration mistakes
127+
3. **Better UX**: Interactive wizard guides users through all options
128+
4. **Documentation**: Clear prompts explain each parameter
129+
5. **Flexibility**: Users can enable only the measurements they need
130+
131+
## Testing
132+
133+
- ✅ Code compiles without errors
134+
- ✅ No clippy warnings in modified files
135+
- ✅ All existing tests pass
136+
- ✅ Markdown documentation passes linting
137+
- ✅ Integration with existing config wizard verified
138+
139+
## Files Modified
140+
141+
1. `/home/james/Code/strapdown-rs/core/src/sim.rs`
142+
2. `/home/james/Code/strapdown-rs/sim/src/main.rs`
143+
144+
## Files Added
145+
146+
1. `/home/james/Code/strapdown-rs/docs/GEOPHYSICAL_CONFIG.md`
147+
2. `/home/james/Code/strapdown-rs/examples/configs/geonav_example.toml`
148+
3. `/home/james/Code/strapdown-rs/test_geo_config_wizard.sh`
149+
150+
## Next Steps
151+
152+
Users can now:
153+
1. Run `strapdown-sim config` to create configurations with geophysical measurements
154+
2. Refer to `docs/GEOPHYSICAL_CONFIG.md` for detailed documentation
155+
3. Use `examples/configs/geonav_example.toml` as a template
156+
4. Test the wizard with `test_geo_config_wizard.sh`

analysis/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ build-backend = "uv_build"
2424

2525
[project.scripts]
2626
analyze = "analysis.__init__:main"
27-
# generate-report = "analysis.scripts.report:generate"
27+
# generate-report = "analysis.scripts.report:generate"

conf/geonav_example.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Example configuration with geophysical measurements
2+
# Generated by strapdown-sim config wizard
3+
4+
input = "data/input/sample.csv"
5+
output = "data/output/geonav_result.csv"
6+
mode = "ClosedLoop"
7+
seed = 42
8+
parallel = false
9+
generate_plot = false
10+
11+
[logging]
12+
level = "info"
13+
14+
[closed_loop]
15+
filter = "Ukf"
16+
17+
[geophysical]
18+
# Gravity anomaly measurements
19+
gravity_resolution = "OneMinute"
20+
gravity_bias = 0.0
21+
gravity_noise_std = 100.0
22+
# gravity_map_file will be auto-detected if not specified
23+
24+
# Magnetic anomaly measurements
25+
magnetic_resolution = "OneMinute"
26+
magnetic_bias = 0.0
27+
magnetic_noise_std = 150.0
28+
# magnetic_map_file will be auto-detected if not specified
29+
30+
# Measurement frequency (seconds)
31+
geo_frequency_s = 1.0
32+
33+
[gnss_degradation]
34+
seed = 42
35+
36+
[gnss_degradation.scheduler]
37+
type = "Always"
38+
39+
[gnss_degradation.fault]
40+
type = "None"

core/src/sim.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,6 +2983,9 @@ pub struct SimulationConfig {
29832983
/// Particle filter specific settings (only used if mode is ParticleFilter)
29842984
#[serde(default, skip_serializing_if = "Option::is_none")]
29852985
pub particle_filter: Option<ParticleFilterConfig>,
2986+
/// Geophysical measurement configuration (optional, requires --features geonav)
2987+
#[serde(default, skip_serializing_if = "Option::is_none")]
2988+
pub geophysical: Option<GeophysicalConfig>,
29862989
/// GNSS degradation configuration (scheduler + fault model)
29872990
#[serde(default)]
29882991
pub gnss_degradation: crate::messages::GnssDegradationConfig,
@@ -3004,6 +3007,7 @@ impl Default for SimulationConfig {
30043007
logging: LoggingConfig::default(),
30053008
closed_loop: Some(ClosedLoopConfig::default()),
30063009
particle_filter: None,
3010+
geophysical: None,
30073011
gnss_degradation: crate::messages::GnssDegradationConfig::default(),
30083012
}
30093013
}

data/input/2023-08-04_214758

-2.59 KB
Binary file not shown.

data/input/2023-08-06_144805

-2.53 KB
Binary file not shown.

data/input/2023-08-09_124742

-1.1 KB
Binary file not shown.

data/input/2023-08-09_163741

-1.18 KB
Binary file not shown.

data/input/2024-06-20_165550

-4.84 KB
Binary file not shown.

0 commit comments

Comments
 (0)