Skip to content

Commit

Permalink
Update example to velocity smoothing, detail how
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-caron committed Jul 29, 2024
1 parent feeeb63 commit 40aa60f
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
)
acceleration_limit = AccelerationLimit(
robot.model,
np.full(robot.model.nv, 1e4),
np.full(
robot.model.nv,
20.0, # [rad] / [s]^2
),
)

# Initial configuration and task setup
Expand Down Expand Up @@ -91,20 +94,28 @@
).np
)

# Compute velocity and integrate it into next configuration
if step < nb_steps // 2:
# First half: no velocity smoothing
end_effector_task.gain = 1.0
tasks = (end_effector_task, posture_task)
limits = (
configuration.model.configuration_limit,
configuration.model.velocity_limit,
)
else: # step >= nb_steps // 2
# Second half: velocity smoothing by:
# 1. Reducing the task gain
# 2. Switching from a posture to a damping task
# 3. Adding an acceleration limit
end_effector_task.gain = 0.4
tasks = (end_effector_task, damping_task)
limits = (
configuration.model.configuration_limit,
configuration.model.velocity_limit,
acceleration_limit,
)

# Compute velocity and integrate it into next configuration
velocity = solve_ik(
configuration, tasks, dt, solver=solver, limits=limits
)
Expand Down

0 comments on commit 40aa60f

Please sign in to comment.