This repository was archived by the owner on Feb 3, 2023. It is now read-only.
Turns shortest angle in OdomChassisController#485
Merged
Conversation
Co-authored-by: Octogonapus <firey45@gmail.com>
Co-authored-by: Octogonapus <firey45@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #485 +/- ##
==========================================
- Coverage 89.36% 89.11% -0.26%
==========================================
Files 139 139
Lines 6140 6143 +3
==========================================
- Hits 5487 5474 -13
- Misses 653 669 +16 |
Member
|
Please allow edits from maintainers. |
Contributor
Author
They should be allowed.... |
Member
|
I get this error when pushing to your branch |
Contributor
Author
That's odd. I'm trying to merge changes from Yessir120/OkapiLib. Is it possible that there is a problem on my side? |
Member
|
I'm not convinced the PR is set up correctly, but regardless, it's now just faster for me to request changes instead |
Octogonapus
suggested changes
Jun 7, 2022
Member
Octogonapus
left a comment
There was a problem hiding this comment.
Please also add a test. Like this one:
diff --git a/test/defaultOdomChassisControllerTest.cpp b/test/defaultOdomChassisControllerTest.cpp
index f4de0276..faf0a8f9 100644
--- a/test/defaultOdomChassisControllerTest.cpp
+++ b/test/defaultOdomChassisControllerTest.cpp
@@ -158,6 +158,11 @@ TEST_F(DefaultOdomChassisControllerTest, TurnAboveThreshold) {
EXPECT_EQ(controller->lastTurnAngleTargetQAngle, 6_deg);
}
+TEST_F(DefaultOdomChassisControllerTest, BoundTurn) {
+ drive->turnToAngle(270_deg);
+ EXPECT_EQ(controller->lastTurnAngleTargetQAngle, -90_deg);
+}
+
TEST_F(DefaultOdomChassisControllerTest, SetStateTest) {
auto stateBefore = drive->getState();
assertOdomStateEquals(0, 0, 0, stateBefore);
Octogonapus
approved these changes
Jun 8, 2022
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 of the Change
OdomChassisController will now turn the shortest turn when
turnToAngleis called.Motivation
Currently, turnToAngle will only turn clockwise. For example, if I wanted to turn to 270_deg, it would turn 270 degrees clockwise instead of turning 90 degrees counterclockwise.
Possible Drawbacks
None that I can think of right now
Verification Process
The
turnToPointfunction uses a similar method of constraining the desired turn angle to [-180, 180], and it works, so this change forturnToAngleshould work too.Applicable Issues
#468