Skip to content

Commit 076590d

Browse files
committed
add new behavior parameter
1 parent 4f85d4e commit 076590d

5 files changed

Lines changed: 28 additions & 6 deletions

File tree

crates/hulk_manifest/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,9 @@ pub fn collect_hulk_cyclers(root: impl AsRef<Path>) -> Result<Cyclers, Error> {
110110
"world_state::ball_filter",
111111
"world_state::ball_projector",
112112
"world_state::behavior::walk_to_ball",
113+
"world_state::camera_matrix_calculator",
113114
"world_state::game_controller_filter",
114115
"world_state::game_controller_state_filter",
115-
"world_state::ball_projector",
116-
"world_state::camera_matrix_calculator",
117116
"world_state::ground_provider",
118117
"world_state::kinematics_provider",
119118
],

crates/types/src/parameters.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct BehaviorParameters {
5151
pub maximum_lookaround_duration: Duration,
5252
pub time_to_reach_delay_when_fallen: Duration,
5353
pub maximum_standup_attempts: u32,
54+
pub walk_with_velocity: WalkWithVelocityParameters,
5455
}
5556

5657
#[derive(
@@ -501,6 +502,14 @@ pub struct RLWalkingParameters {
501502
pub joint_position_smoothing_factor: f32,
502503
}
503504

505+
#[derive(
506+
Clone, Debug, Default, Deserialize, Serialize, PathSerialize, PathDeserialize, PathIntrospect,
507+
)]
508+
pub struct WalkWithVelocityParameters {
509+
pub max_velocity: f32,
510+
pub max_angular_velocity: f32,
511+
}
512+
504513
#[derive(
505514
Clone, Debug, Default, Deserialize, Serialize, PathSerialize, PathDeserialize, PathIntrospect,
506515
)]

crates/vision/src/image_receiver.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub struct MainOutputs {
2626
pub image: MainOutput<Image>,
2727
pub camera_info: MainOutput<CameraInfo>,
2828
pub cycle_time: MainOutput<CycleTime>,
29-
pub balls: MainOutput<Option<Vec<BallPercept>>>,
3029
}
3130

3231
impl ImageReceiver {
@@ -56,7 +55,6 @@ impl ImageReceiver {
5655
image: image.into(),
5756
camera_info: camera_info.into(),
5857
cycle_time: cycle_time.into(),
59-
balls: None.into(),
6058
})
6159
}
6260
}

crates/world_state/src/behavior/walk_to_ball.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use framework::MainOutput;
55
use serde::{Deserialize, Serialize};
66
use types::ball_position::BallPosition;
77
use types::motion_command::{HeadMotion, MotionCommand};
8+
use types::parameters::WalkWithVelocityParameters;
89

910
#[derive(Deserialize, Serialize)]
1011
pub struct WalkToBall {}
@@ -15,6 +16,8 @@ pub struct CreationContext {}
1516
#[context]
1617
pub struct CycleContext {
1718
ball_position: Input<Option<BallPosition<Ground>>, "ball_position?">,
19+
walk_with_velocity_parameter:
20+
Parameter<WalkWithVelocityParameters, "behavior.walk_with_velocity">,
1821
}
1922

2023
#[context]
@@ -33,10 +36,17 @@ impl WalkToBall {
3336
Some(ball_position) => {
3437
let ball_coordinates_in_ground = ball_position.position.coords();
3538
let head = HeadMotion::Center;
39+
let max_angular_velocity_abs = context
40+
.walk_with_velocity_parameter
41+
.max_angular_velocity
42+
.abs();
3643
MotionCommand::WalkWithVelocity {
3744
head,
38-
velocity: ball_coordinates_in_ground.normalize() * 0.5, // TODO: parameterize
39-
angular_velocity: ball_coordinates_in_ground.y().clamp(-0.25, 0.25), // TODO: parameterize
45+
velocity: ball_coordinates_in_ground.normalize()
46+
* context.walk_with_velocity_parameter.max_velocity,
47+
angular_velocity: ball_coordinates_in_ground
48+
.y()
49+
.clamp(-max_angular_velocity_abs, max_angular_velocity_abs),
4050
}
4151
}
4252
None => MotionCommand::Stand {

etc/parameters/default.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,12 @@
320320
"secs": 30
321321
}
322322
},
323+
"behavior": {
324+
"walk_with_velocity": {
325+
"max_velocity": 0.5,
326+
"max_angular_velocity": 0.25
327+
}
328+
},
323329
"field_dimensions": {
324330
"ball_radius": 0.095,
325331
"length": 9.0,

0 commit comments

Comments
 (0)