Movement smoothing
This commit is contained in:
+10
-1
@@ -129,7 +129,16 @@ def ikpyInverse(target_pos: dt.PosArray, initial_rad: Optional[dt.RadArray] = No
|
||||
active_indices = [i for i, active in enumerate(chain.active_links_mask) if active]
|
||||
|
||||
# Match 3 active joints to the 3 active link positions in the chain
|
||||
for idx, angle in zip(active_indices, initial_rad[leg_id]):
|
||||
seed_angles = np.asarray(initial_rad[leg_id], dtype=float)
|
||||
corrected_angles = []
|
||||
for idx, angle in zip(active_indices, seed_angles):
|
||||
bounds = chain.links[idx].bounds
|
||||
if bounds is not None:
|
||||
lower, upper = bounds
|
||||
if not np.isfinite(angle):
|
||||
angle = (lower + upper) / 2.0
|
||||
angle = float(np.clip(angle, lower, upper))
|
||||
corrected_angles.append(angle)
|
||||
full_initial_position[idx] = angle
|
||||
|
||||
if full_initial_position is not None:
|
||||
|
||||
Reference in New Issue
Block a user