Skip to content

Commit f830f88

Browse files
committed
add assertions to bevihavior standing_searcher
1 parent dd8e059 commit f830f88

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

crates/bevyhavior_simulator/src/bin/standing_searcher.rs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
use std::time::Duration;
2+
13
use bevy::prelude::*;
24

3-
use linear_algebra::{point, vector, Isometry2};
5+
use linear_algebra::{point, vector};
46
use scenario::scenario;
5-
use spl_network_messages::{GameState, PlayerNumber};
7+
use spl_network_messages::{GameState, Penalty, PlayerNumber, Team};
68

79
use bevyhavior_simulator::{
810
ball::BallResource,
@@ -40,39 +42,42 @@ fn update(
4042
mut ball: ResMut<BallResource>,
4143
mut exit: EventWriter<AppExit>,
4244
mut robots: Query<&mut Robot>,
45+
mut game_controller_commands: EventWriter<GameControllerCommand>,
4346
) {
4447
if time.ticks() == 4150 {
45-
robots
46-
.iter_mut()
47-
.find(|robot| robot.parameters.player_number == PlayerNumber::Two)
48-
.unwrap()
49-
.database
50-
.main_outputs
51-
.ground_to_field = Some(Isometry2::from_parts(vector![-3.0, 3.0], 0.0));
48+
game_controller_commands.send(GameControllerCommand::Penalize(
49+
PlayerNumber::Two,
50+
Penalty::Manual {
51+
remaining: Duration::from_secs(1),
52+
},
53+
Team::Hulks,
54+
));
55+
}
56+
57+
if time.ticks() == 4155 {
58+
game_controller_commands.send(GameControllerCommand::Unpenalize(
59+
PlayerNumber::Two,
60+
Team::Hulks,
61+
));
5262
}
63+
5364
if time.ticks() == 4200 {
5465
ball.state = None;
5566
}
56-
if time.ticks() == 4400 {
57-
if let MotionCommand::Stand { head: _ } = robots
67+
68+
if time.ticks() == 4660 {
69+
if let MotionCommand::Stand { .. } = robots
5870
.iter_mut()
5971
.find(|robot| robot.parameters.player_number == PlayerNumber::Two)
6072
.unwrap()
6173
.database
6274
.main_outputs
6375
.motion_command
6476
{
65-
println!("Standing searcher after penalty");
77+
println!("Standing searcher at penalty walk-in");
6678
exit.send(AppExit::from_code(1));
6779
}
68-
if let MotionCommand::Walk {
69-
head: _,
70-
path: _,
71-
left_arm: _,
72-
right_arm: _,
73-
orientation_mode: _,
74-
speed: _,
75-
} = robots
80+
if let MotionCommand::Walk { .. } = robots
7681
.iter_mut()
7782
.find(|robot| robot.parameters.player_number == PlayerNumber::Three)
7883
.unwrap()

0 commit comments

Comments
 (0)