Skip to content

Refactor unit tests #52

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0b55a6d
added the intake canrange detector. has a boolean for vertical corals…
notpro-ek Mar 12, 2025
773a0ca
UNTESTED new driver assist based on the offset of vertical coral loca…
notpro-ek Mar 12, 2025
fcff1c9
Save off changes. It needs to be the final robot position, not the ap…
notpro-ek Mar 14, 2025
bef1d85
Sync with main and slight refactoring
TheFlameFish Mar 14, 2025
9f2f374
Remove unused methods
TheFlameFish Mar 14, 2025
0d0a34e
fixed refactoring and cleaned up files. Coral offset is now giving th…
notpro-ek Mar 14, 2025
3a6e534
Merge branch 'intake-distance-sensor' of https://github.com/AEMBOT/FR…
notpro-ek Mar 14, 2025
0ba046e
Fixed broken test target pose code after merge. Tests are still worki…
notpro-ek Mar 14, 2025
ceeb439
Round offset tests
TheFlameFish Mar 14, 2025
5512773
Re-add bindings
TheFlameFish Mar 14, 2025
6bc9c10
ignore coral position when going to L1
TheFlameFish Mar 14, 2025
8f1bca6
Slight documentation & refactoring
TheFlameFish Mar 14, 2025
159a7b6
Remove unneeded method
TheFlameFish Mar 14, 2025
05b477d
Use assertions with Pose2ds instead of converting to arrays
TheFlameFish Mar 14, 2025
464652c
Revert out-of-scope build.gradle change
TheFlameFish Mar 14, 2025
97ff8a6
Minor formatting, docs, and refactor
TheFlameFish Mar 14, 2025
99b6bff
Simplify getting nearest tag
TheFlameFish Mar 14, 2025
8345b02
Change ReefTargetsTest to use new method of getting nearest apriltag,…
TheFlameFish Mar 14, 2025
fdc942b
give nearest tag tests a small amount of tolerance
TheFlameFish Mar 14, 2025
61bb858
Remove now unused method
TheFlameFish Mar 14, 2025
33b162e
Switch delta to theta (oops)
TheFlameFish Mar 14, 2025
f7e1a37
Make red test tolerance consistent with blue
TheFlameFish Mar 14, 2025
f6bcf78
Remove assertPoseEquals because floating point errors render it non-u…
TheFlameFish Mar 14, 2025
4258b11
Properly revert spotless indent changes
TheFlameFish Mar 14, 2025
ec0fab3
Leave source once we have coral in auto
TheFlameFish Mar 14, 2025
0f22883
Spotless
TheFlameFish Mar 14, 2025
6a70b7e
Make tolerance shared between all reef test methods
TheFlameFish Mar 14, 2025
39afada
Make the function to check for having a game piece work for horizonta…
notpro-ek Mar 14, 2025
f20a9d9
Code to detect horizontal coral pieces.
notpro-ek Mar 14, 2025
b25534a
build gradle + spotless
notpro-ek Mar 15, 2025
467ca5e
* Need to subtract a positive offset, instead of negative offset
nolanhergert Mar 15, 2025
f3fb677
Undo spotless changes for a separate PR
nolanhergert Mar 15, 2025
056ba2d
simplified try catch statements
nolanhergert Mar 15, 2025
d8596ed
Merge remote-tracking branch 'origin/main' into refactor-unit-tests
nolanhergert Mar 15, 2025
e023f6d
Test commit
goober48 Mar 15, 2025
d0d3077
Undo test change
nolanhergert Mar 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/main/java/frc/robot/util/Assertions.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
public class Assertions {
public static void assertPoseWithin(
Pose2d expected, Pose2d actual, String message, double tolerance) {
assertEquals(expected.getX(), actual.getX(), tolerance, message + " | X");
assertEquals(expected.getY(), actual.getY(), tolerance, message + " | Y");
assertEquals(
expected.getRotation().getDegrees(),
actual.getRotation().getDegrees(),
tolerance,
message + " | θ");
try {
assertEquals(expected.getX(), actual.getX(), tolerance, message + " | X");
assertEquals(expected.getY(), actual.getY(), tolerance, message + " | Y");
assertEquals(
expected.getRotation().getDegrees(),
actual.getRotation().getDegrees(),
tolerance,
message + " | θ");
} catch (AssertionError e) {
System.out.println(
"Error when comparing:\n" + expected.toString() + "\n" + actual.toString());
System.out.println(e.getMessage());
throw e;
}
}
}
Loading