underactuated icon indicating copy to clipboard operation
underactuated copied to clipboard

Update compass gait exercise to be compatible with GetInfeasibleConstraints

Open TobiaMarcucci opened this issue 5 years ago • 0 comments

In the exercise the compass gait MultibodyPlant is translated ToAutoDiffXd in order to use the MultibodyPlant methods to build constraints for an optimization. This however makes GetInfeasibleConstraints fail because MultibodyPlant computations always returns AutoDiffXd, even when you pass them floats.

The solution is to either:

  • Keep two copies of the plant around. The original compass_gait and the compass_gait_autodiff = compass_gait.ToAutoDiffXd(), and use the correct one based on whether isInstance(vars[0], AutoDiffXd).
  • Use return autodiffToValueMatrix(...) for the non-autodiff case.

See also piazza post 285.

TobiaMarcucci avatar May 06 '20 01:05 TobiaMarcucci