Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to (dis)allow collisions with an object #50

Conversation

amalnanavati
Copy link
Contributor

Description

This PR extendes pymoveit2 to allow users to (dis)allow collisions between one object and all other objects. In practice, this is useful because a robot typically consists of many objects/links, so instead of specifying every object ID for a robot part that we want to (dis)allow collisions with, it is easier to just (dis)allow collisions with all objects, which includes the whole robot.

Testing

  • Launch the simulated panda arm: ros2 launch panda_moveit_config ex_fake_control.launch.py
  • Add a collision object to the planning scene: ros2 run pymoveit2 ex_collision_primitive.py --ros-args -p shape:="sphere" -p position:="[0.5, 0.0, 0.5]" -p dimensions:="[0.04]"
  • In RVIZ, move the robot arm to the collision object, and verify that it turns red (indicating a collision). Plan and verify it fails.
  • Allow collisions with that object: ros2 run pymoveit2 ex_allow_collisions.py --ros-args -p id:="sphere" -p allow:=true
  • In RVIZ, plan to the same arm configuration and verify it succeeds.
  • Disallow collisions with that object: ros2 run pymoveit2 ex_allow_collisions.py --ros-args -p id:="sphere" -p allow:=false
  • In RVIZ, verify that the colliding parts of the robot arm turned red again.

Notes / Future Work

  • Note that although (dis)allowing collisions is asynchronous, within the call it synchronously waits for the planning scene. This should be improved in the future to make it a fully asynchronous call (maybe pymoveit2 subscribes to the MoveGroup's published planning scene topic so it constantly maintains an upt-to-date planning scene?).
  • This PR (dis)allows collisions between one object and all other objects, which was sufficient for our use case. Extending this to more granularly (dis)allowing collisions between pairs of objects should be straightforward.

@amalnanavati amalnanavati changed the base branch from master to devel February 28, 2024 03:14
@amalnanavati amalnanavati mentioned this pull request Feb 28, 2024
Copy link
Owner

@AndrejOrsula AndrejOrsula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for this contribution!

It looks good to me, and this is indeed very useful! Just two minor comments.

PS: Sorry for taking a long time to look at this.


Note that although (dis)allowing collisions is asynchronous, within the call it synchronously waits for the planning scene. This should be improved in the future to make it a fully asynchronous call (maybe pymoveit2 subscribes to the MoveGroup's published planning scene topic so it constantly maintains an upt-to-date planning scene?).

I do not know much about the practicalities of the planning scene, but I think the current approach is fine and should be sufficient in most cases. Thank you!

examples/ex_allow_collisions.py Outdated Show resolved Hide resolved
pymoveit2/moveit2.py Outdated Show resolved Hide resolved
@AndrejOrsula AndrejOrsula merged commit 93ca9aa into AndrejOrsula:devel Mar 30, 2024
1 check passed
AndrejOrsula pushed a commit that referenced this pull request Mar 30, 2024
* Added functions to enable/disable collisions with an object vis the allowed collision matrix

* Clarified function name, reduced replicated code

* Made toggling collisions async

* Fix type annotations for consistency

* formatting

* Added tests

* Spelling

* Update docstring

* Fix unnecessary change
@amalnanavati amalnanavati deleted the amaln/allowed_collision_matrix branch April 23, 2024 17:13
AndrejOrsula pushed a commit that referenced this pull request May 10, 2024
* Added functions to enable/disable collisions with an object vis the allowed collision matrix

* Clarified function name, reduced replicated code

* Made toggling collisions async

* Fix type annotations for consistency

* formatting

* Added tests

* Spelling

* Update docstring

* Fix unnecessary change
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