@@ -3,7 +3,9 @@ package publish
3
3
import (
4
4
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/engine"
5
5
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
6
+ "github.com/google/uuid"
6
7
"google.golang.org/protobuf/types/known/durationpb"
8
+ "log"
7
9
"time"
8
10
)
9
11
@@ -13,6 +15,7 @@ type MessageGenerator struct {
13
15
commandTimestamp uint64
14
16
quit chan int
15
17
gcEngine * engine.Engine
18
+ sourceIdentifier string
16
19
MessageConsumers []func (* state.Referee )
17
20
EngineHook chan engine.HookOut
18
21
}
@@ -25,6 +28,9 @@ func NewMessageGenerator() (m *MessageGenerator) {
25
28
m .goal [state .Team_BLUE ] = false
26
29
m .goal [state .Team_YELLOW ] = false
27
30
m .quit = make (chan int , 1 )
31
+ m .sourceIdentifier = uuid .NewString ()
32
+
33
+ log .Println ("Publishing referee messages as " , m .sourceIdentifier )
28
34
29
35
return
30
36
}
@@ -95,6 +101,7 @@ func (g *MessageGenerator) updateCommand() {
95
101
96
102
func (g * MessageGenerator ) StateToRefereeMessage (matchState * state.State ) (r * state.Referee ) {
97
103
r = newRefereeMessage ()
104
+ * r .SourceIdentifier = g .sourceIdentifier
98
105
r .DesignatedPosition = mapLocation (matchState .PlacementPos )
99
106
r .GameEvents = matchState .GameEvents
100
107
r .GameEventProposals = mapProposals (matchState .ProposalGroups )
@@ -134,6 +141,7 @@ func updateTeam(teamInfo *state.Referee_TeamInfo, teamState *state.TeamInfo) {
134
141
135
142
func newRefereeMessage () (m * state.Referee ) {
136
143
m = new (state.Referee )
144
+ m .SourceIdentifier = new (string )
137
145
m .PacketTimestamp = new (uint64 )
138
146
m .Stage = new (state.Referee_Stage )
139
147
m .StageTimeLeft = new (int32 )
0 commit comments