@@ -92,41 +92,6 @@ def compute_zmp_ref(
9292 return zmp_ref
9393
9494
95- def build_zmp_horizon (
96- t , com_initial_pose , steps , ss_t , ds_t , t_init , t_final , interp_fn = cubic_spline_interpolation
97- ):
98- T = len (t )
99- zmp_ref = np .zeros ([T , 2 ])
100-
101- # Step on the first foot
102- mask = t < t_init
103- alpha = t [mask ] / t_init
104- zmp_ref [mask , :] = interp_fn (alpha , com_initial_pose , steps [0 ])
105-
106- # Alternate between foot
107- for idx , (current_step , next_step ) in enumerate (zip (steps [:- 2 ], steps [1 :- 1 ])):
108- # Compute current time range
109- t_start = t_init + idx * (ss_t + ds_t )
110-
111- # Add single support phase
112- zmp_ref [(t >= t_start ) & (t < t_start + ss_t )] = current_step
113-
114- # Add double support phase
115- mask = (t >= t_start + ss_t ) & (t < t_start + ss_t + ds_t + t [1 ])
116- alpha = (t [mask ] - (t_start + ss_t )) / ds_t
117- zmp_ref [mask , :] = interp_fn (alpha , current_step , next_step )
118-
119- # Last phase: SS on last-but-one, then blend to midpoint of last two
120- t_start = t_init + (len (steps ) - 2 ) * (ss_t + ds_t )
121- zmp_ref [(t >= t_start ) & (t < t_start + ss_t )] = steps [- 2 ]
122-
123- mask = (t >= t_start + ss_t ) & (t < t_start + ss_t + t_final )
124- alpha = (t [mask ] - (t_start + ss_t )) / t_final
125- zmp_ref [mask , :] = interp_fn (alpha , steps [- 2 ], (steps [- 1 ] + steps [- 2 ]) / 2.0 )
126-
127- return zmp_ref
128-
129-
13095@dataclass
13196class PreviewControllerParams :
13297 """
0 commit comments