Skip to content

Commit 180d7c2

Browse files
committed
rival Score added
1 parent 99b2d09 commit 180d7c2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/lib/game_controller_hsl/game_controller_hsl/scripts/sim_gamestate.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class SimGamestate(Node):
5050
t: toggle kicking team
5151
s: toggle stopped state
5252
+: increase own score by 1
53+
-: increase rival score by 1
5354
5455
5556
@@ -82,6 +83,7 @@ def __init__(self):
8283
self.team_id = int(input("Please enter team id: "))
8384

8485
self.has_kick_off = True
86+
8587

8688
self.settings = termios.tcgetattr(sys.stdin)
8789

@@ -90,11 +92,13 @@ def __init__(self):
9092
"gamestate",
9193
QoSProfile(durability=DurabilityPolicy.TRANSIENT_LOCAL, depth=1),
9294
)
95+
96+
9397

9498
def loop(self):
9599
game_state_msg = GameState()
96100
game_state_msg.header.stamp = self.get_clock().now().to_msg()
97-
101+
game_state_msg.players_per_team = 4
98102
# Init kicking team to our teamID
99103
game_state_msg.kicking_team = self.team_id
100104

@@ -125,6 +129,8 @@ def loop(self):
125129
game_state_msg.stopped = not game_state_msg.stopped
126130
elif key == "+":
127131
game_state_msg.own_score += 1
132+
elif key == "-":
133+
game_state_msg.rival_score += 1
128134

129135
sys.stdout.write("\x1b[A")
130136
sys.stdout.write("\x1b[A")
@@ -147,6 +153,7 @@ def loop(self):
147153

148154

149155

156+
150157
f"""
151158
152159
Competition Type: {game_state_msg.competition_type}

0 commit comments

Comments
 (0)