Skip to content

Commit c089012

Browse files
Tuned parameters from match versus RMIT (#643)
Co-authored-by: Harold Ruiter <harold@soaratorium.com>
1 parent 2218e25 commit c089012

4 files changed

Lines changed: 41 additions & 16 deletions

File tree

deploy/config/ball_detection.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ max_classification_age_eye_color = 100
66
ball_ratio = 0.35
77

88
# The ratio of green pixels in the patch below the ball.
9-
grass_ratio = 0.70
9+
grass_ratio = 0.7
1010

1111
# Height/width of the bounding box around the ball
12-
bounding_box_scale = 95.0
12+
bounding_box_scale = 80.0
1313

1414

1515
# The minimum overlap ratio between for bounding boxes to be merged using non-maximum suppression
@@ -39,10 +39,10 @@ bbox_padding_factor = 1.1
3939
ball_ratio = 0.35
4040

4141
# The ratio of green pixels in the patch below the ball.
42-
grass_ratio = 0.70
42+
grass_ratio = 0.1
4343

4444
# Height/width of the bounding box around the ball
45-
bounding_box_scale = 28.5
45+
bounding_box_scale = 30.0
4646

4747
# The minimum overlap ratio between for bounding boxes to be merged using non-maximum suppression
4848
nms_threshold = 0.3
@@ -64,7 +64,7 @@ grass_patch_y_offset_factor = 0.5
6464
grass_patch_radius_factor = 1.5
6565

6666
# Padding factor applied to final proposal box sizes to account for camera calibration error.
67-
bbox_padding_factor = 1.4
67+
bbox_padding_factor = 1.1
6868

6969
[classifier]
7070
# The threshold for the classifier to consider a proposal a ball

deploy/config/behavior.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ head_pitch_max = 0.25
1111
[rl_striker_search]
1212
# The output of the policy is element wise multiplied with this value to determine the
1313
# step that is requested to the walking engine.
14-
policy_output_scaling = { forward = 0.05, left = 0.07, turn = 0.2 }
14+
policy_output_scaling = { forward = 0.055, left = 0.07, turn = 0.2 }
1515
# Controls how fast the robot moves its head back and forth while looking around
1616
head_rotation_speed = 3.0
1717
# Controls how far to the left and right the robot looks while looking around, in radians.

deploy/config/walking_engine.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The base amount of time (in milliseconds) for one step.
2-
base_step_duration = 225
2+
base_step_duration = 240
33

44
# Duration modifiers (in seconds) for a single step.
55
# Modifies `base_step_duration` by adding (modifier * movement factor) seconds per step.
@@ -16,7 +16,7 @@ stopping_step_duration = 250
1616
# This value is normalized relative to the planned step duration. For example,
1717
# a value of `0.75` means the current step duration must be at least 75% of the
1818
# planned step duration before a foot switch can occur.
19-
minimum_step_duration_ratio = 0.75
19+
minimum_step_duration_ratio = 0.70
2020

2121
# The offset of the torso w.r.t. the hips in meters.
2222
#
@@ -48,7 +48,7 @@ arm_stiffness = 0.6
4848

4949
# The base amount to lift the feet in swing phase, in metres.
5050
# The foot lift is increased slightly, based on the forward and left in the command.
51-
base_foot_lift = 0.005
51+
base_foot_lift = 0.007
5252

5353
# The multiplier for each component of a step command to adjust the foot lift.
5454
# These values are multiplied by their respective component of the step command
@@ -68,7 +68,7 @@ stopping_foot_lift = 0.01
6868
max_acceleration = { forward = 0.01, left = 0.05, turn = 0.3 }
6969

7070
# The step size is clipped to this value; in both directions (e.g. range for forward is -max_step_size to max_step_size).
71-
max_step_size = { forward = 0.055, left = 0.05, turn = 0.7 }
71+
max_step_size = { forward = 0.06, left = 0.06, turn = 0.7 }
7272

7373

7474
[hip_height]
@@ -99,7 +99,7 @@ arm_swing_multiplier = 0.6
9999
#
100100
# Higher values mean that the filtered gyroscope value responds to changes quicker,
101101
# and lower values mean that it responds slower.
102-
gyro_lpf_alpha = 0.6
102+
gyro_lpf_alpha = 0.7
103103

104104
# The weight of the balance adjustment based on the y gyroscope value.
105105
# Increasing this value will use a larger portion of the filtered gyro value

yggdrasil/src/motion/step_planner.rs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ use nalgebra::{Isometry, Point2, UnitComplex, Vector2};
88
use rerun::{FillMode, LineStrip3D};
99
use std::time::Instant;
1010

11-
const TURN_SPEED: f32 = 0.2;
12-
const WALK_SPEED: f32 = 0.045;
11+
const TURN_SPEED: f32 = 0.4;
12+
const MIN_TURN_MULTIPLIER: f32 = 0.5;
13+
const MAX_TURN_MULTIPLIER: f32 = 1.0;
14+
const WALK_SPEED: f32 = 0.050;
1315

1416
const PRECISE_WALK_DISTANCE: f32 = 0.2;
1517

@@ -169,10 +171,10 @@ impl StepPlanner {
169171
}
170172

171173
fn plan_rotation(robot_pose: &RobotPose, target_rotation: UnitComplex<f32>) -> Option<Step> {
172-
let angle = target_rotation.angle() - robot_pose.world_rotation();
173-
let turn = TURN_SPEED * angle.signum();
174+
let angle_err = target_rotation.angle() - robot_pose.world_rotation();
175+
let turn = scale_turn_speed(angle_err);
174176

175-
if angle.abs() < 0.2 {
177+
if angle_err.abs() < 0.2 {
176178
None
177179
} else {
178180
Some(Step {
@@ -380,3 +382,26 @@ fn log_dynamic_obstacles(dbg: DebugContext, step_planner: Res<StepPlanner>, cycl
380382
.with_half_sizes(half_sizes),
381383
);
382384
}
385+
386+
#[inline(always)]
387+
fn scale_turn_speed(yaw_err: f32) -> f32 {
388+
use std::f32::consts::PI;
389+
390+
// Wrap to (-PI, PI]
391+
let mut e = yaw_err;
392+
if e > PI || e <= -PI {
393+
e = (e + PI).rem_euclid(2.0 * PI) - PI;
394+
}
395+
396+
let mag = e.abs();
397+
398+
if mag < 1e-4 {
399+
return 0.0;
400+
}
401+
402+
// Linear ramp: MIN_TURN_SPEED .. TURN_SPEED over 0..FULL_SPEED_ANGLE
403+
let frac = (mag / MAX_TURN_MULTIPLIER).min(1.0);
404+
let spd = MIN_TURN_MULTIPLIER + frac * (TURN_SPEED - MIN_TURN_MULTIPLIER);
405+
406+
spd.copysign(e)
407+
}

0 commit comments

Comments
 (0)