Skip to content

dircon segfault adding post impact velocity constrain when no impact #218

@ShaneRozenLevy

Description

@ShaneRozenLevy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions