Commit d84420d5 authored by NicolaiO's avatar NicolaiO 🐼 Committed by TIGERs GitLab
Browse files

Resolve "Connect AutoRef to correct GC address"

Closes #1583

See merge request main/Sumatra!1329

sumatra-commit: d6c67bc1d00e369f759cb83b8d36162445eef67b
parent 8ed93297
Pipeline #8617 passed with stage
in 3 minutes and 48 seconds
......@@ -66,10 +66,8 @@
<implementation>edu.tigers.sumatra.wp.exporter.VisionTrackerSender</implementation>
<properties>
<source-name>TIGERs AutoRef</source-name>
<address>224.5.23.2</address>
<port>10010</port>
<!-- <interface>enp12s0</interface>-->
</properties>
</module>
......
/*
* Copyright (c) 2009 - 2019, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.autoreferee.engine;
import java.net.InetAddress;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import edu.tigers.autoreferee.IAutoRefFrame;
import edu.tigers.autoreferee.engine.detector.EGameEventDetectorType;
import edu.tigers.autoreferee.module.AutoRefModule;
......@@ -21,6 +15,11 @@ import edu.tigers.sumatra.referee.AReferee;
import edu.tigers.sumatra.referee.control.GcEventFactory;
import edu.tigers.sumatra.referee.data.EGameState;
import edu.tigers.sumatra.referee.gameevent.IGameEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.net.InetAddress;
import java.util.Set;
public class ActiveAutoRefEngine extends AutoRefEngine
......@@ -65,6 +64,12 @@ public class ActiveAutoRefEngine extends AutoRefEngine
@Override
public void process(final IAutoRefFrame frame)
{
AReferee referee = SumatraModel.getInstance().getModule(AReferee.class);
String hostname = referee.getActiveSource().getRefBoxAddress()
.map(InetAddress::getHostAddress)
.orElse(DEFAULT_REFEREE_HOST);
remote.updateHostname(hostname);
processEngine(frame).forEach(this::processGameEvent);
if (SumatraModel.getInstance().isSimulation())
......
/*
* Copyright (c) 2009 - 2020, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.autoreferee.remote;
......@@ -65,6 +65,12 @@ public class AutoRefToGameControllerConnector implements Runnable
}
public void updateHostname(String hostname)
{
protocol.setHostname(hostname);
}
private void register()
{
log.debug("Starting registering");
......@@ -209,6 +215,7 @@ public class AutoRefToGameControllerConnector implements Runnable
this.responseObserverList.add(observer);
}
private static class QueueEntry
{
private final IGameEvent event;
......
/*
* Copyright (c) 2009 - 2019, DHBW Mannheim - TIGERs Mannheim
* Copyright (c) 2009 - 2021, DHBW Mannheim - TIGERs Mannheim
*/
package edu.tigers.sumatra.referee;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;
import lombok.Setter;
import lombok.extern.log4j.Log4j2;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.protobuf.Message;
import com.google.protobuf.Parser;
/**
* Main Class to interact with the new (2019) SSL GameController Protocol
......@@ -23,10 +22,10 @@ import com.google.protobuf.Parser;
* For more details about this protocol, visit the Repository of the official SSL-Game-Controller:
* https://github.com/RoboCup-SSL/ssl-game-controller
*/
@Log4j2
public class GameControllerProtocol
{
private static final Logger log = LogManager.getLogger(GameControllerProtocol.class);
@Setter
private String hostname;
private Socket socket;
private int port;
......@@ -115,7 +114,7 @@ public class GameControllerProtocol
return true;
} catch (IOException e)
{
log.warn("Connection to SSL-Game-Controller Failed", e);
log.warn("Connection to SSL-Game-Controller ({}:{}) failed", hostname, port, e);
}
return false;
}
......
Markdown is supported
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