Skip to content

fix(ocp): use geometry names in ocp_traj_tracking_collision_avoidance.yaml - #355

Open
MaximilienNaveau wants to merge 3 commits into
agimus-project:mainfrom
MaximilienNaveau:fix/yaml-collision-pair-names
Open

MaximilienNaveau wants to merge 3 commits into
agimus-project:mainfrom
MaximilienNaveau:fix/yaml-collision-pair-names

Conversation

@MaximilienNaveau

Copy link
Copy Markdown
Collaborator

Problem: agimus_controller/agimus_controller/ocp/ocp_traj_tracking_collision_avoidance.yaml:47,56,95 gives the collision residuals collision_pair_id: 0. Since 4bc8c72 ("Fix issues in OCPCrocoGeneric"), ResidualDistanceCollisionBase (ocp_croco_generic.py:502) takes collision_pair, a pair of geometry names, and has no collision_pair_id field. So the example cannot be loaded at all.

Reproduction:

ShootingProblem(**yaml.safe_load(open(".../ocp_traj_tracking_collision_avoidance.yaml")))
# TypeError: ResidualDistanceCollision.__init__() got an unexpected keyword argument 'collision_pair_id'. Did you mean 'collision_pair'?

Fix: replace collision_pair_id: 0 with collision_pair: [fer_link7_sc_capsule_0, obstacle1_capsule_0] in the two costs and the constraint. Debatable: the old index did not name a robot, so the names are my choice. They are the FER link 7 capsule from agimus_franka_description (as in the pick-and-place example config) and the obstacle from tests/resources/environment.xacro. Tell me if another pair suits the example better.

Test: test_load_traj_tracking_collision_avoidance_yaml loads the file into ShootingProblem and checks that the constraint residual is a ResidualDistanceCollision with a two-name pair. It fails on main and passes with the fix. Building the models needs a collision model with these geometry names. agimus_franka_description and xacro are not available in my test environment, so I checked the build with a small script instead: on pinocchio.buildSampleModelManipulator() with two geometries renamed to these names, the running and terminal models build and calc runs.

Found while auditing the Python code for the C++ port (#334), finding B6.

@MaximilienNaveau
MaximilienNaveau marked this pull request as ready for review November 27, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants