Skip to content

Commit 7622f61

Browse files
committed
Test Again
1 parent 7ba1d33 commit 7622f61

File tree

7 files changed

+45
-17
lines changed

7 files changed

+45
-17
lines changed

absolutelib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"fileName": "absolutelib.json",
33
"name": "absolutelib",
4-
"version": "1.3.7-BETA",
4+
"version": "1.3.7-TEST",
55
"frcYear": "2026",
66
"uuid": "a604c6de-3573-4ba6-ae4f-32778238b9de",
77
"mavenUrls": [
@@ -13,7 +13,7 @@
1313
{
1414
"groupId": "ca.team4308",
1515
"artifactId": "absolutelib-java",
16-
"version": "1.3.7-BETA"
16+
"version": "1.3.7-TEST"
1717
}
1818
],
1919
"requires": [

example/example-2026-Imported/src/main/java/frc/robot/subsystems/ExampleShooter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ public ExampleShooter() {
7878
.addEntry(8.0, 48.0, 3300);
7979

8080
GamePiece gamePiece = GamePieces.REBUILT_2026_BALL;
81-
SolverConstants.setHoopToleranceMultiplier(1);
82-
SolverConstants.setBasketDescentToleranceMultiplier(1);
81+
SolverConstants.setHoopToleranceMultiplier(1.5);
82+
SolverConstants.setBasketDescentToleranceMultiplier(1.5);
8383
SolverConstants.setMinTargetDistanceMeters(0.05);
8484
SolverConstants.setVelocityBufferMultiplier(1.2);
8585
TrajectorySolver.SolverConfig solverConfig = TrajectorySolver.SolverConfig.defaults()
8686
.toBuilder()
87-
.hoopToleranceMultiplier(1)
87+
.hoopToleranceMultiplier(1.5)
8888
.minPitchDegrees(47.5)
8989
.maxPitchDegrees(82.5)
9090
.build();

example/example-2026-Imported/vendordeps/absolutelib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"fileName": "absolutelib.json",
33
"name": "absolutelib",
4-
"version": "1.3.7",
4+
"version": "1.3.7-BETA",
55
"frcYear": "2026",
66
"uuid": "a604c6de-3573-4ba6-ae4f-32778238b9de",
77
"mavenUrls": [
@@ -13,7 +13,7 @@
1313
{
1414
"groupId": "ca.team4308",
1515
"artifactId": "absolutelib-java",
16-
"version": "1.3.7"
16+
"version": "1.3.7-BETA"
1717
}
1818
],
1919
"requires": [],

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
org.gradle.workers.max=1
22

33
group=ca.team4308
4-
version=1.3.7-BETA
4+
version=1.3.7-TEST
55

66
org.gradle.console=plain
77
org.gradle.logging.level=info

src/main/java/ca/team4308/absolutelib/math/trajectories/SolverConstants.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ private SolverConstants() {}
2525
/**
2626
* Multiplier for target radius when determining if a trajectory "hits" the target.
2727
* Higher values are more lenient for hoop/basket-style targets.
28-
* Default: 5.0 (ball within 5x target radius counts as hit)
28+
* Default: 1.5 (ball within 1.5x target radius counts as hit)
2929
*/
30-
private static double hoopToleranceMultiplier = 5.0;
30+
private static double hoopToleranceMultiplier = 1.5;
3131

3232
/**
3333
* Minimum horizontal distance to target (meters).
@@ -39,9 +39,9 @@ private SolverConstants() {}
3939
/**
4040
* Multiplier for target radius used in basket descent detection.
4141
* When ball descends and is within (targetRadius * this) horizontally, it's a hit.
42-
* Default: 5.0
42+
* Default: 1.5
4343
*/
44-
private static double basketDescentToleranceMultiplier = 5.0;
44+
private static double basketDescentToleranceMultiplier = 1.5;
4545

4646
// ==================== Velocity ====================
4747

src/main/java/ca/team4308/absolutelib/math/trajectories/TrajectoryResult.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,31 @@ public List<Pose3d> getFlightPath() {
5050
validCount++;
5151
}
5252

53-
List<Pose3d> path = new ArrayList<>();
53+
// Find the point of closest 3D approach to the target so the path
54+
// ends near the target instead of continuing to the ground.
55+
double tX = input.getTargetX();
56+
double tY = input.getTargetY();
57+
double tZ = input.getTargetZ();
58+
int closestIndex = 0;
59+
double closestDist2 = Double.MAX_VALUE;
5460
for (int i = 0; i < validCount; i++) {
61+
ca.team4308.absolutelib.math.trajectories.physics.ProjectileMotion.TrajectoryState s = simResult.trajectory[i];
62+
if (s == null) break;
63+
double dx = s.x - tX;
64+
double dy = s.y - tY;
65+
double dz = s.z - tZ;
66+
double d2 = dx * dx + dy * dy + dz * dz;
67+
if (d2 < closestDist2) {
68+
closestDist2 = d2;
69+
closestIndex = i;
70+
}
71+
}
72+
// Include a couple points past closest approach so the path visually
73+
// reaches the target area, but not the entire descent to the ground.
74+
int endIndex = Math.min(closestIndex + 2, validCount);
75+
76+
List<Pose3d> path = new ArrayList<>();
77+
for (int i = 0; i < endIndex; i++) {
5578
ca.team4308.absolutelib.math.trajectories.physics.ProjectileMotion.TrajectoryState state = simResult.trajectory[i];
5679
if (state == null) break;
5780
Translation3d translation = new Translation3d(state.x, state.y, state.z);

src/main/java/ca/team4308/absolutelib/math/trajectories/TrajectorySolver.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static class Builder {
145145
private double crtAngleResolution = 0.1;
146146
private int crtControlLoopMs = 20;
147147
private int crtEncoderTicks = 4096;
148-
private double hoopToleranceMultiplier = 5.0;
148+
private double hoopToleranceMultiplier = 1.5;
149149

150150
public Builder minPitchDegrees(double val) { this.minPitchDegrees = val; return this; }
151151
public Builder maxPitchDegrees(double val) { this.maxPitchDegrees = val; return this; }
@@ -377,8 +377,8 @@ static boolean trajectoryCollidesInternal(ProjectileMotion.TrajectoryResult traj
377377
* without descending close enough to the target height.
378378
* At the point of closest horizontal approach to the target, the ball's
379379
* altitude must be within one target radius above the target center height.
380-
* However, if the ball is actively descending (vz &lt; 0) at that point,
381-
* it is heading toward the target and is not a flyover.
380+
* A ball is only exempt from the flyover check if it is actively descending
381+
* AND horizontally close enough to the target to plausibly enter the opening.
382382
*/
383383
private static boolean isFlyover(ProjectileMotion.TrajectoryState[] trajectory,
384384
double targetX, double targetY, double targetZ, double targetRadius) {
@@ -399,7 +399,12 @@ private static boolean isFlyover(ProjectileMotion.TrajectoryState[] trajectory,
399399
}
400400
}
401401

402-
if (vzAtBestHoriz < 0) return false;
402+
double bestHorizDist = Math.sqrt(bestHorizDist2);
403+
404+
// Only exempt descending balls that are horizontally close to the target
405+
if (vzAtBestHoriz < 0 && bestHorizDist <= targetRadius * SolverConstants.getHoopToleranceMultiplier()) {
406+
return false;
407+
}
403408

404409
return heightAtBestHoriz > targetZ;
405410
}

0 commit comments

Comments
 (0)