trajectory/ballistics/constraints/BCEvalParams:
Define toString and HashCode
This commit is contained in:
parent
c6d6b5ac0b
commit
41d878dab8
|
|
@ -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()) &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue