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

tool to generate constraint approximation databases #1253

Merged
merged 4 commits into from
Dec 21, 2018

Conversation

v4hn
Copy link
Contributor

@v4hn v4hn commented Dec 10, 2018

This feature was on my todo list for quite some time now.
MoveIt provides some C++ demo code to generate constraint approximations.
These can be used for constraint path planning.
The demo is all hard-coded though and users had to copy&paste the code for their own use case.

This pull-request provides a way to describe constraints on the parameter server and applies the feature to configure a generic tool to generate the databases.

I'm open to change & move parts of this code if someone has a better proposal for where things should go.

Please look at the individual commits for more details.

The flags are never checked anyway below, so it does not build
without OpenMP at the moment.
@v4hn v4hn requested a review from mlautman December 10, 2018 15:03
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

I like this. Some minor comments. Is there a tutorial that should be updated?

moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
@v4hn
Copy link
Contributor Author

v4hn commented Dec 12, 2018

I plan to extend the constraint manifold tutorial once I got an approval on the current design.

I'm not sure where to document the structure for the constructConstraints function best, or whether it needs to be documented explicitly when the manifold-tutorial gives examples already.
Maybe it makes sense to add a link in the function's doxygen documentation?

Thanks for the feedback, I will address it later this week.

@v4hn
Copy link
Contributor Author

v4hn commented Dec 16, 2018

@rhaschke @mlautman I addressed all feedback. Please have another look.

@mlautman Personally, I prefer in-place nh.param calls over parameter structs in such small programs, but I switched to a struct here.

Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

Factoring out the parsing functions already improved readability a lot.
Please re-consider the remaining comment.

moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
moveit_core/kinematic_constraints/src/utils.cpp Outdated Show resolved Hide resolved
@rhaschke
Copy link
Contributor

@v4hn Do you want to squash the cleanup commits into the first 4 commits?

@v4hn
Copy link
Contributor Author

v4hn commented Dec 21, 2018

I will clean up the commit history and merge.

In some situations, it makes sense to define Constraints
via ros parameters to ease configuration or circumvent
repeated definitions.

A constraint can constructed from ROS parameters with the following
structure:

path_constraint:
  name: tool0_upright
  constraints:
  - type: orientation
    frame_id: world
    link_name: tool0
    orientation: [0, 0, 0]
    tolerances: [0.01, 0.01, 3.15]
    weight: 1.0
  - type: joint
    joint_name: pan_joint
    position: 0.0
    tolerance: 1.0
    weight: 1.0
  - type: position
    frame_id: world
    link_name: tool0
    target_offset: [.5,0,1.0]
    region:
      x: [0,2]
      y: [-2,2]
      z: [.5,2.5]
Previously, we only shipped a demo_construct_state_database.cpp
that hard-coded all parameters for a specific setup.

This work generalizes the code and provides a utility that
can be configured via ROS parameters.

Assuming a MoveIt configuration is running,
an example launch file to use the utility might look like this:

<launch>
  <node name="generate_state_database" pkg="moveit_planners_ompl" type="generate_state_database" output="screen">
    <param name="use_current_scene" value="false"/>
    <param name="planning_group" value="arm"/>
    <remap from="~output_folder" to="move_group/constraint_approximations_path"/>

<rosparam ns="constraints">
path_constraint:
  name: tool0_upright
  constraints:
  - type: orientation
    frame_id: world
    link_name: tool0
    orientation: [0, 0, 0]
    tolerances: [0.01, 0.01, 3.15]
    weight: 1.0
</rosparam>

  </node>
</launch>
@v4hn v4hn force-pushed the pr-kinetic-generate-state-db branch from d59e151 to b08abe1 Compare December 21, 2018 16:19
@v4hn v4hn merged commit b08abe1 into moveit:kinetic-devel Dec 21, 2018
@v4hn
Copy link
Contributor Author

v4hn commented Dec 21, 2018

merged I'll try to get around to add the tutorial soon.

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.

None yet

3 participants