Commit 522a3dfe authored by MarkG's avatar MarkG Committed by TIGERs GitLab
Browse files

Resolve "Fine-tune ER-Force simulator integration"

Closes #1630

See merge request main/Sumatra!1371

sumatra-commit: 88a755f54e7c9b09bac732631e8ef68cff1392d8
parent 1af5f483
Pipeline #16621 passed with stage
in 5 minutes and 31 seconds
/*
* Copyright (c) 2009 - 2018, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.ids;
......@@ -16,8 +16,8 @@ import lombok.Getter;
@Getter
public enum EAiTeam
{
BLUE(ETeamColor.BLUE),
YELLOW(ETeamColor.YELLOW),
BLUE(ETeamColor.BLUE),
;
......
......@@ -55,6 +55,13 @@ public class BallPlacementInterferenceDetector extends AGameEventDetector
@Override
protected Optional<IGameEvent> doUpdate()
{
if (!frame.getWorldFrame().getBall().isOnCam(0.2))
{
// Can not see the ball
violators.clear();
return Optional.empty();
}
Set<BotID> violatingBots = violatingBots();
violators.removeIf(b -> !violatingBots.contains(b.getBotId()));
violatingBots.stream().filter(this::isNewViolator)
......
......@@ -60,7 +60,7 @@ public class BallSpeedingDetector extends AGameEventDetector
BallKickFitState lastKickFitState = frame.getPreviousFrame().getWorldFrame().getKickFitState().get();
double kickSpeed = lastKickFitState.getKickVel().getLength() / 1000.;
if (isKickTooFast(kickSpeed)
&& kickEstimateIsReady(currentKickEvent))
&& kickEstimateIsReady(currentKickEvent, lastKickFitState))
{
lastReportedKickEvent = currentKickEvent;
IGameEvent violation;
......@@ -94,11 +94,12 @@ public class BallSpeedingDetector extends AGameEventDetector
}
private boolean kickEstimateIsReady(final IKickEvent currentKickEvent)
private boolean kickEstimateIsReady(final IKickEvent currentKickEvent, BallKickFitState lastKickFitState)
{
double kickEstimateAge = (frame.getTimestamp() - currentKickEvent.getTimestamp()) / 1e9;
double kickFitEstimateAge = (frame.getTimestamp() - lastKickFitState.getKickTimestamp()) / 1e9;
boolean kickEstimateIsReady = kickEstimateAge > maxWaitingTime;
boolean kickEstimateAged = kickEstimateAge > minWaitingTime;
boolean kickEstimateAged = kickFitEstimateAge > minWaitingTime;
// either time is up, or ball has left the field, or ball touched another bot
......
/*
* Copyright (c) 2009 - 2020, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.referee.source;
......@@ -49,7 +49,9 @@ public class NetworkRefereeReceiver extends ARefereeMessageSource implements Run
}
/** Constructor */
/**
* Constructor
*/
public NetworkRefereeReceiver()
{
super(ERefereeMessageSource.NETWORK);
......@@ -96,19 +98,21 @@ public class NetworkRefereeReceiver extends ARefereeMessageSource implements Run
break;
}
if (packet.getLength() > 0)
{
refBoxAddress = packet.getAddress();
final ByteArrayInputStream packetIn = new ByteArrayInputStream(packet.getData(), 0, packet.getLength());
SslGcRefereeMessage.Referee sslRefereeMsg;
try
{
sslRefereeMsg = SslGcRefereeMessage.Referee.parseFrom(packetIn);
var packetIn = new ByteArrayInputStream(packet.getData(), 0, packet.getLength());
var sslRefereeMsg = SslGcRefereeMessage.Referee.parseFrom(packetIn);
// Notify the receipt of a new RefereeMessage to any other observers
notifyNewRefereeMessage(sslRefereeMsg);
} catch (IOException err)
{
log.error("Could not read referee message ", err);
log.error("Could not read referee message", err);
}
}
}
......
......@@ -123,6 +123,8 @@ public class WorldInfoCollector extends AWorldPredictor
static
{
ConfigRegistration.registerClass("wp", WorldInfoCollector.class);
String env = SumatraModel.getInstance().getEnvironment();
ConfigRegistration.applySpezi("wp", env);
ConfigRegistration.registerConfigurableCallback("wp", new IConfigObserver()
{
@Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment