I am trying to solve the IK for Atlas to achieve something like https://www.youtube.com/watch?v=LLGuGAs0cto. After a couple of failed attempts with AddPositionConstraint
, I realized that the IK problem fails even with no constraints at all (also fails with Strandbeest).
from pydrake.all import MultibodyPlant, FindResourceOrThrow, Parser, InverseKinematics, Solve
import numpy as np
plant = MultibodyPlant(0.001)
# filename = FindResourceOrThrow("drake/examples/multibody/strandbeest/Strandbeest.urdf")
filename = FindResourceOrThrow("drake/examples/atlas/urdf/atlas_minimal_contact.urdf")
Parser(plant).AddModelFromFile(filename)
plant.Finalize()
ik = InverseKinematics(plant=plant, with_joint_limits=False)
# epsilon = 1e-2
# r_foot_position = np.array([0.0, -0.08, 0.1])
# ik.AddPositionConstraint(
# frameB=plant.GetFrameByName("r_foot"),
# p_BQ=np.zeros(3),
# frameA=plant.world_frame(),
# p_AQ_upper=r_foot_position+epsilon,
# p_AQ_lower=r_foot_position-epsilon)
result = Solve(ik.prog())
print(f"Success? {result.is_success()}")
Is there something I'm missing? I would think a no constraint IK problem would be trivial