From 41d878dab8fe79068b9d230c05b55befbe94265a Mon Sep 17 00:00:00 2001 From: Ray Healy Date: Sat, 21 Feb 2026 09:57:53 -0500 Subject: [PATCH] trajectory/ballistics/constraints/BCEvalParams: Define toString and HashCode --- .../ballistics/constraints/BCEvalParams.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/org/fairportrobotics/frc/robolib/trajectory/ballistics/constraints/BCEvalParams.java b/lib/src/main/java/org/fairportrobotics/frc/robolib/trajectory/ballistics/constraints/BCEvalParams.java index 6870feb..be3ec9b 100644 --- a/lib/src/main/java/org/fairportrobotics/frc/robolib/trajectory/ballistics/constraints/BCEvalParams.java +++ b/lib/src/main/java/org/fairportrobotics/frc/robolib/trajectory/ballistics/constraints/BCEvalParams.java @@ -2,6 +2,7 @@ package org.fairportrobotics.frc.robolib.trajectory.ballistics.constraints; import org.fairportrobotics.frc.robolib.trajectory.Velocity3d; +import edu.wpi.first.units.Units; import edu.wpi.first.units.measure.Angle; /** @@ -25,8 +26,8 @@ public class BCEvalParams { private Velocity3d cache_candidateShooterVelocityRelative; // - // Setup - //) + // Setup + // public BCEvalParams( Velocity3d robotVelocity, @@ -109,6 +110,23 @@ public class BCEvalParams { return this.cache_candidateShooterVelocityRelative; } + public int hashCode() { + return this.robotVelocity.hashCode() ^ + Double.hashCode(this.robotAngle.in(Units.Degrees)) ^ + this.currentShooterVelocity.hashCode() ^ + this.candidateVelocity.hashCode(); + } + + public String toString() { + return String.format( + "BCEvalParams(robotVelocity: %s, robotAngle: %s, currentShooterVelocity: %s, candidateVelocity: %s)", + this.robotVelocity.toString(), + this.robotAngle.toString(), + this.currentShooterVelocity.toString(), + this.candidateVelocity.toString() + ); + } + public boolean equals(BCEvalParams other) { return this.robotVelocity.equals(other.getRobotVelocity()) &&