Open ShaneRozenLevy opened 3 years ago
Haven't looked too deeply yet, but I think it's possible that the auto
keyword is responsible.
Declaring pre_impact_velocity
as auto
makes it type Eigen::Block
and declaring it as a VectorXDecisionVariable
makes it type Eigen::PlainObjectBase
. The Eigen::Block
declaration seems to cause issues in the drake symbolic formula.
Yes--coming to the same conclusion here as well. I'll open a quick PR.
I recently encountered a very strange bug in
dircon.cc
. When adding the impact constraint when their is not impact (pre_impact_velocity == post_impact_velocity) the code will segfault (Line 252). This does not seem to happen for every robot (planar walker is fine), but it does effect both Spirit and Cassie.I found that changing line 249/250 from:
auto pre_impact_velocity = state_vars(i_mode - 1, pre_impact_index) .tail(plant_.num_velocities());
to:auto pre_impact_state = state_vars(i_mode - 1, pre_impact_index);
auto pre_impact_velocity = pre_impact_state.tail(plant_.num_velocities());
Fixes the issue. I don't understand why this fixes the issue because at a glance the code should do the same thing.
Here is a branch where
examples/Spirit:run_spirit_jump
fails due to this bug: https://github.com/KodlabPenn/dairlib/tree/dircon_segfault_post_impact_vel_demo