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

Documenting why setFromIK in computeCartesianPath does not use random restarts #1076

Merged
merged 2 commits into from
Oct 10, 2018
Merged

Documenting why setFromIK in computeCartesianPath does not use random restarts #1076

merged 2 commits into from
Oct 10, 2018

Conversation

mlautman
Copy link
Contributor

@mlautman mlautman commented Oct 4, 2018

Documenting why the setFromIK call in computeCartesianPath uses a single attempt rather than the default.

Description

Please explain the changes you made, including a reference to the related issue if applicable

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extended the tutorials / documentation, if necessary reference
  • Include a screenshot if changing a GUI
  • Created tests, which fail without this PR reference
  • Decide if this should be cherry-picked to other current ROS branches
  • While waiting for someone to review your request, please consider reviewing another open pull request to support the maintainers

@phy25
Copy link
Contributor

phy25 commented Oct 4, 2018

CI failed, requiring to fix clang format: https://travis-ci.org/ros-planning/moveit/jobs/436909712

@mlautman mlautman requested review from davetcoleman, rhaschke and v4hn and removed request for davetcoleman, rhaschke and v4hn October 4, 2018 19:39
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.

+1 for logging cleanup - after minor changes
-1 for computeCartesianPath()
Please split both PRs. They are not related.

@@ -1827,6 +1827,8 @@ as the new values that correspond to the group */
/** \brief This function is only called in debug mode */
bool checkCollisionTransforms() const;

static std::string name_;
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be superfluos. Either use RobotState::name_ or this static const name_ everywhere.
Personally, I would prefer the latter actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

name_ has to be static to be used by static methods like testJointSpaceJump and static member variables have to be initialized outside the class definition. I don't know of a cleaner way to do this. If you have a cleaner syntax please add your commit on top of mine.

https://stackoverflow.com/questions/1563897/c-static-constant-string-class-member

@@ -53,6 +53,7 @@ namespace core
* it is difficult to choose a jump_threshold parameter that effectively separates
* valid paths from paths with large joint space jumps. */
static const std::size_t MIN_STEPS_FOR_JUMP_THRESH = 10;
std::string RobotState::name_ = "robot_state";
Copy link
Contributor

Choose a reason for hiding this comment

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

If using this one (which I don't prefer), please use static const.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This refers to the same static member variable. An easy test to demonstrate this is to make one const and not the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have made it const

@@ -1925,7 +1925,7 @@ double RobotState::computeCartesianPath(const JointModelGroup* group, std::vecto
Eigen::Affine3d pose(start_quaternion.slerp(percentage, target_quaternion));
pose.translation() = percentage * rotated_target.translation() + (1 - percentage) * start_pose.translation();

if (setFromIK(group, pose, link->getName(), 1, 0.0, validCallback, options))
if (setFromIK(group, pose, link->getName(), 0, 0.0, validCallback, options))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think, a single attempt is used on purpose here: In a Cartesian path, it doesn't make sense to use a random seed for IK. This essentially enforces non-continuous joint-space motions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hrm, good point. I will drop this change, and add this as a comment.

@mlautman mlautman changed the title setFromIK in computeCartesianPath to use default attempts Documenting why setFromIK in computeCartesianPath does not use random restarts Oct 8, 2018
@mlautman
Copy link
Contributor Author

mlautman commented Oct 8, 2018

@rhaschke changes made

@@ -1919,6 +1919,9 @@ double RobotState::computeCartesianPath(const JointModelGroup* group, std::vecto
traj.clear();
traj.push_back(RobotStatePtr(new RobotState(*this)));

// For each waypoint we do not use random restarts since they would very likely result in IK jumps
std::size_t ik_attempts = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a benefit in introducing a new (constant!) variable here. This even more suggests that the number of IK attempts could be changed. I submitted an alternative comment.

@rhaschke rhaschke merged commit 98743e9 into moveit:kinetic-devel Oct 10, 2018
@davetcoleman davetcoleman deleted the cartesian-default branch October 13, 2018 22:38
pull bot pushed a commit to shadow-robot/moveit that referenced this pull request Sep 3, 2020
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