Skip to content

enforce joint bounds for start state validation - #290

Merged
rhaschke merged 2 commits into
indigo-develfrom
pr-indigo-enforced-bounds-in-validation
Oct 18, 2016
Merged

rhaschke merged 2 commits into
indigo-develfrom
pr-indigo-enforced-bounds-in-validation

Conversation

@v4hn

@v4hn v4hn commented Oct 17, 2016 •

Copy link
Copy Markdown
Contributor

Without this, unlimited joints might get out of the bounds
in the trajectory and will fail the validation.

This resolves #283. In theory this deprecates #287 .
Feel free to improve the request, I pushed the request-branch to this repo.

The patch has been verified on our PR2.

Should be picked to j/k

@davetcoleman davetcoleman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall makes sense, thanks for implementing this!

ROS_WARN_NAMED("traj_execution", "Failed to validate trajectory: couldn't receive full current joint state within 1s");
return false;
}
current_state->enforceBounds();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a comment why this is necessary? Shouldn't the current state already be within bounds?

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'm not sure actually. If this is guaranteed I'm happy to remove that line.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I followed this call down to RevoluteJointModel::enforcePositionBounds() - so the comment should clarify that it isn't just enforcing bounds but also normalizing continuous joints

current_state->enforceBounds();

// build a RobotState that can be used to compare current_state and start_state with enforced bounds
robot_state::RobotState start_state(*current_state);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rename to something like bounded_start_state to make more clear

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.

done

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why remove this check?

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.

because the call to start_state.setVariablePositions above already ensures that the joint exists.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

ROS_ERROR_STREAM_NAMED("traj_execution", "Unknown joint in trajectory: " << joint_names[i]);
return false;
}
const robot_model::JointModel *jm_start= start_state.getJointModel(joint_names[i]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

spacing before =

@v4hn
v4hn force-pushed the pr-indigo-enforced-bounds-in-validation branch from ccf9adc to b05caa7 Compare October 17, 2016 16:39
@v4hn

v4hn commented Oct 17, 2016

Copy link
Copy Markdown
Contributor Author

@davetcoleman I addressed the feedback.
I suppose @rhaschke should review this request.

@davetcoleman davetcoleman mentioned this pull request Oct 17, 2016
19 tasks done
ROS_WARN_NAMED("traj_execution", "Failed to validate trajectory: couldn't receive full current joint state within 1s");
return false;
}
current_state->enforceBounds();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I followed this call down to RevoluteJointModel::enforcePositionBounds() - so the comment should clarify that it isn't just enforcing bounds but also normalizing continuous joints

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1


try
{
bounded_start_state.setVariablePositions(joint_names, positions);

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.

This will not work as soon as the trajectory is split into parts because several controllers will be used for different subsets of joints. I will suggest an alternative.

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.

that's what the for-loop around this is for...
I don't see any mistake here.

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.

Sorry. I missed yesterday, that the list of joint_names is provided too. I was thinking that all variable positions would be tried to be assigned at once.

@rhaschke

Copy link
Copy Markdown
Contributor

I reworked this PR. @v4hn, please could you give it another try on a real robot with a continuous joint?
How can we extend this unit test? Does anybody mind to change the fanuc urdf to contain a continuous joint?

@rhaschke

Copy link
Copy Markdown
Contributor

I rebased this PR for Kinetic: #292.

@davetcoleman

Copy link
Copy Markdown
Member

Does anybody mind to change the fanuc urdf to contain a continuous joint?

Seems like a unit test with the PR2 would make more sense

@rhaschke

Copy link
Copy Markdown
Contributor

Seems like a unit test with the PR2 would make more sense

Do we have a moveit_config for PR2 somewhere?

@v4hn v4hn left a 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, this resolves the problem too.
I did not notice the JointModel can enforce bounds on external values.

If we ever implement the more sophisticated noise handling for individual joints, I think I would still prefer my approach, but yours is faster for sure. :)

It seems I cannot approve my own pull-request, but I approve this anyway.

This should be merged into indigo-devel and kinetic-devel before tomorrow!

@v4hn

v4hn commented Oct 18, 2016

Copy link
Copy Markdown
Contributor Author

I would propose to deal with the unit test after the release.

@davetcoleman

Copy link
Copy Markdown
Member

v4hn and others added 2 commits October 18, 2016 19:45
Without this, unlimited joints might get out of the bounds
in the trajectory and will fail the validation.
@rhaschke
rhaschke force-pushed the pr-indigo-enforced-bounds-in-validation branch from df00b48 to c8afab7 Compare October 18, 2016 17:48
@rhaschke
rhaschke merged commit da2b7a2 into indigo-devel Oct 18, 2016
@rhaschke
rhaschke deleted the pr-indigo-enforced-bounds-in-validation branch October 18, 2016 17:50
@davetcoleman

Copy link
Copy Markdown
Member

I still do not believe this deprecates #287

rhaschke added a commit that referenced this pull request Oct 18, 2016
enforce joint bounds+normalization in start state validation
this is a cherry-pick of #290 from Indigo
@rhaschke

Copy link
Copy Markdown
Contributor

Cherry picked into Jade (64ecbda) and Kinetic (#292).

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.

3 participants