Skip to content

Commit

Permalink
Only execute injected motion command in Playing
Browse files Browse the repository at this point in the history
  • Loading branch information
Narcha committed Jul 21, 2024
1 parent a1fdfa1 commit 04368b8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/control/src/behavior/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ impl Behavior {

pub fn cycle(&mut self, mut context: CycleContext) -> Result<MainOutputs> {
let world_state = context.world_state;
if let Some(command) = &context.parameters.injected_motion_command {
return Ok(MainOutputs {
motion_command: command.clone().into(),
dribble_path: None.into(),
});

if world_state.robot.primary_state == PrimaryState::Playing {
if let Some(command) = &context.parameters.injected_motion_command {
return Ok(MainOutputs {
motion_command: command.clone().into(),
dribble_path: None.into(),
});
}
}

if let Some(ball_state) = &world_state.ball {
Expand Down

0 comments on commit 04368b8

Please sign in to comment.