-
Notifications
You must be signed in to change notification settings - Fork 953
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
Tranform Pilz goal pose and center point wrt. the planning frame #3522
Tranform Pilz goal pose and center point wrt. the planning frame #3522
Conversation
The current unit test uses the prbt robot from moveit_resources. To demonstrate some of my fixes, I need one more fixed link between the robot base and the prbt_link_1 that is different then the identity matrix. I can't seem to add/modify links programatically with the robot model. Should I add an alternate prbt_macro.xacro with another link in the moveit_resources ? |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3522 +/- ##
==========================================
+ Coverage 61.84% 61.87% +0.03%
==========================================
Files 385 385
Lines 34091 34107 +16
==========================================
+ Hits 21079 21099 +20
+ Misses 13012 13008 -4
☔ View full report in Codecov by Sentry. |
4a22b71
to
2ef65b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. As you rely on #3519, could you please rebase onto that PR and further minimize the change set? There are a lot of code shifts, which distract from the actual contribution.
The frame_id must be rigidly connected to the root link. There is no sense to use a frame that is not yet known for a goal pose constraint.
I don't agree with this. Of course, the frame needs to be known, but it could be any known frame. For example, why shouldn't it be possible to specify the circular motion w.r.t. the current end-effector pose? Surely, this needs to be transformed into planning frame.
I need one more fixed link between the robot base and the prbt_link_1. But I can't seem to add links programatically with the robot model.
What about adding a sub frame instead and using that one as frame_id?
I changed the status of that PR to draft as this is obviously still work-in-progress.
assert(req.start_state.joint_state.name.size() == req.start_state.joint_state.position.size()); | ||
for (const auto& joint_name : robot_model_->getJointModelGroup(req.group_name)->getActiveJointModelNames()) | ||
{ | ||
auto it{ std::find(req.start_state.joint_state.name.cbegin(), req.start_state.joint_state.name.cend(), joint_name) }; | ||
if (it == req.start_state.joint_state.name.cend()) | ||
{ | ||
std::ostringstream os; | ||
os << "Could not find joint \"" << joint_name << "\" of group \"" << req.group_name | ||
<< "\" in start state of request"; | ||
throw CircJointMissingInStartState(os.str()); | ||
} | ||
size_t index = it - req.start_state.joint_state.name.cbegin(); | ||
info.start_joint_position[joint_name] = req.start_state.joint_state.position[index]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block was removed in #3519. To which extend do you still need that?
const auto link = robot_model_->getLinkModel(frame_id); | ||
if (link) | ||
{ | ||
// check if robot link is rigidly connected to the root link | ||
const auto parent_link = robot_model_->getRigidlyConnectedParentLinkModel(link); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which allows to combine these two cases.
Will rebase and minimize the changes.
You are right. We should allow every frame_id (robot link, collision object/subframes) that is:
Can someone plan something with a pure position constraint, e.g. the orientation could change, or is the orientation set to identity when missing ?
This would work, but there would be one test missing that checks explicitly if the frame is a link. Maybe I can simplify these checks. Nonetheless I will start testing with sub-frames. |
There is no need to constrain to frames that are (rigidly) connected to the root link.
Sure. Orientation of the eef is arbitrary in that case.
There is no need to test that explicitly. The planning code doesn't differ if the frame_id refers to a link or a sub frame. |
You were probably asking that question in the context of the Pilz planner. To be honest, there I don't know. |
We can also just transform the goal pose wrt. the planning frame, without checking if the frame is valid (known in advanced). It would be up to the user to enter a valid frame_id. |
I still don't get why you want to constrain possible frame_id's. The frame_id just defines the frame w.r.t. which the start, end, and center point of a CIRC motion are interpreted. As long as the frame is known (and somehow linked to the robot's TF tree), we can use the current pose of that frame to transform those points into the planning frame. From there on, the CIRC path in space is fixed and well-defined w.r.t. the planning frame. |
Sorry, I wrongfully though that we had to use the goal pose state for the goal pose constraint (which some frames are not known in advance) instead of the current pose which are known in advance. |
2ef65b5
to
5d5a81b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged #3519. Could you please rebase on master again?
I shortly looked into your changes as well. As far as I understand, the main culprit is that the start pose is computed w.r.t. the robot's model frame (via FK) while the goal pose, computed via getConstraintPose()
, is local w.r.t. to frame_id
(which often/in the tests? coincides with the former).
It would be great, if you could add tests. Specifying the goal pose w.rt. to any frame != model frame should reveal the issue.
5d5a81b
to
8dbcc82
Compare
Rebased. Exactly, the tests use the planning frame as the frame_id. Will add tests tomorrow or this weekend. |
Had a hard time finding that the The test code for computing CIRC center point has the same problem, it does not transform the pose wrt. the frame_id. Can I use the same code (fixed in 846f611) to compute the center point in the test or should I use a different method ? Obviously, if there is an error, the test will not be able to catch it. Just have to fix one final error with my new test: EDIT Confirmed, at least there was a TODO in the testutils ! |
I think it is fine using the same approach. Your main issue was that start and goal were computed w.r.t. different frames and this will be catched, right? |
@captain-yoshi, although I merged this PR already, please don't hesitate to add your unit tests. |
Description
Should fix #3035 (partially) and moveit/moveit_task_constructor/issues/411 by transforming the goal pose (CIRC, LIN and PTP) and the center point (CIRC) wrt. the planning frame.
Only computes the IK when there is a goal pose constraint. Removed unused
frame_id
initialisation. Transforms the goal pose forCIRC
,LIN
andPTP
wrt. the planning frame. Transform the center point forCIRC
wrt. the planning frame.Rebased on #3519.
TODO
Checklist
This post has been edited prior discussion with the maintainers