Skip to content

Refactor euler and quaternion conversion functions - #9

Merged
Andeshog merged 3 commits into
mainfrom
refactor/euler-and-quat-conversions
Sep 30, 2025
Merged

Andeshog merged 3 commits into
mainfrom
refactor/euler-and-quat-conversions

Conversation

@Andeshog

Copy link
Copy Markdown
Contributor

Updated euler_to_quat and quat_to_euler functions to include degrees parameter and simplified conversion logic.

Andeshog and others added 3 commits September 30, 2025 16:55
Updated euler_to_quat and quat_to_euler functions to include degrees parameter and simplified conversion logic.
@Andeshog
Andeshog requested a review from kluge7 September 30, 2025 17:08
@codecov

codecov Bot commented Sep 30, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.54%. Comparing base (99c4718) to head (8d62084).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
- Coverage   90.63%   90.54%   -0.09%     
==========================================
  Files           6        6              
  Lines         427      423       -4     
  Branches       53       53              
==========================================
- Hits          387      383       -4     
  Misses         26       26              
  Partials       14       14              
Flag Coverage Δ
unittests 90.54% <100.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tests/test_utils.py 100.00% <100.00%> (ø)
vortex_utils/python_utils.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kluge7
kluge7 requested a review from Copilot September 30, 2025 18:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the euler and quaternion conversion functions to simplify the implementation and add support for degree/radian conversion. The changes remove unnecessary intermediate steps through rotation matrices and add a degrees parameter to both functions.

  • Simplified euler_to_quat and quat_to_euler functions by removing intermediate rotation matrix conversions
  • Added degrees parameter to both functions for angle unit specification
  • Updated test assertions to reflect the corrected conversion behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
vortex_utils/python_utils.py Refactored conversion functions with direct scipy.spatial.transform.Rotation calls and added degrees parameter
tests/test_utils.py Updated test expectations to match corrected conversion results

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

roll: float, pitch: float, yaw: float, *, degrees: bool = False
) -> np.ndarray:
"""RPY (intrinsic x-y-z) -> quaternion (x, y, z, w)."""
return Rotation.from_euler('xyz', [roll, pitch, yaw], degrees=degrees).as_quat()

Copilot AI Sep 30, 2025

Copy link

Choose a reason for hiding this comment

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

The euler sequence changed from 'XYZ' (extrinsic) to 'xyz' (intrinsic) without clear documentation of this breaking change. This affects the rotation order and could break existing code that depends on the previous behavior.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nobody uses my code anyway

x: float, y: float, z: float, w: float, *, degrees: bool = False
) -> np.ndarray:
"""Quaternion (x, y, z, w) -> RPY (intrinsic x-y-z)."""
return Rotation.from_quat([x, y, z, w]).as_euler('xyz', degrees=degrees)

Copilot AI Sep 30, 2025

Copy link

Choose a reason for hiding this comment

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

The euler sequence changed from 'XYZ' (extrinsic) to 'xyz' (intrinsic) without clear documentation of this breaking change. This affects the rotation order and could break existing code that depends on the previous behavior.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nobody uses my code anyway

@kluge7 kluge7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚶‍♂️

@Andeshog
Andeshog merged commit f109e3b into main Sep 30, 2025
5 checks passed
@Andeshog
Andeshog deleted the refactor/euler-and-quat-conversions branch September 30, 2025 18:23
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.4.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants