-
Notifications
You must be signed in to change notification settings - Fork 938
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
Fix subframes disappearing when object is detached/scaled/renamed #1866
Conversation
The tests on this PR succeed, only the code coverage is complaining. The tests for the functions affected by this should be implemented in #1757. |
ROS_WARN_NAMED(LOGNAME, "Object '%s' had subframes, but no new ones were given for Move operation. ", | ||
object.id.c_str()); | ||
} | ||
|
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 am not happy with the need to have the names vector transmitted here, but there's no way around that.
at least, it should be a normal use case of this to specify no subframes, even if the world object includes some.
On the other hand, moving shapes, typically also invalidates subframes and thus it makes sense to update the latter in the same call
I agree with @rhaschke, If the object contains subframes, they should be updated indeed.
76abf88
to
a9f8745
Compare
@@ -1822,12 +1807,32 @@ bool PlanningScene::processCollisionObjectMove(const moveit_msgs::CollisionObjec | |||
} | |||
|
|||
collision_detection::World::ObjectConstPtr obj = world_->getObject(object.id); | |||
|
|||
// Update subframe poses | |||
moveit::core::FixedTransformsMap subframe_poses = obj->subframe_poses_; |
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 whole code snipped on subframe updates is only relevant if a shape update is actually performed below.
Hence, I think this code should be moved into the if condition below and a warning should be issued if a user just tries to move subframes (but no shapes).
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.
The data structures actually allow to handle the additional use-case to specify only subframe poses and no shapes.
It's not really an important use-case (maybe for tcp online estimation?), but I think we could include it here?
Either way, the current patch need updating as it mixes both interpretations, doing the computations independent and then update them only if new shape poses exist...
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.
If you just want to update subframes, you better use APPEND mode.
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.
Yes, the MOVE operation shouldn't add anything to the object. I removed the whole if block and just updated the world object.
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 suggest to split this PR into two:
- fixing the subframe handling on planning scene updates
- displaying corresponding subframes in rviz
7cb409f
to
6957460
Compare
I split this as requested without any other changes for now. |
Codecov Report
@@ Coverage Diff @@
## master #1866 +/- ##
=======================================
Coverage 54.04% 54.04%
=======================================
Files 319 319
Lines 24997 25003 +6
=======================================
+ Hits 13509 13514 +5
- Misses 11488 11489 +1
Continue to review full report at Codecov.
|
@felixvd is (part of) this still unmerged? could you resolve the conflict? |
87e0c86
to
8e6222f
Compare
Codecov Report
@@ Coverage Diff @@
## master #1866 +/- ##
==========================================
- Coverage 57.79% 57.72% -0.07%
==========================================
Files 326 326
Lines 25615 25618 +3
==========================================
- Hits 14803 14787 -16
- Misses 10812 10831 +19
Continue to review full report at Codecov.
|
8e6222f
to
e53a900
Compare
e53a900
to
04ec95d
Compare
I updated and rebased this. The PR now only fixes the problem that subframes disappear when objects are detached objects from the robot, or scaled/renamed in Rviz. The changes to the MOVE operation will be in #2037 instead. |
Ping |
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.
Sorry, more feedback inline.
I should have reviewed properly before...
moveit_ros/visualization/motion_planning_rviz_plugin/src/motion_planning_frame_objects.cpp
Show resolved
Hide resolved
moveit_core/robot_state/include/moveit/robot_state/attached_body.h
Outdated
Show resolved
Hide resolved
} | ||
const moveit::core::AttachedBody* body = robot_state_->getAttachedBody(object.object.id); | ||
if (body) | ||
attached_bodies.push_back(body); |
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.
Could you please check for whether the id is actually attached to object.link_name
and trigger a warning if that's not the case?
The previous version would simply ignore the object if a wrong link is specified, but a warning is of course preferred. :)
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.
Sure, seems like a rare error though. Please have a look and confirm that this is what you meant.
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.
The condition is good, but I would say we either treat it as a proper error the user has to fix before they can continue (so the method should return), or we specify in the warning that the object attached to the other link is used instead.
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 don't know which way will be better, but I chose to make it an error and fixed the condition (it would have fired for the default value otherwise).
- remove code duplication, when fetching attached bodies - simplify function calls when detaching (attached) bodies
d96c493
to
880046f
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 added some minor adjustments and rebased to resolve the merge conflict.
Please have a final look @felixvd .
Thanks as always 😎
I approve as long as CI succeeds now.
Perfect, thanks for the review :) |
Not really. I just had to fix one misuse of The second review might take some time because Robert is on vacation. |
I see. I figured it would also concatenate. The more you know |
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 tested this and it works for me. One tiny thing I found. I might just be misreading what you are trying to do there.
Description
Subframes were being forgotten when objects were detached/removed from the robot, and when they were moved. They also would have overwritten the old subframes during an APPEND call. This PR should fix all of that, and adds a line to the Rviz plugin that says "The object has subframes X, Y, Z."
Subframes are not updated if the object is moved from the Rviz plugin. I am filing another PR about this in a minute.
Checklist