-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compute_forward_vector_angle function #376
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d `compute_heading()`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #376 +/- ##
==========================================
+ Coverage 99.79% 99.80% +0.01%
==========================================
Files 14 14
Lines 969 1044 +75
==========================================
+ Hits 967 1042 +75
Misses 2 2 ☔ View full report in Codecov by Sentry. |
This was referenced Jan 23, 2025
* Breakout vector valiadator with skeleton test * Write validator tests, fix bug in missing .get method * Fix dims and coords returned by `compute_forward_vector` (#382) * Implement the expected fix updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.8.6](astral-sh/ruff-pre-commit@v0.8.1...v0.8.6) - [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](pre-commit/mirrors-mypy@v1.13.0...v1.14.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Revert "Implement the expected fix" This reverts commit edbaa9c. * Update method to explicitly construct and drop spatial z dimensions * Force nan test to check for preserved coordinates * Force explicit coordinate preservation checks in input/output test --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Standardise compute_signed_angle_2d function as a purely mathematical impementation * Patch up compute_forward_vector_angle * Start on tests but encounter NaN bug that needs rebase fix * Fix mapping of -pi to pi in signed_angle * Write antisymmetry test * Write invariance under transforms test * Add tests for missing lines * Apply batch suggestions from code review Co-authored-by: Niko Sirmpilatze <niko.sirbiladze@gmail.com> * Fix computer_forward_vector__angle docstring * Remove unnecessary validation checks * Use camera view variable name for codebase consistency * Fix validator docstring backticks * Move ref vector validator into array validators * Fix typehints and test broken by removing earlier error check --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Niko Sirmpilatze <niko.sirbiladze@gmail.com>
Quality Gate passedIssues Measures |
niksirbi
changed the title
Add compute_heading_angle function
Add compute_forward_vector_angle function
Jan 28, 2025
willGraham01
approved these changes
Jan 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
What is this PR
Why is this PR needed?
This is a refresh and continuation of #315.
What does this PR do?
This PR introduces three new functions:
kinematics.compute_forward_vector_angle()
We have moved away from the term "heading angle" in favour of a name more consistent with our existing function naming conventions. This function calls
compute_forward_vector()
and then computes the angle between the resulting forward vector and a specified reference vector (using the function described below).utils.vector.compute_signed_angle_2d()
A purely mathematical implementation of the signed angle between two 2D vectors, following the
arctan2
convention. We expect this general-purpose utility to be used in a variety of scenarios going forward.validators.arrays.validate_reference_vector()
A helper function that validates the reference vectors passed to
compute_forward_vector_angle()
. It supports both static and time-varying reference vectors, in multiple array-like formats.References
#238
#315
How has this PR been tested?
Yes, thanks to @willGraham01. The tests were implemented in #385 which has been merge onto this branch.
Is this a breaking change?
No.
Does this PR require an update to the documentation?
The new functions come with extensive docstrings, and API docs are automatically updated.
Checklist: