Skip to content

Commit

Permalink
Change maximum DS packet interval from 250ms to 500ms to match FMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed Jul 28, 2024
1 parent 9bd23c3 commit 367750e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion field/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

const (
arenaLoopPeriodMs = 10
dsPacketPeriodMs = 250
dsPacketPeriodMs = 500
periodicTaskPeriodSec = 30
matchEndScoreDwellSec = 3
postTimeoutSec = 4
Expand Down
12 changes: 6 additions & 6 deletions field/arena_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestArenaMatchFlow(t *testing.T) {
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-10 * time.Millisecond)
arena.Update()
assert.Equal(t, lastPacketCount, arena.AllianceStations["B3"].DsConn.packetCount)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, lastPacketCount+1, arena.AllianceStations["B3"].DsConn.packetCount)

Expand Down Expand Up @@ -161,25 +161,25 @@ func TestArenaMatchFlow(t *testing.T) {

// Check E-stop and bypass.
arena.AllianceStations["B3"].EStop = true
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, TeleopPeriod, arena.MatchState)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Auto)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Enabled)
arena.AllianceStations["B3"].Bypass = true
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, TeleopPeriod, arena.MatchState)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Auto)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Enabled)
arena.AllianceStations["B3"].EStop = false
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, TeleopPeriod, arena.MatchState)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Auto)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Enabled)
arena.AllianceStations["B3"].Bypass = false
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, TeleopPeriod, arena.MatchState)
assert.Equal(t, false, arena.AllianceStations["B3"].DsConn.Auto)
Expand All @@ -200,7 +200,7 @@ func TestArenaMatchFlow(t *testing.T) {

arena.AllianceStations["R1"].Bypass = true
arena.ResetMatch()
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-300 * time.Millisecond)
arena.lastDsPacketTime = arena.lastDsPacketTime.Add(-550 * time.Millisecond)
arena.Update()
assert.Equal(t, PreMatch, arena.MatchState)
assert.Equal(t, true, arena.AllianceStations["B3"].DsConn.Auto)
Expand Down

0 comments on commit 367750e

Please sign in to comment.