RoboCup-SPL/GameController

Mismatch GUI and broadcasted kick-off team in second half

Closed this issue · 5 comments

In the second half of the game, the kick-off team is shown differently in the GUI than broadcasted via network.

Assume team 4 (blue) starts against team 5 (red). In the first half, team 4 (blue) is shown to have kickoff and the data sent is:

data.team[0].teamnumber: 4
data.team[1].teamnumber: 5
data.kickoffteam: 0

Now go through READY/SET/PLAY and switch to Finish. Then click on "Second Half". The teams will switch sides, and team 5 (red) is now on the left side and shown as having kick-off. However, the data sent is

data.team[0].teamnumber: 5
data.team[1].teamnumber: 4
data.kickoffteam: 1

(The same happens if you let the first half time expire)

This is correct. "1" does not stand for the second team, but for TEAM_RED.

You can run the GameStateVisualizer and press F11 to get a (not so nice) visualization of the whole GameController packet.

Okay. The issue in our code is that in version 7 of the gamecontroller, the team array was sorted by team color (i.e. blue team was always team[0]). So basically data.kickoffteam could be used as index into the array. Now this seems to have changed in version 8 where this association does not work anymore because FirstHalf.changeSide switches the teams. I suppose this is in order for the gamecontroller and visualizer to switch the teams' sides?

This fixed relation between team color and side was one of the reasons for writing the new GameController, because the SPL penalty shootout was very hard to implement with the old one (switch sides, keep color). However semantically, "kickOffTeam" always was the team color and that it matched the index was just a coincidence that unfortunately was heavily exploited by the old GameController. After all, TeamInfo has an extra field for "teamColour".
The idea is that both GameController and GameStateVisualizer show the teams on the sides on which they play on the field, in particular since we have the two yellow goals.

This makes sense. I will adjust the compatibility layer in the HL branch however, as some teams rely on this order :-)