Skip to content

AutoSteer Setup Wizard: 6 new calibration/tuning steps#245

Draft
Xyntexx wants to merge 32 commits intoAgOpenGPS-Official:developfrom
Xyntexx:feature/autosteer-wizard
Draft

AutoSteer Setup Wizard: 6 new calibration/tuning steps#245
Xyntexx wants to merge 32 commits intoAgOpenGPS-Official:developfrom
Xyntexx:feature/autosteer-wizard

Conversation

@Xyntexx
Copy link
Copy Markdown
Collaborator

@Xyntexx Xyntexx commented Apr 16, 2026

Summary

Complete AutoSteer Setup Wizard with calibration steps and live hardware interaction.

Closes #37 (completes Phase 2: Polish milestone)

Wizard steps (18 total)

Group A: Introduction - Welcome with safety info

Group B: Vehicle Dimensions (5 steps) - Wheelbase, track width, antenna pivot/height/offset

Group C: Hardware Configuration (5 steps) - Steer enable, motor driver, AD converter, inversions, Danfoss

Group D: Sensor Calibration

  • WAS Calibration - Live angle display from PGN 253, "Zero WAS" button, CPD, max steer angle

Group E: Steering Tuning

  • Steering Gains - Kp (1-100), Ki (0-1.0), live steer angle + error display
  • PWM Calibration - Max/min PWM, free-drive motor test mode with left/right/center
  • Algorithm Selection - Pure Pursuit vs Stanley with parameters

Group F: Operating Limits

  • Speed Limits - Min/max steer speed
  • Optional Sensors - Turn/pressure/current sensor toggles

Group G: Completion - Save profile

Live hardware features

  • WAS step: reads actual steer angle from PGN 253, zero button captures current reading
  • PWM step: free-drive mode sends steering commands directly for motor testing
  • Gains step: shows live steer error (commanded vs actual) for tuning
  • All degrade gracefully without hardware (fields still editable)

Tests

127 wizard step tests covering:

  • Property load/save for all 18 steps
  • Validation (valid + boundary conditions)
  • CanSkip flags
  • Wizard navigation and completion

Test plan

  • Open AutoSteer Config > Wizard button launches wizard
  • Step through all 18 steps
  • WAS step: live angle updates, Zero WAS captures offset
  • PWM step: free-drive mode moves motor, disables on leave
  • Skip optional steps
  • Complete wizard: settings saved to profile
  • Cancel wizard: original values preserved

Xyntexx and others added 30 commits April 16, 2026 16:05
New wizard steps for AutoSteer setup:
- WAS Calibration: offset, counts per degree, max steer angle
- Steering Gains: proportional gain (Kp), integral gain
- PWM Calibration: max/min PWM with validation
- Algorithm Selection: Pure Pursuit vs Stanley with parameters
- Speed Limits: min/max steer speed
- Optional Sensors: turn/pressure/current sensor toggles

Wizard now has 18 steps total (Welcome + 5 vehicle + 5 hardware +
6 new tuning/calibration + Finish).

WizardCommand in AutoSteerConfigPanel closes the config dialog and
launches the wizard via MainViewModel.ShowSteerWizard.

Closes AgOpenGPS-Official#37

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WAS Calibration step:
- Live steer angle display from PGN 253 ActualSteerAngle
- "Zero WAS" button captures current sensor reading as zero offset
- HasLiveData indicator for hardware connection status

PWM Calibration step:
- Free-drive mode toggle for direct motor testing
- Left/Right/Center buttons for steering motor test
- Live steer angle feedback showing motor response
- Auto-disables free drive when leaving step

Steering Gains step:
- Live actual steer angle from hardware
- Live steer error (commanded vs actual) for tuning feedback

All steps use IAutoSteerService for hardware access (optional,
gracefully degrades when no hardware connected).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover:
- Full 18-step navigation with completion and config save
- Cancel preserves original config (SaveProfile not called)
- Navigation state flags at first/middle/last steps
- Skip advances on skippable steps, blocked on non-skippable
- Back navigation preserves values via config roundtrip
- Validation blocks Next on invalid values, allows on valid
- Progress tracking increases correctly, StepDisplay format
- GoToStep direct navigation + out-of-range safety
- Completed/Cancelled/CloseRequested events fire correctly
- Config persistence: modified values saved on completion

Total wizard tests: 144 (127 unit + 17 e2e)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add WasCalibration, SteeringGains, PwmCalibration, AlgorithmSelection,
  SpeedLimits, Sensors steps to WizardHost view switch (was showing
  "Unknown step" error)
- Use NumericStepView as generic view for new steps
- Replace hardcoded #1E2A35 backgrounds with DynamicResource theme
  brushes in WizardDialogPanel and WizardHost for light/dark mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hardcoded dark-mode colors across 12 wizard AXAML views:
- #1E2A35 backgrounds -> SystemControlBackgroundBaseLowBrush
- #1ABC9C/#16A085 accents -> SystemControlHighlightAccentBrush
- #3D566E option backgrounds -> SystemControlBackgroundBaseLowBrush
- Keep intentional colors: red (errors), orange (Danfoss), etc.

Affected views: WizardHost, WelcomeStep, WheelbaseStep,
TrackWidthStep, AntennaPivotStep, AntennaHeightStep,
AntennaOffsetStep, SteerEnableStep, MotorDriverStep,
ADConverterStep, FinishStep, NumericStepView

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New VehicleType step (step 2, after Welcome):
- 3 options: Tractor, Harvester, Articulated 4WD
- Icon buttons with AntennaTractor/Harvester/Articulated images
- Matching MotorDriver option-button style, DynamicResource colors
- Affects wheelbase/antenna diagrams in later steps

Screenshot tests (21 tests):
- Captures headless Avalonia render of each wizard step
- Saves to screenshots/wizard-steps/ directory
- Verifies all 19 steps navigable with non-empty title/description

Updated E2E tests for 19-step wizard (was 18).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
UIScreenshotCatalog now captures all 19 wizard steps in both dark
and light mode. Uses the real WizardHost with full view resolution,
producing accurate renders of each step's UI.

Also fixed headless screenshot test to use step view creation
directly (headless Avalonia doesn't trigger OnLoaded lifecycle).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Vehicle type step now uses vehiclePageTractor/Harvester/Articulated
icons which show the vehicle silhouette. Antenna icons are for
the antenna dimension steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidated 19 small steps into 12 focused steps matching
the settings page layout:

1. Welcome
2. Vehicle Type (vehiclePage icons)
3. Hardware Installed (GPS Only / AutoSteer / Full)
4. Vehicle Dimensions (wheelbase + track width with WheelBase icon)
5. Antenna Position (pivot + height + offset with Antenna icon)
6. Hardware Config (enable + motor + ADC + inversions + Danfoss)
7. Roll Calibration (IMU invert + zero with live roll display)
8. WAS Calibration (live angle + zero button + CPD)
9. Motor PWM Test (free-drive + live feedback)
10. Steering Gains + Algorithm (PP/Stanley + Kp/Ki + live error)
11. Speed & Sensors (min/max speed + sensor toggles)
12. Finish

Custom AXAML views for all steps using DynamicResource colors,
vehicle-type-dependent icons via StringToImageConverter, and
layouts matching the settings page tabs.

Deleted 13 old ViewModels + 10 old Views (20 files).
Net -753 lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
installed + roll calibration steps

- Wizard now fills entire screen (removed centered modal box)
- InvertWas moved from Hardware Config to WAS Calibration step
  (more logical: invert is part of sensor calibration)
- Added Hardware Installed step (GPS Only / AutoSteer / Full)
  with GPSQuality, AutoSteerOn, SectionMasterOn icons
- Added Roll Calibration step with live roll display, zero button,
  and invert toggle
- 12 total steps

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Vehicle Type + Hardware Installed: horizontal UniformGrid with
  120x120 icon borders, centered text below
- Vehicle Dimensions + Antenna Position: larger diagrams (320x200)
- All NumericUpDown replaced with TextBox (matching settings style)
- Antenna offset: L/C/R buttons with AntennaLeftOffset/NoOffset/
  RightOffset icons, offset input moved below
- InvertMotor moved from Hardware Config to Motor PWM Test step
- Roll Calibration: analog gauge with colored arc segments, needle,
  degree markings, ConS_SourcesRoll icon, better description text
- Navigation buttons larger (Height 56, MinWidth 130, FontSize 18)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Copy 9 legacy icons from AgOpen snapshot for inversions, zero,
  steer direction, roll calibration
- Vehicle Dimensions: full-page diagram with overlaid input fields
- Antenna Position: full-page diagram with overlaid fields
- Hardware Config: Cytron + Single AD as defaults and first in list,
  steer enable mode descriptions, ConSt_InvertRelay icon
- WAS Calibration: horizontal bar indicator (Left/Right with angle
  marker), instruction "must be POSITIVE when turning RIGHT",
  SteerZero icon on zero button, ConSt_InvertWAS icon on toggle
- Motor PWM Test: SteerLeft/Right/Zero icons on free-drive buttons,
  ConSt_InvertDirection icon on motor invert toggle
- Roll Calibration: ConD_RollHelper diagram, ConDa_RollSetZero on
  zero button, ConDa_InvertRoll on invert toggle, instruction to
  tilt right and check positive reading

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use user-provided WheelBase/Harvester/Articulated cropped images
  instead of auto-cropped RadiusWheelBase
- Vehicle Dimensions: image left, fields right (no scrollbar)
- Antenna Position: image left, fields right (no scrollbar)
- Remove overlaid/scrolling field layout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Left column: top-crop antenna image + pivot distance + height
- Right column: offset-crop antenna image + L/C/R buttons + offset
- No scrollbar - everything fits on one screen
- Added cropped antenna images (top 250px, bottom-left 250x250)
  for each vehicle type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Left column: wheelbase image (side view crop) + input field
- Right column: track width image (top-down view) + input field
- Renamed user-provided images to TrackWidth*.png
- Cropped wheelbase images from RadiusWheelBase side views

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shows front-to-rear axle view with orange arrows indicating
the wheelbase measurement points.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updated step indices, loop counts, and assertions in
SteerWizardStepTests and SteerWizardE2ETests for the 12-step
wizard (added HardwareInstalled + RollCalibration steps, moved
InvertWas/InvertMotor to WAS/PWM steps).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Virtual ShouldSkip property (default false) on WizardStepViewModel.
GoNextAsync and GoBack skip steps where ShouldSkip returns true.
4 tests for skip behavior + regression.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GPS Only (HardwareLevel=0) skips HardwareConfig, RollCalibration,
WasCalibration, PwmCalibration, and SteeringGains steps.
AutoSteer/Full paths show all steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Persistent bar between step dots and navigation buttons. Updates
live from IAutoSteerService.StateUpdated. Shows 'No GPS' when
no data. Gracefully degrades without hardware.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New wizard step (after PWM Calibration, before Steering Gains) that
sends a 0.5s motor pulse left or right so the user can verify wheel
direction. Includes Invert Motor toggle, live WAS angle display,
and pulse status feedback. Skipped when hardware level is GPS-only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Interactive calibration step that measures turning circle diameter
via GPS tracking, then auto-calculates Counts Per Degree using the
legacy AgOpenGPS algorithm (with 0.9 conservative factor). Includes
manual CPD slider (1-255) for direct entry. Skipped in GPS Only mode.
Position: after Motor Direction Test, before Steering Gains.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Left-circle test that measures turning diameter and calculates Ackermann
correction (0-200, 100=neutral) using the ratio of geometric angle to
captured WAS start angle. Positioned after CPD Circle Test, before
Steering Gains. Wizard now has 15 steps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…buttons

Task 7: Increase description text to 16px, fix selected button
contrast in light mode with explicit white foreground
Task 8: WAS step units, CPD slider, step-by-step guide text
Task 9: Roll step reorder (invert above zero), guide text
Task 10: PWM step 0.5s pulse buttons replacing hold-to-steer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Task 11: Ackermann slider (0-200) added to WAS step
Task 12: SideHill compensation (0-1.0) added to Steering Gains
Task 13: Safety settings (steer-in-reverse, deadzone, manual turns)
added to Speed & Sensors step

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All 135 wizard tests passing. Integration test screenshots
captured for all 15 steps in both dark and light mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… descriptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove explicit Foreground from description TextBlocks in Vehicle
  Type and Hardware Installed views, use style-based approach so
  selected state can override to white
- AutoSteerConfig defaults: MotorDriver=1 (Cytron), AdConverter=1
  (Single) instead of IBT2/Differential

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Change Zero Roll and Zero WAS buttons from accent blue to neutral
  background color while keeping their icons
- Rename "Invert Relays" to "Invert Steer Enable Relay" with
  descriptive subtitle text
- Remove CPD, Ackermann, and Max Steer Angle from WAS calibration
  step (now handled by their own dedicated wizard steps)
- Simplify WAS step description to focus on zeroing and inversion
- Update tests to match reduced WAS step scope

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Global accent color: lighter blue (#2B88D8) in light mode for
  better contrast on colored buttons, standard (#0078D7) in dark
- Zero buttons neutral gray (not accent blue) with icons
- "Invert Relays" -> "Invert Steer Enable Relay" with description
- Removed CPD/Ackermann/MaxSteerAngle from WAS step (now in
  interactive circle test steps)
- Fixed selected button description contrast in Vehicle Type and
  Hardware Installed views (style-based Foreground override)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Xyntexx and others added 2 commits April 18, 2026 20:47
Combine the separate MotorDirectionTestStep and PwmCalibrationStep into
a single AutoMotorCalibrationStepViewModel with two automated phases:

Phase A: Auto-ramp PWM to detect motor direction and minimum PWM
Phase B: Drive full lock both ways to measure max steering angles

The new step uses a state machine (WaitingToStart -> RampingPWM ->
RampResult -> WaitingForMaxAngle -> MeasuringMaxAngle -> Complete)
with Redo buttons after each phase result.

Key design decisions:
- MaxSteerAngle stored as raw WAS value (CPD not calibrated yet)
- Injectable DelayFunc and ReadWasAngle for testability
- ShouldSkip when GPS Only (HardwareLevel == 0)
- OnLeaving only saves config when CalibrationCompleted is true
- Wizard reduced from 15 to 14 steps

Tests: 17 new unit tests covering both phases, redo, config save/load,
and motor direction detection. All E2E tests updated for 14-step count.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Single AutoMotorCalibrationStep replaces MotorDirectionTest +
PwmCalibration with automated phases:

Phase A: Ramp PWM from 0 until WAS moves 10 deg
- Auto-detects motor direction (inverted if negative)
- Sets MinPWM = threshold * 1.1
- Safety explanation before starting

Phase B: Drive to full lock both directions (MinPWM + 20%)
- Brief hold (1.5s) to read WAS, no extended lock
- MaxSteerAngle = min(abs(L), abs(R)) * 0.9 (raw WAS value)
- User can drive slowly if power steering resists

Both phases have Redo buttons. Wizard now 14 steps.
17 new tests, all passing. Deleted old step files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutoSteer Setup Wizard

1 participant