@@ -39,6 +39,9 @@ class TigersAutoref(TimeProvider):
3939 BUFFER_TIMEOUT = 10
4040 NEXT_PACKET_DELAY = 1.0 / 30 # 30 Hz
4141
42+ AUTOREF_DIR = "/opt/tbotspython/autoReferee"
43+ AUTOREF_JAVA_HOME = "/opt/tbotspython/bin/jdk"
44+
4245 def __init__ (
4346 self ,
4447 gc : Gamecontroller ,
@@ -220,8 +223,10 @@ def _forward_to_gamecontroller(
220223
221224 def _start_autoref (self ) -> None :
222225 """Starts the TigersAutoref binary."""
223- autoref_cmd = "software/autoref/run_autoref"
226+ env = os .environ .copy ()
227+ env ["JAVA_HOME" ] = self .AUTOREF_JAVA_HOME
224228
229+ autoref_cmd = "bin/autoReferee -a"
225230 if not self .show_gui :
226231 autoref_cmd += " -hl"
227232
@@ -231,10 +236,16 @@ def _start_autoref(self) -> None:
231236 if self .suppress_logs :
232237 with open (os .devnull , "w" ) as fp :
233238 self .tigers_autoref_proc = Popen (
234- autoref_cmd .split (" " ), stdout = fp , stderr = fp
239+ autoref_cmd .split (" " ),
240+ stdout = fp ,
241+ stderr = fp ,
242+ env = env ,
243+ cwd = self .AUTOREF_DIR ,
235244 )
236245 else :
237- self .tigers_autoref_proc = Popen (autoref_cmd .split (" " ))
246+ self .tigers_autoref_proc = Popen (
247+ autoref_cmd .split (" " ), env = env , cwd = self .AUTOREF_DIR
248+ )
238249
239250 def setup_ssl_wrapper_packets (self , autoref_proto_unix_io : ProtoUnixIO ) -> None :
240251 """Registers as an observer of TrackerWrapperPackets from the Simulator, so that they can be forwarded to the
@@ -246,13 +257,12 @@ def setup_ssl_wrapper_packets(self, autoref_proto_unix_io: ProtoUnixIO) -> None:
246257 autoref_proto_unix_io .register_observer (Referee , self .referee_buffer )
247258
248259 def __exit__ (self , type , value , traceback ) -> None :
260+ self .end_autoref = True
249261 if self .tigers_autoref_proc :
250262 self .tigers_autoref_proc .terminate ()
251263 self .tigers_autoref_proc .wait ()
252264
253265 self .auto_ref_proc_thread .join ()
254-
255- self .end_autoref = True
256266 self .auto_ref_wrapper_thread .join ()
257267
258268 logging .info ("[TigersAutoref] Process exited" )
0 commit comments