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

Handle unsupported position constraints in OMPL #2417

Merged

Conversation

henningkayser
Copy link
Member

OMPL constrained planning assumes that all position constraints have three dimensions, meaning that they are represented by a BOX bounding volume. If another shape is used (like a SPHERE from moveit_core/kinematic_constraints/utils.hpp), the constraint adapter implementation will produce a segfault because of the lack of dimensions. This fix prevents this by checking for the required BOX type.

OMPL constrained planning assumes that all position constraints have three
dimensions, meaning that they are represented by a BOX bounding volume.
If another shape is used (like a SPHERE from moveit_core/kinematic_constraints/utils.hpp),
the constraint adapter implementation will produce a segfault because of
the lack of dimensions. This fix prevents this by checking for the
required BOX type.
@henningkayser henningkayser self-assigned this Oct 10, 2023
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (a84e71a) 51.10% compared to head (5c6f611) 50.73%.
Report is 1 commits behind head on main.

Files Patch % Lines
...mpl/ompl_interface/src/detail/ompl_constraints.cpp 70.00% 6 Missing ⚠️
...pl/ompl_interface/src/planning_context_manager.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2417      +/-   ##
==========================================
- Coverage   51.10%   50.73%   -0.36%     
==========================================
  Files         387      386       -1     
  Lines       32262    32092     -170     
==========================================
- Hits        16483    16279     -204     
- Misses      15779    15813      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 380 to 381
const auto& primitives = constraints.position_constraints.at(0).constraint_region.primitives;
if (primitives.empty() || primitives.at(0).type != shape_msgs::msg::SolidPrimitive::BOX)
Copy link
Contributor

@sea-bass sea-bass Oct 10, 2023

Choose a reason for hiding this comment

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

Based on how the BoxConstraint and EqualityPositionConstraint parsing works, I think we maybe also want a warning if the number of primitives is greater than 1, saying that only the first primitive will be used?

@henningkayser henningkayser added backport-iron Mergify label that triggers a PR backport to Iron backport-humble Mergify label that triggers a PR backport to Humble labels Oct 24, 2023
Copy link

mergify bot commented Dec 13, 2023

This pull request is in conflict. Could you fix it @henningkayser?

@henningkayser henningkayser merged commit b0401e9 into moveit:main Dec 19, 2023
18 checks passed
mergify bot pushed a commit that referenced this pull request Dec 19, 2023
* Handle unsupported position constraints in OMPL

OMPL constrained planning assumes that all position constraints have three
dimensions, meaning that they are represented by a BOX bounding volume.
If another shape is used (like a SPHERE from moveit_core/kinematic_constraints/utils.hpp),
the constraint adapter implementation will produce a segfault because of
the lack of dimensions. This fix prevents this by checking for the
required BOX type.

* Add warning if more than one position primitive is used

---------

Co-authored-by: Sebastian Jahr <sebastian.jahr@picknik.ai>
(cherry picked from commit b0401e9)

# Conflicts:
#	moveit_planners/ompl/ompl_interface/src/detail/ompl_constraints.cpp
mergify bot pushed a commit that referenced this pull request Dec 19, 2023
* Handle unsupported position constraints in OMPL

OMPL constrained planning assumes that all position constraints have three
dimensions, meaning that they are represented by a BOX bounding volume.
If another shape is used (like a SPHERE from moveit_core/kinematic_constraints/utils.hpp),
the constraint adapter implementation will produce a segfault because of
the lack of dimensions. This fix prevents this by checking for the
required BOX type.

* Add warning if more than one position primitive is used

---------

Co-authored-by: Sebastian Jahr <sebastian.jahr@picknik.ai>
(cherry picked from commit b0401e9)

# Conflicts:
#	moveit_planners/ompl/ompl_interface/src/detail/ompl_constraints.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble Mergify label that triggers a PR backport to Humble backport-iron Mergify label that triggers a PR backport to Iron
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants