Movement smoothing

This commit is contained in:
2026-10-24 21:56:29 +02:00
parent a649865643
commit 7e2c6d86ac
3 changed files with 54 additions and 10 deletions
+10 -1
View File
@@ -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: