Skip to content

Commit df91731

Browse files
committed
Remove timeout from advantage response
1 parent da06291 commit df91731

File tree

11 files changed

+150
-382
lines changed

11 files changed

+150
-382
lines changed

cmd/ssl-team-client/main.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ func main() {
6262
c.sendDesiredKeeper(3)
6363

6464
for {
65-
for i := 0; i < 30; i++ {
66-
c.ReplyToChoices()
67-
time.Sleep(time.Millisecond * 100)
68-
}
69-
log.Print("Waiting")
70-
time.Sleep(time.Millisecond * 2000)
65+
c.SendAdvantageChoice(rcon.AdvantageResponse_CONTINUE)
66+
time.Sleep(time.Millisecond * 1000)
67+
c.SendAdvantageChoice(rcon.AdvantageResponse_STOP)
68+
time.Sleep(time.Millisecond * 1000)
7169
}
7270
}
7371

@@ -121,8 +119,8 @@ func (c *Client) sendDesiredKeeper(id int32) (accepted bool) {
121119
return c.sendRequest(&request)
122120
}
123121

124-
func (c *Client) ReplyToChoices() {
125-
reply := rcon.TeamToController_AdvantageResponse{AdvantageResponse: rcon.AdvantageResponse_CONTINUE}
122+
func (c *Client) SendAdvantageChoice(choice rcon.AdvantageResponse) {
123+
reply := rcon.TeamToController_AdvantageResponse{AdvantageResponse: choice}
126124
response := rcon.TeamToController{Msg: &reply}
127125
c.sendRequest(&response)
128126
}

config/ssl-game-controller.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ game:
5050
continue-from-halt: false
5151
challenge-flags: 3
5252
emergency-stop-grace-period: 10s
53-
advantage-response-timeout: 1s
5453
normal:
5554
half-duration: 5m
5655
half-time-duration: 5m

internal/app/config/config.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ type Game struct {
6262
ContinueFromHalt bool `yaml:"continue-from-halt"`
6363
ChallengeFlags int32 `yaml:"challenge-flags"`
6464
EmergencyStopGracePeriod time.Duration `yaml:"emergency-stop-grace-period"`
65-
AdvantageResponseTimeout time.Duration `yaml:"advantage-response-timeout"`
6665
}
6766

6867
// Network holds configs for network communication
@@ -194,7 +193,6 @@ func DefaultControllerConfig() (c Controller) {
194193
c.Game.AutoApproveGoals = false
195194
c.Game.ChallengeFlags = 3
196195
c.Game.EmergencyStopGracePeriod = 10 * time.Second
197-
c.Game.AdvantageResponseTimeout = 500 * time.Millisecond
198196

199197
c.Game.Normal.HalfDuration = 5 * time.Minute
200198
c.Game.Normal.HalfTimeDuration = 5 * time.Minute

internal/app/config/testdata/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ game:
4949
continue-from-halt: false
5050
challenge-flags: 3
5151
emergency-stop-grace-period: 10s
52-
advantage-response-timeout: 1s
5352
normal:
5453
half-duration: 5m
5554
half-time-duration: 5m

internal/app/engine/process_team_advantage.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ func (e *Engine) processTeamAdvantageResponse() {
1212
e.gcState.TeamState[team.String()].LastAdvantageResponse = &TeamAdvantageResponse{
1313
Response: &defaultResponse,
1414
}
15-
} else if advantageResponse.Timestamp != nil {
16-
age := e.lastTimeUpdate.Sub(advantageResponse.Timestamp.AsTime())
17-
if age > e.gameConfig.AdvantageResponseTimeout {
18-
// reset
19-
advantageResponse.Timestamp = nil
20-
advantageResponse.Response = &defaultResponse
21-
}
2215
}
2316
}
2417
}

internal/app/engine/ssl_gc_engine.pb.go

Lines changed: 103 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/app/rcon/server_team.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/statemachine"
99
"github.com/google/uuid"
1010
"github.com/pkg/errors"
11-
"google.golang.org/protobuf/types/known/timestamppb"
1211
"io"
1312
"log"
1413
"net"
@@ -117,6 +116,7 @@ func (s *TeamServer) handleClientConnection(conn net.Conn) {
117116
connected := false
118117
teamState.Connected = &connected
119118
teamState.ConnectionVerified = &connected
119+
teamState.LastAdvantageResponse = nil
120120
} else {
121121
log.Println("Team not connected: " + client.team.String())
122122
}
@@ -184,8 +184,7 @@ func (s *TeamServer) processRequest(teamClient TeamClient, request *TeamToContro
184184
}
185185
s.gcEngine.UpdateGcState(func(gcState *engine.GcState) {
186186
gcState.TeamState[teamClient.team.String()].LastAdvantageResponse = &engine.TeamAdvantageResponse{
187-
Response: &responseType,
188-
Timestamp: timestamppb.New(s.gcEngine.GetLastTimeUpdate()),
187+
Response: &responseType,
189188
}
190189
})
191190
// exit early to avoid spamming the log

internal/app/rcon/ssl_gc_rcon_team.pb.go

Lines changed: 35 additions & 190 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)