Skip to content

Commit

Permalink
chores: unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Leikoe committed Dec 30, 2024
1 parent 4fd428b commit 0e8cf3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use tokio::{join, select, time::sleep};

pub async fn strike_alone(world: &World, robot: &AllyRobot, ball: &Ball) {
pub async fn strike_alone(world: &World, robot: &AllyRobot, ball: &Ball) -> Result<(), GotoError> {
let goal = world.get_ennemy_goal_bounding_box().center();
let ball_to_goal = ball.to(&goal);
let ball_to_behind_ball = ball_to_goal.normalized().mul(-0.3);
Expand All @@ -20,17 +20,18 @@ pub async fn strike_alone(world: &World, robot: &AllyRobot, ball: &Ball) {
Some(ball_to_goal.angle()),
AvoidanceMode::AvoidRobotsAndBall,
)
.await
.expect("couldn't goto the ball, maybe we were against the ball ?");
.await?;
robot.enable_dribbler();
select! {
_ = robot
g = robot
.goto(
world,
ball,
Some(ball_to_goal.angle()),
AvoidanceMode::AvoidRobots,
) => {}
) => {
g?;
}
_ = robot.wait_until_has_ball() => {}
};
robot.disable_dribbler();
Expand All @@ -39,6 +40,8 @@ pub async fn strike_alone(world: &World, robot: &AllyRobot, ball: &Ball) {
interval.tick().await;
robot.kick();
}

Ok(())
}

pub async fn backwards_strike(world: &World, robot: &AllyRobot, ball: &Ball) {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use crabe_async::{
viewer::{self, ViewerObject},
vision::Vision,
world::{AllyRobot, EnnemyRobot, TeamColor, World},
IgnoreMutexErr, CONTROL_PERIOD, DETECTION_SCALING_FACTOR,
IgnoreMutexErr, DETECTION_SCALING_FACTOR,
};
use std::time::{Duration, Instant};
use std::time::Duration;
use tokio::{select, time::sleep};

// #[derive(Debug, Clone, Copy)]
Expand Down

0 comments on commit 0e8cf3b

Please sign in to comment.