Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
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

Copilot AI Jan 9, 2026

Copy link

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: read permission" but the actual permission is set to contents: write. If this workflow only needs to read the repository (checkout and build), then contents: read would be more appropriate following the principle of least privilege. If write access is genuinely needed, the comment should be updated to explain why.

Suggested change
contents: write
contents: read

Copilot uses AI. Check for mistakes.

# 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
156 changes: 156 additions & 0 deletions GEOPHYSICAL_CONFIG_CHANGES.md
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

Copilot AI Jan 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file paths in this documentation contain hardcoded absolute paths specific to a user's local environment (e.g., /home/james/Code/strapdown-rs/). For documentation that may be committed to the repository, consider using relative paths or simply the filenames to make it more portable and professional.

Suggested change
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`

Copilot uses AI. Check for mistakes.

## Next Steps

Users can now:
1. Run `strapdown-sim config` to create configurations with geophysical measurements
2. Refer to `docs/GEOPHYSICAL_CONFIG.md` for detailed documentation
3. Use `examples/configs/geonav_example.toml` as a template
4. Test the wizard with `test_geo_config_wizard.sh`
40 changes: 40 additions & 0 deletions conf/geonav_example.toml
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

Copilot AI Jan 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration file appears to be duplicated in both conf/geonav_example.toml and examples/configs/geonav_example.toml. Having identical files in multiple locations creates a maintenance burden - if one is updated, the other must be kept in sync. Consider consolidating to a single location or documenting why both are needed.

Copilot uses AI. Check for mistakes.
4 changes: 4 additions & 0 deletions core/src/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,9 @@ pub struct SimulationConfig {
/// Particle filter specific settings (only used if mode is ParticleFilter)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub particle_filter: Option<ParticleFilterConfig>,
/// Geophysical measurement configuration (optional, requires --features geonav)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub geophysical: Option<GeophysicalConfig>,
/// GNSS degradation configuration (scheduler + fault model)
#[serde(default)]
pub gnss_degradation: crate::messages::GnssDegradationConfig,
Expand All @@ -3004,6 +3007,7 @@ impl Default for SimulationConfig {
logging: LoggingConfig::default(),
closed_loop: Some(ClosedLoopConfig::default()),
particle_filter: None,
geophysical: None,
gnss_degradation: crate::messages::GnssDegradationConfig::default(),
}
}
Expand Down
Binary file removed data/input/2023-08-04_214758
Binary file not shown.
Binary file removed data/input/2023-08-06_144805
Binary file not shown.
Binary file removed data/input/2023-08-09_124742
Binary file not shown.
Binary file removed data/input/2023-08-09_163741
Binary file not shown.
Binary file removed data/input/2024-06-20_165550
Binary file not shown.
Binary file removed data/input/2025-03-01_150426
Binary file not shown.
Binary file removed data/input/2025-03-01_164639
Binary file not shown.
Binary file removed data/input/2025-06-11_20-34-24
Binary file not shown.
Binary file removed data/input/2025-06-14_21-17-02
Binary file not shown.
Binary file removed data/input/2025-06-18_15-09-25
Binary file not shown.
Binary file removed data/input/2025-06-18_16-52-32
Binary file not shown.
Binary file removed data/input/2025-06-27_11-54-35
Binary file not shown.
Binary file removed data/input/2025-07-04_17-24-46
Binary file not shown.
Binary file removed data/input/2025-07-08_14-12-53
Binary file not shown.
Binary file removed data/input/2025-07-18_23-13-43
Binary file not shown.
Binary file removed data/input/2025-07-31_23-36-03
Binary file not shown.
Binary file removed data/input/2025-08-03_18-15-59
Binary file not shown.
Binary file removed data/input/2025-09-26_19-03-38
Binary file not shown.
Binary file removed data/input/2025-09-27_12-54-35
Binary file not shown.
Binary file removed data/input/2025-09-27_18-10-16
Binary file not shown.
Binary file removed data/input/2025-09-28_20-23-16
Binary file not shown.
Binary file removed data/input/2025-11-09_17-34-01
Binary file not shown.
Binary file removed data/input/2025-11-16_16-08-14
Binary file not shown.
Loading
Loading