Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
abe8258
mpc step planning
rmburg Jan 26, 2025
c063a8b
taplo fmt
rmburg May 29, 2025
ad9b504
Nuke `traits::LossField`
rmburg May 29, 2025
78ca812
Use parameters instead of hard-coded constants
rmburg May 29, 2025
a060fe1
Move test around
rmburg May 29, 2025
7ce622b
Organize imports
rmburg May 29, 2025
d3aaf06
Add todo comment
rmburg May 29, 2025
217a79f
undo changes in golden goal
rmburg May 29, 2025
90b98ef
Rename `AlignWithPath` -> `Unspecified` to reflect new semantics
rmburg May 29, 2025
5e744e0
Refactor: remove `StepPlanningLossField`
rmburg May 29, 2025
78831bc
Clean up old comments
rmburg May 29, 2025
332f0be
Fix failing test
rmburg May 29, 2025
b42ae07
Borrow `Path`
rmburg May 29, 2025
34acdef
Borrow `Parameters`
rmburg May 29, 2025
203c594
Naming consistency
rmburg May 30, 2025
8b5eb0a
Remove unused variable
rmburg May 31, 2025
9616603
Remove another unused variable
rmburg May 31, 2025
faecf17
Add todo comment
rmburg May 31, 2025
56c08f9
Remove outdated comment
knoellle May 31, 2025
3e20399
Re-implement customizable walk volume exponents
rmburg May 31, 2025
e235b6e
Remove unused parameters
rmburg Jun 4, 2025
7bb1a56
Fix parameter path
rmburg Jun 4, 2025
5e2f058
Undo accidental change
rmburg Jun 4, 2025
289606f
Remove todo comment
rmburg Jun 4, 2025
dc535a9
Remove outdated test comment
rmburg Jun 4, 2025
16ab3be
Update todo comment
rmburg Jun 4, 2025
3a0b79e
Reduce backwards step length
rmburg Jun 7, 2025
3128b29
Verify path_distance gradient
rmburg Jun 7, 2025
03b4218
Add some new gradient types
rmburg Jun 8, 2025
62ca8eb
Pose: use `Angle` for orientation
rmburg Jun 8, 2025
719e60c
Add more gradient verification tests
rmburg Jun 8, 2025
35be2f8
Use test_path fn from test_utils module
rmburg Jun 8, 2025
9057e04
Refactor module layout
rmburg Jun 8, 2025
35427d2
Update behavior sim scenarios
rmburg Jun 11, 2025
e4f8444
Fix bugs in target orientation field
rmburg Jun 11, 2025
e616eb3
Make learning rate configurable
rmburg Jun 11, 2025
73775b0
Expose current support side and draw soles in twix
rmburg Jun 11, 2025
4d37278
Expose step plan cost
rmburg Jun 11, 2025
d9e76fc
Also calculate greedy step plan
knoellle Jun 11, 2025
57c4155
Remove pub use
rmburg Jun 11, 2025
dc98ccc
Use correct norm for normalizing gradient
rmburg Jun 12, 2025
7fc5975
Fix greedy shit
knoellle Jun 12, 2025
6fd4e16
Remove `PoseAndSupportFoot` struct
rmburg Jun 12, 2025
0dd57b2
Rename variable
rmburg Jun 13, 2025
a9b1127
Simulate support foot switch in greedy step plan
rmburg Jun 13, 2025
9cfe7d4
Remove `dbg`
rmburg Jun 13, 2025
89e55ee
Fix incorrect fake gradient size
rmburg Jun 13, 2025
3e3a5b2
--wip--
rmburg Jun 12, 2025
189f67b
Change mpc test scenario to use fixed path
rmburg Jun 12, 2025
9b493f3
--wip--
rmburg Jun 4, 2025
14b2e8e
Use OpEn/PANOC solver (WIP!)
rmburg Jun 12, 2025
5042d2f
Fix step drawing
rmburg Jun 13, 2025
3220a43
Improve step plan drawing
rmburg Jun 13, 2025
bfb0b49
Improve mpc demo scenario path
rmburg Jun 13, 2025
de9f44c
Normalize gradient
rmburg Jun 13, 2025
e3bf1cd
Tweak parameters
rmburg Jun 13, 2025
e21d5a2
Tweak demo scenario path
rmburg Jun 13, 2025
f64c86a
Fix incorrect step plan drawing (again)
rmburg Jun 13, 2025
deb3ba2
Remove unused parameter
rmburg Jun 14, 2025
6c735a6
Remove transparency of planned steps
rmburg Jun 14, 2025
b2757d1
Paint 0th step
rmburg Jun 14, 2025
a935fc3
Update optimization parameters
rmburg Jun 14, 2025
04b1531
Remove `PlannedStep`
rmburg Jun 14, 2025
0350ec9
Remove unused parameters
rmburg Jun 14, 2025
c84cf4d
Add benchmark
rmburg Jun 15, 2025
456f6b6
Optimization: precompute cost function parts
rmburg Jun 17, 2025
bc55980
Remove unused field
rmburg Jun 17, 2025
299c1b8
Remove unused field
rmburg Jun 17, 2025
70592a0
Tiny refactor
rmburg Jun 17, 2025
2f9aaf5
Add `EndPoints` trait
rmburg Jun 17, 2025
7698758
Refactor: reuse length impl
rmburg Jun 17, 2025
938dee8
Tiny refactor
rmburg Jun 17, 2025
b99dd52
impl endpoints for path
rmburg Jun 17, 2025
089d2d4
Take direct step to target if possible
rmburg Jun 26, 2025
f1056b5
Fix occasional instability
rmburg Jun 30, 2025
5009f4b
Organize step planning cost factors
rmburg Jun 30, 2025
aa49d6d
Don't panic if solver fails
rmburg Jun 30, 2025
acf5800
Fix trailing comma
rmburg Jun 30, 2025
2d13318
Remove unused import
rmburg Jun 30, 2025
c53c5a7
Refactor alignment importance scaling
rmburg Jul 1, 2025
b314ce7
Verify walk orientation gradient
rmburg Jul 1, 2025
8b7a9f1
Remove hybrid alignment
rmburg Jul 1, 2025
4ed9f41
Recycle variables of previous cycle
rmburg Jul 2, 2025
6df3ccd
Forget previous step plan on support side switch
rmburg Jul 2, 2025
5e13596
Update step planning test scenario
rmburg Jul 2, 2025
5fbfa9b
Enable walk and target orientation
rmburg Jul 2, 2025
83ba828
Tweak parameters to fix donking
rmburg Jul 2, 2025
8414a81
Add warm start parameter
rmburg Jul 5, 2025
94cdf2f
Refactor
rmburg Jul 5, 2025
b6540bd
Greedy step plan: Clamp to anatomical constraints
rmburg Jul 5, 2025
ff38d92
Fix missing struct field
rmburg Jul 5, 2025
4fd7376
Twix: draw target orientation
rmburg Jul 5, 2025
85620d6
Refactor
rmburg Jul 5, 2025
9a0fcc5
Re-add `OrientationMode::AlignWithPath`
rmburg Jul 12, 2025
1762ddd
Change some magic numbers
rmburg Jul 12, 2025
e4889ac
Move `WalkVolumeExtents` out of `StepPlanningOptimizationParameters`
rmburg Jul 12, 2025
4e68dee
Use constant for number of variables per step
rmburg Jul 12, 2025
013f529
Move `gradient_type` module to its own file
rmburg Jul 12, 2025
5fe6957
Rework step planner parameters and step clamping
rmburg Jul 13, 2025
9108384
Remove duplicate gradient_type module
rmburg Jul 13, 2025
ff1c7d3
Add `PoseGradient::zeros()` convenience method
rmburg Jul 13, 2025
73f5700
Remove unneccessary check
rmburg Jul 14, 2025
270ed9e
Fix sign flip in path alignment
rmburg Jul 14, 2025
99ab92e
Add proptest for `OrientationMode::AlignWithPath`
rmburg Jul 14, 2025
5551402
Use `OrientationMode::AlignWithPath` in `walk_to_pose`
rmburg Jul 14, 2025
e72d88b
Remove unneccessary `abs()`
rmburg Jul 14, 2025
b103bcd
Reduce path alignment tolerance parameter
rmburg Jul 14, 2025
a046223
Add tolerance field to `OrientationMode`
rmburg Jul 14, 2025
3aa8b13
Add orientation mode parameter to `walk_to_pose`
rmburg Jul 14, 2025
0b156e3
Fix searching behavior
rmburg Jul 15, 2025
724ccb1
Tweak target orientation in lost_ball
rmburg Jul 15, 2025
f2e1996
Add todo comment
rmburg Jul 15, 2025
97bac8a
Move `StepPlanning` out of `step_plan.rs`
rmburg Jul 15, 2025
a17b2fe
Re-add PR #1914, which was removed in a rebase
rmburg Jul 15, 2025
72b796e
Use `Path` newtype
rmburg Jul 15, 2025
4751bb8
Fix another timing issue
rmburg Jul 16, 2025
bed20f0
Move step planning proptest function bodies out of macro
rmburg Jul 16, 2025
bed2876
Reject proptest samples on test path discontinuities
rmburg Jul 16, 2025
f390952
Add proptest config to increase number of samples
rmburg Jul 16, 2025
0093afe
Add parameter to disable MPC step planning
rmburg Jul 16, 2025
b05dbbd
Constify number of steps
rmburg Jul 16, 2025
e6d548f
Remove todo
rmburg Jul 17, 2025
0bf0bc4
Remove `max_step_size` parameter
rmburg Jul 17, 2025
d9aed33
Add `Orientation` type
rmburg Jul 17, 2025
e26ba2f
Consolidate `WrapGradient` and `UnwrapGradient`
rmburg Jul 17, 2025
8fbbdab
Move test_path out of cfg(test) gate
rmburg Jul 18, 2025
0c37282
penalize orientation towards the wrong side of the path
rmburg Jul 18, 2025
de86133
Pin OpEn dependency
rmburg Jul 18, 2025
b6ab5ac
Remove step_planning_duration
rmburg Jul 18, 2025
3a4398d
Clamp inside movement without anatomical constraints
rmburg Jul 18, 2025
569dd4d
Rename `plan_step` to make intent clearer
rmburg Jul 18, 2025
b289e06
Adress review comments
rmburg Jul 27, 2025
826e76d
Remove unnecessary special case for striker walk-in
rmburg Jul 27, 2025
31ea2b7
Remove unused utilities
rmburg Jul 27, 2025
9b0322b
Move test_utils module to its own file
rmburg Jul 27, 2025
f841e51
Organize imports
rmburg Jul 27, 2025
cb1dc03
Refactor: use hybrid alignment distance again
rmburg Aug 10, 2025
740a939
Re-implement hybrid alignment for greedy step plan
rmburg Aug 14, 2025
7d30bb4
Refactor direct step and fix a few issues
rmburg Aug 14, 2025
369c6f7
Remove leftover comment
rmburg Aug 23, 2025
6fa8e43
Naming consistency
rmburg Aug 23, 2025
ee9e04f
Use methods of `Path` type
rmburg Aug 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 317 additions & 31 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ members = [
"crates/source_analyzer",
"crates/spl_network",
"crates/spl_network_messages",
"crates/step_planning",
"crates/step_planning_solver",
"crates/types",
"crates/vision",
"crates/walking_engine",
Expand Down Expand Up @@ -164,11 +166,13 @@ ndarray-conv = "0.4.1"
nix = { version = "0.29", features = ["ioctl"] }
nucleo-matcher = "0.3.1"
num-derive = "0.4.2"
num-dual = "0.11.1"
num-traits = "0.2"
object_detection = { path = "crates/object_detection" }
once_cell = "1.20.3"
openvino = { version = "0.8.0", features = ["runtime-linking"] }
opn = { path = "crates/opn" }
optimization_engine = "0.9.1"
opusfile-ng = "0.1.0"
ordered-float = "4.6.0"
parameters = { path = "crates/parameters" }
Expand Down Expand Up @@ -214,6 +218,8 @@ source_analyzer = { path = "crates/source_analyzer" }
spl_network = { path = "crates/spl_network" }
spl_network_messages = { path = "crates/spl_network_messages" }
splines = { version = "=4.2.0", features = ["serde"] }
step_planning = { path = "crates/step_planning" }
step_planning_solver = { path = "crates/step_planning_solver" }
structopt = "0.3.26"
syn = { version = "2.0.98", features = ["extra-traits", "full"] }
systemd = "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions crates/bevyhavior_simulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
spl_network = { workspace = true }
spl_network_messages = { workspace = true }
step_planning = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
types = { workspace = true }
Expand Down
8 changes: 2 additions & 6 deletions crates/bevyhavior_simulator/src/autoref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use bevy::{
use coordinate_systems::{Field, Ground};
use linear_algebra::{point, vector, Isometry2};
use spl_network_messages::{GameState, Penalty, SubState, Team};
use step_planning::traits::Length;
use types::{
ball_position::SimulatorBallState,
field_dimensions::{FieldDimensions, Half, Side},
motion_command::MotionCommand,
planned_path::PathSegment,
};

use crate::{
Expand Down Expand Up @@ -71,11 +71,7 @@ pub fn autoref(
MotionCommand::Unstiff
| MotionCommand::Penalized
| MotionCommand::Stand { .. } => false,
MotionCommand::Walk { path, .. }
if path.segments.iter().map(PathSegment::length).sum::<f32>() < 0.01 =>
{
false
}
MotionCommand::Walk { path, .. } if path.length() < 0.01 => false,
_ => true,
}
});
Expand Down
4 changes: 2 additions & 2 deletions crates/bevyhavior_simulator/src/bin/intercept_ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ fn startup(
) {
let mut robot = Robot::new(PlayerNumber::One);
*robot.ground_to_field_mut() = Isometry2::from_parts(vector![-2.0, 0.0], 0.0);
robot.parameters.step_planner.max_step_size.forward = 1.0;
robot.parameters.step_planner.max_step_size.left = 1.0;
robot.parameters.step_planner.walk_volume_extents.forward = 1.0;
robot.parameters.step_planner.walk_volume_extents.outward = 1.0;
robot.parameters.step_planner.request_scale = Step {
forward: 1.0,
left: 1.0,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevyhavior_simulator/src/bin/kick_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ fn update(
robots: Query<&mut Robot>,
mut exit: EventWriter<AppExit>,
) {
if time.ticks() == 6000 {
if time.ticks() == 5000 {
game_controller_commands.send(GameControllerCommand::SetSubState(
Some(SubState::KickIn),
Team::Hulks,
None,
));
}
if time.ticks() >= 6005 && time.ticks() < 6000 + FREE_KICK_DURATION_IN_TICKS {
if time.ticks() >= 5005 && time.ticks() < 5000 + FREE_KICK_DURATION_IN_TICKS {
for robot in robots.iter() {
if robot
.database
Expand Down
82 changes: 82 additions & 0 deletions crates/bevyhavior_simulator/src/bin/mpc_step_planning_optimizer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
use std::f32::consts::FRAC_PI_2;

use bevy::prelude::*;

use bevyhavior_simulator::{
game_controller::{GameController, GameControllerCommand},
robot::Robot,
time::{Ticks, TicksTime},
};
use geometry::{arc::Arc, circle::Circle, direction::Direction, line_segment::LineSegment};
use linear_algebra::{point, vector, Isometry2, Orientation2, Point2};
use scenario::scenario;
use spl_network_messages::{GameState, PlayerNumber};
use types::{
motion_command::{ArmMotion, HeadMotion, MotionCommand, OrientationMode, WalkSpeed},
planned_path::{Path, PathSegment},
};

#[scenario]
fn mpc_step_planner_optimizer(app: &mut App) {
app.add_systems(Startup, startup);
app.add_systems(Update, update);
}

fn startup(
mut commands: Commands,
mut game_controller_commands: EventWriter<GameControllerCommand>,
) {
commands.spawn(Robot::new(PlayerNumber::Seven));

game_controller_commands.send(GameControllerCommand::SetGameState(GameState::Playing));
}

fn update(
_game_controller: ResMut<GameController>,
time: Res<Time<Ticks>>,
mut exit: EventWriter<AppExit>,
mut robots: Query<&mut Robot>,
) {
let mut robot = robots.single_mut();

robot.database.main_outputs.ground_to_field =
Some(Isometry2::from_parts(vector![-1.0, -1.0], FRAC_PI_2));
robot.parameters.behavior.injected_motion_command = Some(MotionCommand::Walk {
head: HeadMotion::ZeroAngles,
left_arm: ArmMotion::Swing,
right_arm: ArmMotion::Swing,
speed: WalkSpeed::Normal,
path: Path {
segments: vec![
PathSegment::LineSegment(LineSegment(Point2::origin(), point![0.3, 0.0])),
PathSegment::Arc(Arc {
circle: Circle {
center: point![0.3, 0.3],
radius: 0.3,
},
start: Orientation2::new(3.0 * FRAC_PI_2),
end: Orientation2::new(0.0),
direction: Direction::Counterclockwise,
}),
PathSegment::LineSegment(LineSegment(point![0.6, 0.3], point![0.6, 0.8])),
],
},
orientation_mode: OrientationMode::Unspecified,
target_orientation: Orientation2::identity(),
distance_to_be_aligned: 0.1,
});

let optimizer_steps = time.ticks() as usize;
robots
.single_mut()
.parameters
.step_planner
.optimization_parameters
.optimizer_steps = optimizer_steps;

println!("tick {}: {optimizer_steps} steps", time.ticks());

if time.ticks() >= 500 {
exit.send(AppExit::Success);
}
}
101 changes: 101 additions & 0 deletions crates/bevyhavior_simulator/src/bin/step_planning_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
use std::f32::consts::TAU;

use bevy::prelude::*;

use bevyhavior_simulator::{
game_controller::GameControllerCommand,
robot::Robot,
time::{Ticks, TicksTime},
};
use linear_algebra::{point, Isometry2, Orientation2, Point2};
use scenario::scenario;
use spl_network_messages::{GameState, PlayerNumber};
use types::{
motion_command::{ArmMotion, HeadMotion, MotionCommand, OrientationMode, WalkSpeed},
planned_path::{Path, PathSegment},
};

#[scenario]
fn demonstration(app: &mut App) {
app.add_systems(Startup, startup);
app.add_systems(Update, update);
}

fn startup(
mut commands: Commands,
mut game_controller_commands: EventWriter<GameControllerCommand>,
) {
commands.spawn(Robot::new(PlayerNumber::Seven));
game_controller_commands.send(GameControllerCommand::SetGameState(GameState::Playing));
}

fn update(time: Res<Time<Ticks>>, mut exit: EventWriter<AppExit>, mut robots: Query<&mut Robot>) {
let mut robot = robots.iter_mut().next().unwrap();

robot
.parameters
.step_planner
.optimization_parameters
.optimizer_steps = 100;
robot
.parameters
.step_planner
.optimization_parameters
.warm_start = false;
robot.database.main_outputs.ground_to_field = Some(Isometry2::identity());

let angle = 0.01 * time.ticks() as f32;
let (sin, cos) = angle.sin_cos();
let turn_count = (angle / TAU) as usize;

let orbiting_point = point![cos, sin] * 0.4;
let orientation = Orientation2::from_cos_sin_unchecked(cos, sin);

let (path, orientation_mode, target_orientation) = match turn_count {
0 => (
Path {
segments: vec![PathSegment::LineSegment(
geometry::line_segment::LineSegment(Point2::origin(), orbiting_point),
)],
},
OrientationMode::Unspecified,
Orientation2::identity(),
),
1 => (
Path {
segments: vec![PathSegment::LineSegment(
geometry::line_segment::LineSegment(Point2::origin(), orbiting_point),
)],
},
OrientationMode::Unspecified,
orientation,
),
2 => (
Path {
segments: vec![PathSegment::LineSegment(
geometry::line_segment::LineSegment(Point2::origin(), point![0.4, 0.0]),
)],
},
OrientationMode::LookTowards {
direction: orientation,
tolerance: 0.0,
},
orientation,
),
_ => {
exit.send(AppExit::Success);
return;
}
};

robot.parameters.behavior.injected_motion_command = Some(MotionCommand::Walk {
path,
orientation_mode,
target_orientation,
distance_to_be_aligned: 0.1,
head: HeadMotion::ZeroAngles,
left_arm: ArmMotion::Swing,
right_arm: ArmMotion::Swing,
speed: WalkSpeed::Normal,
});
}
2 changes: 2 additions & 0 deletions crates/control/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ serde = { workspace = true }
smallvec = { workspace = true }
spl_network_messages = { workspace = true }
splines = { workspace = true }
step_planning = { workspace = true }
step_planning_solver = { workspace = true }
types = { workspace = true }
walking_engine = { workspace = true }
4 changes: 3 additions & 1 deletion crates/control/src/behavior/defend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use spl_network_messages::{GamePhase, SubState, Team};
use types::{
field_dimensions::{FieldDimensions, Side},
filtered_game_controller_state::FilteredGameControllerState,
motion_command::{JumpDirection, MotionCommand, WalkSpeed},
motion_command::{JumpDirection, MotionCommand, OrientationMode, WalkSpeed},
parameters::{KeeperMotionParameters, RolePositionsParameters},
path_obstacles::PathObstacle,
world_state::{BallState, WorldState},
Expand Down Expand Up @@ -68,6 +68,8 @@ impl<'cycle> Defend<'cycle> {
self.look_action.execute(),
path_obstacles_output,
walk_speed,
// TODO(rmburg): maybe change this instead of having a large distance_to_be_aligned?
OrientationMode::AlignWithPath,
distance_to_be_aligned,
hysteresis,
)
Expand Down
5 changes: 4 additions & 1 deletion crates/control/src/behavior/dribble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use types::{

use super::walk_to_pose::WalkPathPlanner;

#[allow(clippy::too_many_arguments)]
pub fn execute(
world_state: &WorldState,
walk_path_planner: &WalkPathPlanner,
in_walk_kicks: &InWalkKicksParameters,
parameters: &DribblingParameters,
dribble_path_plan: Option<DribblePathPlan>,
mut walk_speed: WalkSpeed,
distance_to_be_aligned: f32,
) -> Option<MotionCommand> {
let ball_position = world_state.ball?.ball_in_ground;
let distance_to_ball = ball_position.coords().norm();
Expand Down Expand Up @@ -70,10 +70,13 @@ pub fn execute(
match dribble_path_plan {
Some(DribblePathPlan {
orientation_mode,
target_orientation,
path,
}) => Some(walk_path_planner.walk_with_obstacle_avoiding_arms(
head,
orientation_mode,
target_orientation,
distance_to_be_aligned,
path,
walk_speed,
)),
Expand Down
13 changes: 10 additions & 3 deletions crates/control/src/behavior/intercept_ball.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use coordinate_systems::{Field, Ground};
use geometry::line::Line;
use geometry::line_segment::LineSegment;
use linear_algebra::{Isometry2, Orientation2, Point};
use geometry::{line::Line, look_at::LookAt};
use linear_algebra::{Isometry2, Point};
use spl_network_messages::{GamePhase, SubState};
use types::{
filtered_game_controller_state::FilteredGameControllerState,
Expand All @@ -16,6 +16,7 @@ pub fn execute(
world_state: &WorldState,
parameters: InterceptBallParameters,
walk_speed: WalkSpeed,
distance_to_be_aligned: f32,
) -> Option<MotionCommand> {
if let Some(
FilteredGameControllerState {
Expand Down Expand Up @@ -69,6 +70,7 @@ pub fn execute(
))],
};

let target_orientation = interception_point.look_at(&ball.ball_in_ground);
Some(MotionCommand::Walk {
head: HeadMotion::LookAt {
target: ball.ball_in_ground,
Expand All @@ -78,8 +80,13 @@ pub fn execute(
path,
left_arm: types::motion_command::ArmMotion::Swing,
right_arm: types::motion_command::ArmMotion::Swing,
orientation_mode: OrientationMode::Override(Orientation2::identity()),
orientation_mode: OrientationMode::LookTowards {
direction: target_orientation,
tolerance: 0.0,
},
speed: walk_speed,
target_orientation,
distance_to_be_aligned,
})
}
_ => None,
Expand Down
3 changes: 2 additions & 1 deletion crates/control/src/behavior/look_at_referee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use framework::AdditionalOutput;
use linear_algebra::{Point2, Pose2, Rotation2};
use types::{
camera_position::CameraPosition,
motion_command::{HeadMotion, ImageRegion, MotionCommand, WalkSpeed},
motion_command::{HeadMotion, ImageRegion, MotionCommand, OrientationMode, WalkSpeed},
path_obstacles::PathObstacle,
world_state::WorldState,
};
Expand Down Expand Up @@ -42,6 +42,7 @@ pub fn execute(
head_motion,
path_obstacles_output,
walk_speed,
OrientationMode::AlignWithPath,
distance_to_be_aligned,
walk_and_stand.parameters.hysteresis,
)
Expand Down
Loading