Skip to content

Commit 5fc07ec

Browse files
committed
Transmit robot specs for all robots (0-15)
1 parent deac3cd commit 5fc07ec

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

internal/simctl/robot_specs.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,29 @@ func (r *RobotSpecSetter) handleRobotSpecs() {
7575
func (r *RobotSpecSetter) updateTeam(team referee.Team, teamName string) {
7676
if r.appliedTeams[team] != teamName {
7777
if spec, ok := r.teamRobotSpecs.Teams[teamName]; ok {
78-
protoSpec := mapRobotSpec(spec)
79-
protoSpec.Id = new(referee.RobotId)
80-
protoSpec.Id.Id = new(uint32)
81-
protoSpec.Id.Team = new(referee.Team)
82-
*protoSpec.Id.Id = 0
83-
*protoSpec.Id.Team = team
84-
r.sendConfig(protoSpec)
78+
var protoSpecs []*RobotSpecs
79+
for id := 0; id < 16; id++ {
80+
protoSpec := mapRobotSpec(spec)
81+
protoSpec.Id = new(referee.RobotId)
82+
protoSpec.Id.Id = new(uint32)
83+
protoSpec.Id.Team = new(referee.Team)
84+
*protoSpec.Id.Team = team
85+
*protoSpec.Id.Id = uint32(id)
86+
protoSpecs = append(protoSpecs, protoSpec)
87+
}
88+
r.sendConfig(protoSpecs)
8589
r.appliedTeams[team] = teamName
8690
}
8791
}
8892
}
8993

90-
func (r *RobotSpecSetter) sendConfig(robotSpec *RobotSpecs) {
94+
func (r *RobotSpecSetter) sendConfig(robotSpec []*RobotSpecs) {
9195
log.Printf("Sending robot spec %v", robotSpec)
9296

9397
command := SimulatorCommand{
9498
Config: &SimulatorConfig{
95-
RobotSpecs: []*RobotSpecs{
96-
robotSpec,
97-
}},
99+
RobotSpecs: robotSpec,
100+
},
98101
}
99102

100103
if data, err := proto.Marshal(&command); err != nil {

0 commit comments

Comments
 (0)