Closed ShaneRozenLevy closed 3 years ago
Thanks for submitting all of these issues! Feel free to file pull requests, if you prefer.
On this one, I'm not quite seeing the bug. Aren't the Jacobian's being initialized to the proper size? The use of static
is a (relatively minor) performance optimization to avoid extra memory allocation within those high-frequency methods.
I suspect there's an issue with how you're handling multiple modes, that could perhaps use better documentation or an error message. Each mode should be associated with it's own unique KinematicEvaluatorSet
. Are you modifying a KinematicEvaluatorSet
after using it?
The Jacobians do not seem to be initialized to the correct size. If for the double support phase the Jacobian has 6 rows it will still have 6 rows for the flight phase.
Here is an example script/branch that fails. I added printouts with the number of rows and constraints: https://github.com/KodlabPenn/dairlib/blob/issue_216_example/examples/PlanarWalker/run_jump_dircon.cc
Here is the same script, but I have applied my change (though with no printouts): https://github.com/KodlabPenn/dairlib/blob/biped_jump/examples/PlanarWalker/run_jump_dircon.cc
Thanks! I see the issue now, due to my own misunderstanding of how static
worked in this setting. PR incoming.
I'm currently running
dircon
on a multi mode sequence where the planar biped goes from a double support phase to a single flight phase. The code fails with error:what(): Failure at multibody/kinematic/kinematic_evaluator_set.cc:121 in EvalFullJacobian(): condition 'J->rows() == count_full()' failed.
In the
kinematic_evaluator_set
'sCalcTimeDerivativesWithForce
the Jacobian is initialized as static, thus when the number of constraints change from 4 to 0, the number of rows in the Jacobian doesn't change. As a result it fails when check inEvalFullJacobian
. A similar error happens indircon_opt_constraints.cc
'sDirconCollocationConstraint
.My proposed fix is to change line 98 of
dircon_opt_constrain.cc
todrake::MatrixX<T> J(evaluators_.count_full(), plant_.num_velocities());
and change line 229 ofkinematic_evaluator_set
toMatrixX<T> J(count_full(), plant_.num_velocities());
.