trajectory/ballistics/constraints/BCEvalParams:
Define generators for candidate shooter velocity (field and robot relative)
This commit is contained in:
parent
5617a3a91b
commit
3f60a91184
|
|
@ -29,6 +29,54 @@ public class BCEvalParams {
|
||||||
// Setup
|
// Setup
|
||||||
//
|
//
|
||||||
|
|
||||||
|
public static BCEvalParams genSetShooterVelocity(
|
||||||
|
Velocity3d candidateShooterVelocity
|
||||||
|
) {
|
||||||
|
return genSetShooterVelocity(
|
||||||
|
Velocity3d.zero, Units.Degrees.zero(), Velocity3d.zero,
|
||||||
|
candidateShooterVelocity
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BCEvalParams genSetShooterVelocity(
|
||||||
|
Velocity3d robotVelocity,
|
||||||
|
Angle robotAngle,
|
||||||
|
Velocity3d currentShooterVelocity,
|
||||||
|
Velocity3d candidateShooterVelocity
|
||||||
|
) {
|
||||||
|
return new BCEvalParams(
|
||||||
|
robotVelocity,
|
||||||
|
robotAngle,
|
||||||
|
currentShooterVelocity,
|
||||||
|
candidateShooterVelocity.plus(robotVelocity)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BCEvalParams genSetShooterRelativeVelocity(
|
||||||
|
Velocity3d candidateShooterVelocityRelative
|
||||||
|
) {
|
||||||
|
return genSetShooterRelativeVelocity(
|
||||||
|
Velocity3d.zero, Units.Degrees.zero(), Velocity3d.zero,
|
||||||
|
candidateShooterVelocityRelative
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BCEvalParams genSetShooterRelativeVelocity(
|
||||||
|
Velocity3d robotVelocity,
|
||||||
|
Angle robotAngle,
|
||||||
|
Velocity3d currentShooterVelocity,
|
||||||
|
Velocity3d candidateShooterVelocityRelative
|
||||||
|
) {
|
||||||
|
BCEvalParams toRet = genSetShooterVelocity(
|
||||||
|
robotVelocity,
|
||||||
|
robotAngle,
|
||||||
|
currentShooterVelocity,
|
||||||
|
candidateShooterVelocityRelative.rotate(robotAngle)
|
||||||
|
);
|
||||||
|
return toRet;
|
||||||
|
}
|
||||||
|
|
||||||
public BCEvalParams(
|
public BCEvalParams(
|
||||||
Velocity3d robotVelocity,
|
Velocity3d robotVelocity,
|
||||||
Angle robotAngle,
|
Angle robotAngle,
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,20 @@ public class BCEvalParamsTest {
|
||||||
"Robot Velocity and Angle"
|
"Robot Velocity and Angle"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test void testGenSetShooterVelocity() {
|
||||||
|
Velocity3d shooterVelocity = Velocity3d.genSpherical(2.0, -135.0, 0.0);
|
||||||
|
assertEquals(
|
||||||
|
shooterVelocity,
|
||||||
|
BCEvalParams.genSetShooterVelocity(shooterVelocity).getCandidateShooterVelocity()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test void testGenSetShooterRelativeVelocity() {
|
||||||
|
Velocity3d shooterRelativeVelocity = Velocity3d.genSpherical(2.0, -135.0, 0.0);
|
||||||
|
assertEquals(
|
||||||
|
shooterRelativeVelocity,
|
||||||
|
BCEvalParams.genSetShooterRelativeVelocity(shooterRelativeVelocity).getCandidateShooterVelocityRelative()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue