Skip to content

Commit e4b4e91

Browse files
committed
cleaned up
1 parent edb23c7 commit e4b4e91

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

crates/control/src/motion/stand_up_front_slow.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct CreationContext {
3535
pub struct CycleContext {
3636
leg_balancing_factor:
3737
Parameter<nalgebra::Vector2<f32>, "stand_up_front_slow.leg_balancing_factor">,
38-
38+
speed_factor: Parameter<f32, "stand_up_front_slow.speed_factor">,
3939
condition_input: Input<ConditionInput, "condition_input">,
4040
cycle_time: Input<CycleTime, "cycle_time">,
4141
motion_selection: Input<MotionSelection, "motion_selection">,
@@ -71,14 +71,19 @@ impl StandUpFrontSlow {
7171
let estimated_remaining_duration = if context.motion_selection.current_motion
7272
== MotionType::StandUpFrontSlow
7373
{
74-
let last_cycle_duration = context.cycle_time.last_cycle_duration;
74+
let last_cycle_duration = context
75+
.cycle_time
76+
.last_cycle_duration
77+
.div_f32(*context.speed_factor);
7578
let condition_input = context.condition_input;
7679

7780
self.interpolator
7881
.advance_state(&mut self.state, last_cycle_duration, condition_input);
7982

8083
RemainingStandUpDuration::Running(
81-
self.interpolator.estimated_remaining_duration(self.state),
84+
self.interpolator
85+
.estimated_remaining_duration(self.state)
86+
.mul_f32(*context.speed_factor),
8287
)
8388
} else {
8489
self.state.reset();

crates/control/src/motion/stand_up_sitting_slow.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct CreationContext {
3535
pub struct CycleContext {
3636
leg_balancing_factor:
3737
Parameter<nalgebra::Vector2<f32>, "stand_up_sitting_slow.leg_balancing_factor">,
38-
38+
speed_factor: Parameter<f32, "stand_up_sitting_slow.speed_factor">,
3939
condition_input: Input<ConditionInput, "condition_input">,
4040
cycle_time: Input<CycleTime, "cycle_time">,
4141
motion_selection: Input<MotionSelection, "motion_selection">,
@@ -71,14 +71,19 @@ impl StandUpSittingSlow {
7171
let estimated_remaining_duration = if context.motion_selection.current_motion
7272
== MotionType::StandUpSittingSlow
7373
{
74-
let last_cycle_duration = context.cycle_time.last_cycle_duration / 2;
74+
let last_cycle_duration = context
75+
.cycle_time
76+
.last_cycle_duration
77+
.div_f32(*context.speed_factor);
7578
let condition_input = context.condition_input;
7679

7780
self.interpolator
7881
.advance_state(&mut self.state, last_cycle_duration, condition_input);
7982

8083
RemainingStandUpDuration::Running(
81-
self.interpolator.estimated_remaining_duration(self.state) * 2,
84+
self.interpolator
85+
.estimated_remaining_duration(self.state)
86+
.mul_f32(*context.speed_factor),
8287
)
8388
} else {
8489
self.state.reset();

etc/parameters/default.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,13 @@
529529
},
530530
"stand_up_front_slow": {
531531
"gyro_low_pass_factor": 0.4,
532-
"leg_balancing_factor": [0, 0.05]
532+
"leg_balancing_factor": [0, 0.05],
533+
"speed_factor": 2.0
533534
},
534535
"stand_up_sitting_slow": {
535536
"gyro_low_pass_factor": 0.4,
536-
"leg_balancing_factor": [0, 0.05]
537+
"leg_balancing_factor": [0, 0.05],
538+
"speed_factor": 2.0
537539
},
538540
"keeper_motion": {
539541
"maximum_ball_distance": 1.5,

0 commit comments

Comments
 (0)