Skip to content

rework PipelinePlanner creation#249

Merged
rhaschke merged 4 commits intomoveit:masterfrom
v4hn:pr-master-fix-pipeline-planner-creation
Mar 29, 2021
Merged

rework PipelinePlanner creation#249
rhaschke merged 4 commits intomoveit:masterfrom
v4hn:pr-master-fix-pipeline-planner-creation

Conversation

@v4hn
Copy link
Copy Markdown
Contributor

@v4hn v4hn commented Mar 26, 2021

moveit/moveit#2127 merged support
for multiple planner plugins. As a result, the planner specification
should include a pipeline name from now on.

Support the new schema and provide a fallback for older configurations.

While doing so, I moved the create methods to the class they actually belong to
and introduced a clean options parameter

This change is somewhat urgent because the pickplace demo is broken since moveit/2127 was merged.

planning_pipeline::PlanningPipelinePtr PipelinePlanner::create(const PipelinePlanner::Specification& spec) {
static PlannerCache cache;

constexpr char PLUGIN_PARAMETER_NAME[]{ "planning_plugin" };
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I dropped support for custom plugin parameter names on purpose because the new parameter scheme is a much cleaner replacement for non-standard parameter names.

I'm ok with leaving the parameter configurable as well or hard-code the adapter_param.
I believe there might be sufficient use for a configurable adapter parameter though.

moveit/moveit#2127 merged support
for multiple planner plugins. As a result, the planner specification
should include a pipeline name from now on.

Support the new schema and provide a fallback for older configurations.

While doing so, I moved the create methods to the class they actually belong to
and introduced a clean options parameter
@v4hn v4hn force-pushed the pr-master-fix-pipeline-planner-creation branch from 2b27914 to a28cb88 Compare March 26, 2021 19:48
@v4hn
Copy link
Copy Markdown
Contributor Author

v4hn commented Mar 26, 2021

Errors     << moveit_task_constructor_core
In member function ‘virtual void moveit::task_constructor::solvers::PipelinePlanner::init(const RobotModelConstPtr&)’:
sorry, unimplemented: non-trivial designated initializers not supported
   planner_ = create(Specification{ .model = robot_model, .pipeline = pipeline_name_ });

Wow, feels like we are back in the old days...
Turns out this is actually a C++20 feature that's active by default in both current g++ and clang++ 😮

I pushed a patch without the language feature...

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2021

Codecov Report

Merging #249 (0685a3c) into master (4ee7188) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

❗ Current head 0685a3c differs from pull request most recent head 24ae96e. Consider uploading reports for the commit 24ae96e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #249      +/-   ##
==========================================
- Coverage   34.26%   34.22%   -0.04%     
==========================================
  Files          93       93              
  Lines        5596     5603       +7     
==========================================
  Hits         1917     1917              
- Misses       3679     3686       +7     
Impacted Files Coverage Δ
...moveit/task_constructor/solvers/pipeline_planner.h 0.00% <0.00%> (ø)
core/include/moveit/task_constructor/task.h 33.34% <ø> (ø)
core/src/solvers/pipeline_planner.cpp 0.00% <0.00%> (ø)
core/src/task.cpp 66.91% <ø> (+7.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ee7188...24ae96e. Read the comment docs.

Sorry, I'm not a fan of the brace initializers.
They can be confused easily with initializer lists.
Copy link
Copy Markdown
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 pushed two more commits:

  • I think we can directly remove Task::createPlanner (and not only deprecate it)
  • I'm not a fan of brace initializers.

};

static planning_pipeline::PlanningPipelinePtr create(const moveit::core::RobotModelConstPtr& model) {
return create(Specification{ .model = model });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't this line using the C++20 feature as well? (#249 (comment))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes and no. It's the same feature, but apparently the version of gcc in CI does implicitly support it as long as all initialized members are in order, even if some in the end are not specified. The other use skipped some members and triggered the "sorry unimplemented" error.

I rewrote it here as well.

It's a shame, this is so much less readable...
@v4hn
Copy link
Copy Markdown
Contributor Author

v4hn commented Mar 29, 2021

I'm not a fan of the brace initializers. They can be confused easily with initializer lists.

I do prefer and use uniform initialization a lot these days and I do think they solve actual problems in the language.
With your line of argumentation A a = <foo>; can be (and often is) misunderstood as invoking operator=(), when it's really invoking A(<foo>). If code uses initializer_list, you have to be very aware of the constructor anyway because they likely take priority over all other constructors anyway.

I'll not touch it again because you went through the trouble of changing it, but I do prefer to avoid printf-style and non-uniform initializers.

That aside, this should be good to merge now.

@rhaschke rhaschke merged commit 36d9d3e into moveit:master Mar 29, 2021
@v4hn v4hn deleted the pr-master-fix-pipeline-planner-creation branch March 29, 2021 11:41
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