Repository navigation
clang-tidy and C++11 modernization of moveit_planners_ompl - #990
Conversation
davetcoleman
left a comment
There was a problem hiding this comment.
Sorry for the delay. Now we need a second reviewer
|
@BryceStevenWilley can you review this? |
|
Sure, I'll try to have it done by tomorrow. |
| { | ||
| for (std::map<std::string, ConstraintApproximationPtr>::const_iterator it = constraint_approximations_.begin(); | ||
| it != constraint_approximations_.end(); ++it) | ||
| for (const auto& constraint_approximation : constraint_approximations_) |
There was a problem hiding this comment.
Avoid auto in cases like this, just use std::map<std::string, ConstraintApproximationPtr>. See #880 (comment) for previous discussion.
| return ompl::base::SpaceInformationPtr(); | ||
| for (std::size_t i = 0; i < goals.size(); ++i) | ||
| if (!goals[i]->hasType(ompl::base::GOAL_SAMPLEABLE_REGION)) | ||
| for (const auto& goal : goals) |
There was a problem hiding this comment.
Same comment as above: avoid auto in for loops.
| planning_context_->getPlanningScene()->checkCollision( | ||
| verbose ? collision_request_simple_verbose_ : collision_request_simple_, res, *kstate); | ||
| return res.collision == false; | ||
| return !res.collision; |
There was a problem hiding this comment.
Is this clang-tidy or you? If it's not clang-tidy, personally I still think == false is more readable. Up for debate though.
There was a problem hiding this comment.
This is clang-tidy. It likes to simplify boolean logic where it can. See https://clang.llvm.org/extra/clang-tidy/checks/readability-simplify-boolean-expr.html
| } | ||
|
|
||
| for (std::size_t j = 0; j < config_names.size(); ++j) | ||
| for (auto j = 0; j < config_names.size(); ++j) |
There was a problem hiding this comment.
Might want to run clang-tidy again, I don't think it converts nested for loops, this one looks like it should be converted.
| unsigned int d = 0; | ||
| for (std::size_t i = 0; i < joint_model_vector_.size(); ++i) | ||
| d += joint_model_vector_[i]->getStateSpaceDimension(); | ||
| for (auto i : joint_model_vector_) |
There was a problem hiding this comment.
Change this name, clang-tidy chooses very poorly sometimes.
| { | ||
| for (std::size_t i = 0; i < cc->second.size(); ++i) | ||
| if (cc->second[i].unique()) | ||
| for (const auto& i : cc->second) |
There was a problem hiding this comment.
Same as above: choose a better name.
|
LGTM. |
|
Thanks! Looking forward to next PR in this series |
Description
This PR is the first chunk in part of a broader effort to merge #897 into MoveIt! by splitting the contribution across multiple PRs in coordination with @davetcoleman.
For this PR,
clang-tidywas run using the configuration in.clang-tidyand boost constructs (particularly function, bind, thread, and mutex) have been replaced by their counterparts in C++11.Checklist
Extended the tutorials / documentation, if necessary referenceInclude a screenshot if changing a GUIOptional: Created tests, which fail without this PR referenceOptional: Decide if this should be cherry-picked to other current ROS branches (Indigo, Jade, Kinetic)