moveit / srdfdom

Semantic Robot Description Format
BSD 3-Clause "New" or "Revised" License
13 stars 68 forks source link

Add an "SRDF Linter" script. For now, it focuses on disabled collisions #112

Open AndyZe opened 1 year ago

AndyZe commented 1 year ago

I wrote this script for a project that has a very long list of "disabled collisions" which have been manually added over time. It would have been very difficult to go through manually to find the duplicates and sort them properly. So, here's a simple linter.

I don't intend to put a ton of time into improving this script, so I won't be surprised if it doesn't get approved and the issue sits open. I think it would still be a valuable resource to some people.

The script:

The output looks like this:

This script will clean up issues and make suggestions for an SRDF.

Original list of disabled collision pairs:

[['ground', 'seg_0_bed', 'Adjacent'], ['ground', 'seg_0_base_link', 'Adjacent'], ...

Removing duplicate entries from the list of allowed collisions
Originally there were 141 entries in the Allowed Collision Matrix.
These entries are duplicated. Removing them:
seg_0_eef seg_0_shoulder_link_1
Now there are 140 entries in the Allowed Collision Matrix.
Checking if there are any duplicates when the order is reversed, e.g. (l1,l2) vs (l2,l1)
These entries are duplicated. Removing them:
Now there are 140 entries in the Allowed Collision Matrix.

Sorting the list of allowed collisions

Output. Please copy/paste this into the SRDF:

<disable_collisions link1="ground" link2="seg_0_base_link" reason="Adjacent"/>
<disable_collisions link1="ground" link2="seg_0_bed" reason="Adjacent"/>
...