Skip to content

Fix imuSensor orientation input format: quaternions → rotation matrices#5

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-imu-measurements-error
Draft

Fix imuSensor orientation input format: quaternions → rotation matrices#5
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-imu-measurements-error

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 3, 2025

The imuSensor object expects orientation as 3×3×N rotation matrices but was receiving N×4 quaternions, causing a dimension mismatch error during IMU simulation.

Changes

part1_vibration_model.m

  • Replaced quaternion identity [1 0 0 0] with rotation matrix identity eye(3) for both stationary and moving trajectories
  • Changed from repmat([1 0 0 0], numSamples, 1)repmat(eye(3), [1, 1, numSamples])

MATLAB_SETUP_GUIDE.md

  • Updated test example to use rotation matrix format

Before/After

% Before: 1000×4 quaternion array
orientation_stationary = repmat([1 0 0 0], numSamples, 1);

% After: 3×3×1000 rotation matrix array
orientation_stationary = repmat(eye(3), [1, 1, numSamples]);

Affects all four IMU simulation calls (clean/vibrating × stationary/moving).

Original prompt

⚠ Toolbox availability check failed: Feature name must be less than 28 characters.
Please ensure you have Navigation Toolbox installed.

=== Step 1: Setting up IMU Sensor ===
✓ IMU sensor configured with realistic noise characteristics

=== Step 2: Generating Reference Trajectories ===
Generating stationary trajectory...
Generating moving trajectory...
✓ Reference trajectories generated

=== Step 3: Creating Vibration Model ===
✓ Multi-frequency vibration model created

  • Primary vibration: 25.0 Hz (0.50 m/s²)
  • Secondary vibration: 60.0 Hz (0.30 m/s²)
  • Tertiary vibration: 120.0 Hz (0.20 m/s²)

=== Step 4: Simulating IMU Measurements ===

✗ Error in Part 1: Expected input to be of size 3x3x1000, but it is of size 1000x4.
Stack trace:
imuSensor.validateInputsImpl (line 532)
part1_vibration_model (line 132)
run (line 100)
run_solution (line 70)
Error using run_solution (line 82)
Part 1 failed. Please check the error messages above.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 3, 2025 23:58
…matrices

Co-authored-by: VimsRocz <96129555+VimsRocz@users.noreply.github.com>
…ternions

Co-authored-by: VimsRocz <96129555+VimsRocz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in IMU measurements validation Fix imuSensor orientation input format: quaternions → rotation matrices Nov 4, 2025
Copilot AI requested a review from VimsRocz November 4, 2025 00:01
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.

2 participants