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

validate multi-dof trajectories before execution #713

Merged
merged 2 commits into from
Jan 18, 2018

Conversation

rhaschke
Copy link
Contributor

@rhaschke rhaschke commented Dec 7, 2017

This is a follow up on #691, actually implementing the missing functionality.
@TroyCordie could you please test this patch on your setup?

@TroyCordie
Copy link
Contributor

I will give it a run early next week

@TroyCordie
Copy link
Contributor

sorry rhaschke I have check this and I thought I had replied.

{
// There is nothing to check
continue;
Copy link
Member

Choose a reason for hiding this comment

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

i prefer this style of breaking early (in this case with continue) rather than wrap all the functionality with increasing depths of indentation. why did you change it? it makes the PR harder to review

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having both, single-dof and multi-dof joint trajectories, we cannot simply break out anymore. We have to check for both trajectory types.

Copy link
Member

Choose a reason for hiding this comment

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

ack

const std::vector<geometry_msgs::Transform>& transforms =
trajectory.multi_dof_joint_trajectory.points.front().transforms;
const std::vector<std::string>& joint_names = trajectory.joint_trajectory.joint_names;
const std::size_t n = joint_names.size();
Copy link
Member

Choose a reason for hiding this comment

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

don't use one letter variable names - how about num_joints? I think it would actually be cleaner to use joint_names.size() throughout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was called n before... Using joint_names.size() is an extra function call each time.

Copy link
Member

@bmagyar bmagyar Jan 17, 2018

Choose a reason for hiding this comment

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

It happens often that when we add new features or fixes to MoveIt we ask the contributor or assigned maintainer to touch up that part of the code. I also think that there's no need to put the size value into a temporary variable.

Calling a function like this won't have any measurable overhead. After a quick look at the code I could only find 2 occurences of this n being used.

The same temporary variable trick is done 2 times in this function, make sure however you decide to address this you handle both.

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 handled both of them ;-)

ROS_ERROR_STREAM_NAMED("traj_execution", "Unknown joint in trajectory: " << joint_names[i]);
return false;
}

Copy link
Member

Choose a reason for hiding this comment

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

add comment to this section describing process being taken

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

if ((offset.array() > allowed_start_tolerance_).any() || rotation.angle() > allowed_start_tolerance_)
{
ROS_ERROR_STREAM_NAMED("traj_execution",
"\nInvalid Trajectory: start point deviates from current robot state more than "
Copy link
Member

Choose a reason for hiding this comment

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

clarify this error is coming from the new Multi DOF Traj checks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

return false;
}

for (std::size_t i = 0; i < n; ++i)
for (std::size_t i = 0, end = joint_names.size(); i < end; ++i)
Copy link
Member

Choose a reason for hiding this comment

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

Where is end defined? Is this some C++ magic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just right after i=0 in the for loop's init condition. No magic there ;-)

@davetcoleman davetcoleman merged commit ad44e15 into moveit:kinetic-devel Jan 18, 2018
@rhaschke rhaschke deleted the validate-multi-dof-traj branch January 24, 2018 07:37
JafarAbdi pushed a commit to JafarAbdi/moveit that referenced this pull request Mar 24, 2022
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

4 participants