Skip to content

Commit af3647e

Browse files
committed
Limit turn_acceleration when previous forward step magnitude was large
to reduce chance of tipping due to too large forward momentum
1 parent 30030bd commit af3647e

4 files changed

Lines changed: 22 additions & 7 deletions

File tree

crates/control/src/motion/step_planner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl StepPlanner {
6666
None
6767
};
6868

69-
let (max_turn_left, max_turn_right) = if let Some(support_side) = support_side {
69+
let (mut max_turn_left, mut max_turn_right) = if let Some(support_side) = support_side {
7070
if support_side == Side::Left {
7171
(-*context.max_inside_turn, context.max_step_size.turn)
7272
} else {

crates/walking_engine/src/mode/walking.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,21 @@ impl Walking {
4343
)
4444
};
4545

46+
let turn_acceleration =
47+
if last_requested_step.forward.abs() > context.parameters.forward_turn_threshold {
48+
context.parameters.max_turn_acceleration * context.parameters.forward_turn_reduction
49+
} else {
50+
context.parameters.max_turn_acceleration
51+
};
52+
4653
let requested_step = Step {
4754
forward: last_requested_step.forward
4855
+ (requested_step.forward - last_requested_step.forward)
4956
.clamp(backward_acceleration, forward_acceleration),
5057
left: requested_step.left,
51-
turn: requested_step.turn,
58+
turn: last_requested_step.turn
59+
+ (requested_step.turn - last_requested_step.turn)
60+
.clamp(-turn_acceleration, turn_acceleration),
5261
};
5362
let plan = StepPlan::new_from_request(context, requested_step, support_side);
5463
let step = StepState::new(plan);

crates/walking_engine/src/parameters.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ pub struct Parameters {
1717
pub catching_steps: CatchingStepsParameters,
1818
pub gyro_balancing: GyroBalancingParameters,
1919
pub foot_leveling: FootLevelingParameters,
20-
pub max_forward_acceleration: f32,
20+
pub forward_turn_reduction: f32,
21+
pub forward_turn_threshold: f32,
2122
pub max_base_inside_turn: f32,
23+
pub max_forward_acceleration: f32,
2224
pub max_inside_turn_increase: f32,
2325
pub max_rotation_speed: f32,
2426
pub max_step_duration: Duration,
2527
pub max_support_foot_lift_speed: f32,
28+
pub max_turn_acceleration: f32,
2629
pub min_step_duration: Duration,
2730
pub sole_pressure_threshold: f32,
2831
pub step_midpoint: Step,
29-
pub stiffnesses: Stiffnesses,
3032
pub stiffness_loss_compensation: StiffnessLossCompensation,
33+
pub stiffnesses: Stiffnesses,
3134
pub swinging_arms: SwingingArmsParameters,
3235
}
3336

etc/parameters/default.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
"rotation_exponent": 2.0,
385385
"request_scale": {
386386
"forward": 1.0,
387-
"left": 1.4,
387+
"left": 1.4, // todo
388388
"turn": 1.0
389389
}
390390
},
@@ -458,12 +458,15 @@
458458
"roll_scale": 0.0872665,
459459
"start_reduce_to_zero": 0.75
460460
},
461-
"max_rotation_speed": 50000.0,
462-
"max_forward_acceleration": 0.01,
461+
"forward_turn_reduction": 0.7,
462+
"forward_turn_threshold": 0.45,
463463
"max_base_inside_turn": 0.1,
464+
"max_forward_acceleration": 0.01,
464465
"max_inside_turn_increase": 4,
466+
"max_rotation_speed": 50000.0,
465467
"max_step_duration": { "nanos": 0, "secs": 2 },
466468
"max_support_foot_lift_speed": 0.025,
469+
"max_turn_acceleration": 0.7,
467470
"min_step_duration": { "nanos": 100000000, "secs": 0 },
468471
"sole_pressure_threshold": 0.4,
469472
"step_midpoint": {

0 commit comments

Comments
 (0)