Skip to content

Commit ce0c2c9

Browse files
schluisoleflb
andauthored
Tune ground provider (HULKs#2010)
* fix head json * low-pass-filter ground_provider * tune catching-steps, mirror ground_to_robot, tune zmp in walk, reduce support rectangle Co-authored-by: ole.flb <[email protected]> --------- Co-authored-by: ole.flb <[email protected]>
1 parent cbc575b commit ce0c2c9

File tree

5 files changed

+45
-25
lines changed

5 files changed

+45
-25
lines changed

crates/control/src/ground_provider.rs

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
use color_eyre::Result;
2+
use filtering::low_pass_filter::LowPassFilter;
23
use serde::{Deserialize, Serialize};
34

45
use context_attribute::context;
5-
use coordinate_systems::{Field, Ground, Robot};
6+
use coordinate_systems::{Ground, Robot};
67
use framework::MainOutput;
7-
use linear_algebra::{vector, Isometry3, Orientation3};
8-
use types::{robot_kinematics::RobotKinematics, support_foot::Side};
8+
use linear_algebra::{vector, Isometry3, Orientation3, Vector2};
9+
use types::{robot_kinematics::RobotKinematics, sensor_data::SensorData, support_foot::Side};
910

1011
#[derive(Deserialize, Serialize)]
11-
pub struct GroundProvider {}
12+
pub struct GroundProvider {
13+
roll_pitch_filter: LowPassFilter<Vector2<Robot>>,
14+
}
1215

1316
#[context]
14-
pub struct CreationContext {}
17+
pub struct CreationContext {
18+
roll_pitch_smoothing_factor: Parameter<f32, "ground_provider.roll_pitch_smoothing_factor">,
19+
}
1520

1621
#[context]
1722
pub struct CycleContext {
1823
robot_kinematics: Input<RobotKinematics, "robot_kinematics">,
19-
robot_orientation: RequiredInput<Option<Orientation3<Field>>, "robot_orientation?">,
2024
support_side: RequiredInput<Option<Side>, "support_foot.support_side?">,
25+
sensor_data: Input<SensorData, "sensor_data">,
2126
}
2227

2328
#[context]
@@ -28,16 +33,28 @@ pub struct MainOutputs {
2833
}
2934

3035
impl GroundProvider {
31-
pub fn new(_context: CreationContext) -> Result<Self> {
32-
Ok(Self {})
36+
pub fn new(context: CreationContext) -> Result<Self> {
37+
Ok(Self {
38+
roll_pitch_filter: LowPassFilter::with_smoothing_factor(
39+
vector![0.0, 0.0],
40+
*context.roll_pitch_smoothing_factor,
41+
),
42+
})
3343
}
3444

3545
pub fn cycle(&mut self, context: CycleContext) -> Result<MainOutputs> {
3646
struct LeftSoleHorizontal;
3747
struct RightSoleHorizontal;
3848

39-
let (roll, pitch, _) = context.robot_orientation.inner.euler_angles();
40-
let imu_orientation = Orientation3::from_euler_angles(roll, pitch, 0.0).mirror();
49+
self.roll_pitch_filter
50+
.update(context.sensor_data.inertial_measurement_unit.roll_pitch);
51+
52+
let imu_orientation = Orientation3::from_euler_angles(
53+
self.roll_pitch_filter.state().x(),
54+
self.roll_pitch_filter.state().y(),
55+
0.0,
56+
)
57+
.mirror();
4158

4259
let left_sole_horizontal_to_robot = Isometry3::from_parts(
4360
context

crates/walking_engine/src/mode/catching.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,18 @@ pub fn should_catch(context: &Context, end_feet: Feet, support_side: Side) -> bo
245245
Feet::from_joints(robot_to_walk, &context.last_actuated_joints, support_side);
246246

247247
let zmp = context.zero_moment_point;
248-
let zmp_scaling_x = if zmp.coords().x() < 0.0 {
249-
catching_steps.zero_moment_point_x_scale_backward
248+
let target_scaling_x = if zmp.coords().x() < 0.0 {
249+
catching_steps.target_x_scale_backward
250250
} else {
251-
catching_steps.zero_moment_point_x_scale_forward
251+
catching_steps.target_x_scale_forward
252252
};
253253

254-
let tuned_zmp = zmp
254+
let target = (robot_to_walk * ground_to_robot * zmp.extend(0.0))
255+
.xy()
255256
.coords()
256-
.component_mul(&vector![zmp_scaling_x, 1.0])
257+
.component_mul(&vector![target_scaling_x, 1.0])
257258
.as_point();
258259

259-
let target = (robot_to_walk * ground_to_robot * tuned_zmp.extend(0.0)).xy();
260-
261260
is_outside_support_polygon(end_feet, support_side, target, current_feet)
262261
}
263262

crates/walking_engine/src/parameters.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ pub struct FootLevelingParameters {
126126
)]
127127
pub struct CatchingStepsParameters {
128128
pub enabled: bool,
129-
pub zero_moment_point_x_scale_backward: f32,
130-
pub zero_moment_point_x_scale_forward: f32,
129+
pub target_x_scale_backward: f32,
130+
pub target_x_scale_forward: f32,
131131
pub max_target_distance: f32,
132132
pub over_estimation_factor: f32,
133133
}

etc/parameters/default.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"ground_provider": {
3+
"roll_pitch_smoothing_factor": 0.25
4+
},
25
"pose_detection": {
36
"enable": true,
47
"maximum_intersection_over_union": 0.45,
@@ -361,10 +364,10 @@
361364
},
362365
"catching_steps": {
363366
"enabled": true,
364-
"zero_moment_point_x_scale_backward": 0.5,
365-
"zero_moment_point_x_scale_forward": 0.8,
366-
"max_target_distance": 0.15,
367-
"over_estimation_factor": 0.6
367+
"target_x_scale_backward": 1.1,
368+
"target_x_scale_forward": 1.0,
369+
"max_target_distance": 0.1,
370+
"over_estimation_factor": 0.4
368371
},
369372
"gyro_balancing": {
370373
"noise_scale": [0.5, 0.5],
@@ -387,7 +390,7 @@
387390
}
388391
},
389392
"dynamic_interpolation_speed": {
390-
"active_range": [-0.1745, -0.0873],
393+
"active_range": [-0.1445, -0.0573],
391394
"max_reduction": 0.7
392395
},
393396
"foot_leveling": {
@@ -404,7 +407,7 @@
404407
"forward_turn_threshold": 0.45,
405408
"foot_support": {
406409
"min": [-0.02, -0.02],
407-
"max": [0.08, 0.02]
410+
"max": [0.04, 0.02]
408411
},
409412
"max_rotation_speed": 50000.0,
410413
"max_forward_acceleration": 0.01,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)