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

getFrameInfo(): avoid double search for link name #1853

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

rhaschke
Copy link
Contributor

hasLinkModel() and getLinkModel() both search for the link name...

Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

Thanks! I originally wrote the offending line like this because I wasn't sure if the pointer in getLinkModel is reliably null and would evaluate to false if the link doesn't exist.

This looks good to me except that the frame_found parameter should not be deleted, as it is used outside of the function.

BOOST_VERIFY(checkLinkTransforms());
frame_found = true;
Copy link
Contributor

@felixvd felixvd Jan 23, 2020

Choose a reason for hiding this comment

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

This boolean is used outside of the function and shouldn't be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both, robot_link and frame_found are set in the above call to getLinkModel.

Copy link
Contributor

Choose a reason for hiding this comment

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

I overlooked it, my bad. Good call.

@@ -1019,11 +1019,9 @@ const Eigen::Isometry3d& RobotState::getFrameInfo(const std::string& frame_id, c
frame_found = true;
return IDENTITY_TRANSFORM;
}
if (robot_model_->hasLinkModel(frame_id))
if ((robot_link = robot_model_->getLinkModel(frame_id, &frame_found)))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove the outermost bracket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The extra pair of brackets is required to interpret the assignment result as a boolean (and silent compiler warnings, because this might be wrongly typed == comparison as well.)

Copy link
Contributor

@felixvd felixvd Jan 23, 2020

Choose a reason for hiding this comment

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

Interesting. Thanks!

BOOST_VERIFY(checkLinkTransforms());
frame_found = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I overlooked it, my bad. Good call.

@@ -1019,11 +1019,9 @@ const Eigen::Isometry3d& RobotState::getFrameInfo(const std::string& frame_id, c
frame_found = true;
return IDENTITY_TRANSFORM;
}
if (robot_model_->hasLinkModel(frame_id))
if ((robot_link = robot_model_->getLinkModel(frame_id, &frame_found)))
Copy link
Contributor

@felixvd felixvd Jan 23, 2020

Choose a reason for hiding this comment

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

Interesting. Thanks!

@rhaschke rhaschke merged commit d7b05fa into moveit:master Jan 23, 2020
@rhaschke rhaschke deleted the simplify-getFrameInfo branch January 23, 2020 10:39
sjahr pushed a commit to sjahr/moveit that referenced this pull request Jun 21, 2024
* Revert moveit#1739: moveit_msgs no longer needs to be built from source
  This reverts commit 6e0fce3.
* Remove obsolete include: moveit_msgs/srv/execute_known_trajectory.hpp
* Cleanup moveit2.repos
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

2 participants