Skip to content

Commit

Permalink
kickoff position with rotation (#1101)
Browse files Browse the repository at this point in the history
* kickoff position with rotation

* encode kickoff position and rotation as pose2

* serialize deserialize rounding error
  • Loading branch information
MaikRe authored Jul 5, 2024
1 parent e94b982 commit b262635
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions crates/control/src/behavior/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ pub struct CycleContext {
lost_ball_parameters: Parameter<LostBallParameters, "behavior.lost_ball">,
intercept_ball_parameters: Parameter<InterceptBallParameters, "behavior.intercept_ball">,
maximum_step_size: Parameter<Step, "step_planner.max_step_size">,
striker_set_position: Parameter<Point2<Field>, "behavior.role_positions.striker_set_position">,
}

#[context]
Expand Down Expand Up @@ -355,7 +354,7 @@ impl Behavior {
&walk_and_stand,
&look_action,
&mut context.path_obstacles_output,
*context.striker_set_position,
context.parameters.role_positions.striker_kickoff_pose,
),
Action::WalkToPenaltyKick => walk_to_penalty_kick::execute(
world_state,
Expand Down
6 changes: 3 additions & 3 deletions crates/control/src/behavior/walk_to_kick_off.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use coordinate_systems::Field;
use framework::AdditionalOutput;
use linear_algebra::{Point2, Pose2};
use linear_algebra::Pose2;
use types::{motion_command::MotionCommand, path_obstacles::PathObstacle, world_state::WorldState};

use super::{head::LookAction, walk_to_pose::WalkAndStand};
Expand All @@ -10,11 +10,11 @@ pub fn execute(
walk_and_stand: &WalkAndStand,
look_action: &LookAction,
path_obstacles_output: &mut AdditionalOutput<Vec<PathObstacle>>,
striker_set_position: Point2<Field>,
striker_kickoff_pose: Pose2<Field>,
) -> Option<MotionCommand> {
let ground_to_field = world_state.robot.ground_to_field?;
walk_and_stand.execute(
ground_to_field.inverse() * Pose2::from(striker_set_position),
ground_to_field.inverse() * striker_kickoff_pose,
look_action.execute(),
path_obstacles_output,
)
Expand Down
4 changes: 2 additions & 2 deletions crates/types/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ops::{Index, Range};
use std::{path::PathBuf, time::Duration};

use coordinate_systems::{Field, Ground, NormalizedPixel};
use linear_algebra::{Point2, Vector2};
use linear_algebra::{Point2, Pose2, Vector2};
use path_serde::{PathDeserialize, PathIntrospect, PathSerialize};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -87,7 +87,7 @@ pub struct RolePositionsParameters {
pub striker_supporter_minimum_x: f32,
pub keeper_x_offset: f32,
pub striker_distance_to_non_free_center_circle: f32,
pub striker_set_position: Point2<Field>,
pub striker_kickoff_pose: Pose2<Field>,
}

#[derive(
Expand Down
5 changes: 4 additions & 1 deletion etc/parameters/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,10 @@
"striker_supporter_minimum_x": 2.0,
"keeper_x_offset": 0.1,
"striker_distance_to_non_free_center_circle": 0.4,
"striker_set_position": [-0.3, 0.0]
"striker_kickoff_pose": {
"translation": [0.0, 0.3],
"rotation": [0.0, -1.0]
}
},
"dribbling": {
"hybrid_align_distance": 0.5,
Expand Down

0 comments on commit b262635

Please sign in to comment.