Skip to content

Commit

Permalink
re-enable first case
Browse files Browse the repository at this point in the history
  • Loading branch information
rttwente committed Jul 10, 2024
1 parent 1c81ea1 commit f7b97c6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,20 @@ private void deriveTouch(Game game) {
if (ball.getVelocity().xy().magnitude() > 0.01f) {
// case: ball is rolling, robot has velocity in the same direct to try and grab the ball.
// but ball bounces off the robot
// if (ball.getVelocity().xy().magnitude() > previousBall.getVelocity().xy().magnitude() + 0.1f) {
// for (Robot robot : game.getRobots()) {
// // robot is in robot radius + speed ball + 0.025 margin meters from the ball
// // robot is traveling towards to ball
// distance = ball.getPosition().xy().distance(robot.getPosition().xy());
// if (distance < robot.getRadius() + ball.getVelocity().xy().magnitude() + 0.03f
// && (robot.getVelocity().xy().angle(ball.getVelocity().xy()) < 30 || robot.getVelocity().xy().angle(ball.getVelocity().xy()) > 330)
// && distance < deflectedMinDistance) {
// deflectedMinDistance = distance;
// deflectedBy = robot.getIdentifier();
// System.out.println("forward deflect");
// }
// }
// }
if (ball.getVelocity().xy().magnitude() > previousBall.getVelocity().xy().magnitude() + 0.1f) {
for (Robot robot : game.getRobots()) {
// robot is in robot radius + speed ball + 0.025 margin meters from the ball
// robot is traveling towards to ball
distance = ball.getPosition().xy().distance(robot.getPosition().xy());
if (distance < robot.getRadius() + ball.getVelocity().xy().magnitude() / 80.0f + 0.03f
&& (robot.getVelocity().xy().angle(ball.getVelocity().xy()) < 30 || robot.getVelocity().xy().angle(ball.getVelocity().xy()) > 330)
&& distance < deflectedMinDistance) {
deflectedMinDistance = distance;
deflectedBy = robot.getIdentifier();
System.out.println("forward deflect");
}
}
}

// case: ball bounces of a robot, changing its direction of travel
if (angle > BALL_ANGLE_NOISE_RANGE && angle < 360.0f - BALL_ANGLE_NOISE_RANGE) {
Expand Down

0 comments on commit f7b97c6

Please sign in to comment.