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
rmburg committed Jul 19, 2024
1 parent d561b59 commit 17dd27e
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 17dd27e

Please sign in to comment.