Skip to content

Commit 79cab1c

Browse files
authored
Revert returning to Set and fix SetPlay condition (#647)
1 parent 76dc4ff commit 79cab1c

2 files changed

Lines changed: 4 additions & 21 deletions

File tree

yggdrasil/src/behavior/primary_state.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ pub enum PrimaryState {
5656
/// State at the start of the match where the robots stand up
5757
Initial,
5858
/// State in which robots walk to their legal positions
59-
Ready {
60-
referee_in_standby: bool,
61-
whistle_in_playing: bool,
62-
},
59+
Ready { referee_in_standby: bool },
6360
/// State in which the robots wait for a kick-off or penalty
6461
Set,
6562
/// State in which the robots are playing soccer, with a bool to keep state after a whistle
@@ -179,19 +176,12 @@ pub fn next_primary_state(
179176
PS::Playing {
180177
whistle_in_set: true
181178
}
182-
) || matches!(
183-
primary_state,
184-
PS::Ready {
185-
referee_in_standby: false,
186-
whistle_in_playing: true
187-
}
188179
) || whistle.detected();
189180

190181
let recognized_ready_pose = matches!(
191182
primary_state,
192183
PS::Ready {
193-
referee_in_standby: true,
194-
whistle_in_playing: false
184+
referee_in_standby: true
195185
}
196186
) || recognized_ready_pose;
197187

@@ -200,20 +190,14 @@ pub fn next_primary_state(
200190
GameState::Initial => PS::Initial,
201191
GameState::Standby if recognized_ready_pose => PS::Ready {
202192
referee_in_standby: true,
203-
whistle_in_playing: false,
204193
},
205194
GameState::Ready => PS::Ready {
206195
referee_in_standby: false,
207-
whistle_in_playing: false,
208196
},
209197
GameState::Set if heard_whistle => PS::Playing {
210198
whistle_in_set: true,
211199
},
212200
GameState::Set => PS::Set,
213-
GameState::Playing if heard_whistle => PS::Ready {
214-
referee_in_standby: false,
215-
whistle_in_playing: true,
216-
},
217201
GameState::Playing => PS::Playing {
218202
whistle_in_set: false,
219203
},

yggdrasil/src/behavior/roles/striker.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ fn in_set_play(
4747
return match *primary_state {
4848
// return true if there is a set play OR we are in Playing state with a secondary time (Kick-Off)
4949
PrimaryState::Playing { .. } => {
50-
message.set_play != SetPlay::None
51-
|| (message.secondary_time != 0
52-
&& message.kicking_team != player_config.team_number)
50+
(message.set_play != SetPlay::None || message.secondary_time != 0)
51+
&& message.kicking_team != player_config.team_number
5352
}
5453
_ => false,
5554
};

0 commit comments

Comments
 (0)