From 59514a50cf27880a3ba64e06f419791107e5552d Mon Sep 17 00:00:00 2001 From: DemoLaptop Date: Fri, 28 Jun 2024 16:20:28 +0200 Subject: [PATCH 1/3] Print if autoref is alive --- src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java b/src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java index f70de3e..ba6ba99 100644 --- a/src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java +++ b/src/main/java/nl/roboteamtwente/autoref/SSLAutoRef.java @@ -27,6 +27,7 @@ public class SSLAutoRef { private int commands = 0; private int nextTouchId = 0; + private long time_counter = 0; public SSLAutoRef() { this.referee = new Referee(); @@ -67,6 +68,10 @@ public void processWorldState(StateOuterClass.State statePacket) { gameStateChanges(game); referee.setGame(game); + time_counter += 1; + if (time_counter % 80 == 0) { + System.out.println("AUTOREF ALIVE"); + } } /** From 3fdd15237c245e6b35481403143dc8c6dd038de3 Mon Sep 17 00:00:00 2001 From: DemoLaptop Date: Fri, 28 Jun 2024 16:20:49 +0200 Subject: [PATCH 2/3] dont stop listening on wrong packet --- .../roboteamtwente/autoref/WorldConnection.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/nl/roboteamtwente/autoref/WorldConnection.java b/src/main/java/nl/roboteamtwente/autoref/WorldConnection.java index 746dcc5..46e039b 100644 --- a/src/main/java/nl/roboteamtwente/autoref/WorldConnection.java +++ b/src/main/java/nl/roboteamtwente/autoref/WorldConnection.java @@ -35,18 +35,19 @@ public void connect() { * Receive and process messages */ public void listener() { - try { - while (!Thread.currentThread().isInterrupted() && worldSocket != null) { + while (!Thread.currentThread().isInterrupted() && worldSocket != null) { + try { byte[] buffer = worldSocket.recv(); StateOuterClass.State packet = StateOuterClass.State.parseFrom(buffer); ref.checkViolations(packet); - } - } catch (InvalidProtocolBufferException e) { - e.printStackTrace(); - } catch (ZMQException e) { - //4 is the error code when we close the connection by hand, which can be ignored - if (e.getErrorCode() != 4) { + + } catch (InvalidProtocolBufferException e) { e.printStackTrace(); + } catch (ZMQException e) { + //4 is the error code when we close the connection by hand, which can be ignored + if (e.getErrorCode() != 4) { + e.printStackTrace(); + } } } } From 4fe0cd0fee59d20182aedb48395da31b4882394a Mon Sep 17 00:00:00 2001 From: DemoLaptop Date: Fri, 28 Jun 2024 16:21:16 +0200 Subject: [PATCH 3/3] decrease bot_crashing_distance --- .../autoref/validators/BotCrashingValidator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/nl/roboteamtwente/autoref/validators/BotCrashingValidator.java b/src/main/java/nl/roboteamtwente/autoref/validators/BotCrashingValidator.java index 3c2abe4..ca245f9 100644 --- a/src/main/java/nl/roboteamtwente/autoref/validators/BotCrashingValidator.java +++ b/src/main/java/nl/roboteamtwente/autoref/validators/BotCrashingValidator.java @@ -13,7 +13,7 @@ public class BotCrashingValidator implements RuleValidator { - private static final float BOT_CRASH_DISTANCE = 0.2f; + private static final float BOT_CRASH_DISTANCE = 0.005f; private static final float SPEED_VECTOR_THRESHOLD = 1.5f; private static final float MIN_SPEED_DIFFERENCE = 0.3f; private static final double GRACE_PERIOD = 2.0; @@ -111,7 +111,7 @@ public RuleViolation validate(Game game) { Vector2 robotBlueVel = robotBlue.getVelocity().xy(); float distanceBetweenRobots = robotYellowPos.distance(robotBluePos); - if (distanceBetweenRobots <= BOT_CRASH_DISTANCE) { + if (distanceBetweenRobots <= robotYellow.getRadius() + robotBlue.getRadius() + BOT_CRASH_DISTANCE) { // projection length of difference between speed vector float crashSpeed = calculateCollisionVelocity(robotBluePos, robotBlueVel, robotYellowPos, robotYellowVel);