Repository navigation
Update links in union constraint sampler and fix unit test. - #186
Conversation
|
|
||
| for (std::size_t i = 1 ; i < samplers_.size() ; ++i) | ||
| { | ||
| //ConstraintSampler::sample returns states with dirty link transforms (because it only writes values) |
There was a problem hiding this comment.
should be indent of 2, not 4
|
This makes sense to me at a high level, but i do not have time to look into the surrounding code |
|
Hey @scottpaulin, that sounds like a pain to debug. Thanks for doing that! :) +1 after cleaning up the tabs. |
| { | ||
| EXPECT_TRUE(ucs.sample(ks, ks_const, 100)); | ||
| ks.update(); | ||
| ks.updateLinkTransforms(); //Returned samples have dirty link transforms. |
|
Fixed the indenting, no idea how I missed that prior to PR. On reflection it seems like a waste to call updateLinkTransforms for every type of sampler when only some types of samplers require it. It also looks like a lot of effort has gone into writing RobotState and the surrounding code in a way that minimizes the number of link updates that are performed, suggesting it can be a pretty expensive method. The link transforms cannot be updated in IKConstraintSampler::sample since the RobotState argument is const. Instead of updating the link transforms before calling every type of sampler, could we add a flag to the samplers that shows whether or not the input robot state needs to have updated link transforms? e.g. instead of: Could we do something like this? |
-1 This would not be portable to indigo without breakage. Your current patch works fine. |
|
Oh, as my previous message starts with "-1", I want to stress, that I +1 this patch as is. |
|
I'm very curious to see benchmark results, as suggested, for this added update call. |
|
On Wed, Sep 07, 2016 at 04:26:55PM -0700, Dave Coleman wrote:
At the moment this is broken, so I would propose to fix the bug first of all. |
|
I wrapped some timing around calls to sample in TEST_F(LoadPlanningModelsPr2, UnionConstraintSampler) inside test_constraint_samplers.cpp: From line 581: Times: Tested a few times and these numbers are relatively stable. I don't know enough about the sampling code to know whether the tests are valid (e.g. are not just using some cached values or something). If they are valid this patch somehow speeds up the constrained sampling. I am a bit skeptical about these results since I am not sure how updating link transforms could speed up sampling. |
|
On Thu, Sep 08, 2016 at 03:14:19AM -0700, Scott Paulin wrote:
LOL. If anything, that supports my point. ;) Did you run separate trials with and without the patch? |
|
Yip! They were separate trials, 1.15 seconds was with the patch and 2.01 was without.
Haha yip! Lucky you suggested the test. Is there anything blocking this from being merged now? |
|
+1 |
Update links in union constraint sampler and fix unit test.
Update links in union constraint sampler and fix unit test.
|
merged and cherry-picked to indigo/jade. Thanks again @scottpaulin ! |
This extends moveit#186 (0119d58). Scott Paulin found that the UnionConstraintSampler should explicitly update the LinkTransforms of the returned samples, because one of the other samplers could require them to be valid. Back then, we missed that the sampler also provides a `project` method that has the same limitation. So I update the transforms there too.
This extends #186 (0119d58). Scott Paulin found that the UnionConstraintSampler should explicitly update the LinkTransforms of the returned samples, because one of the other samplers could require them to be valid. Back then, we missed that the sampler also provides a `project` method that has the same limitation. So I update the transforms there too.
This extends #186 (0119d58). Scott Paulin found that the UnionConstraintSampler should explicitly update the LinkTransforms of the returned samples, because one of the other samplers could require them to be valid. Back then, we missed that the sampler also provides a `project` method that has the same limitation. So I update the transforms there too.
This extends #186 (0119d58). Scott Paulin found that the UnionConstraintSampler should explicitly update the LinkTransforms of the returned samples, because one of the other samplers could require them to be valid. Back then, we missed that the sampler also provides a `project` method that has the same limitation. So I update the transforms there too.
This fixes the failing assertion in the unit tests. It fixes a bug where constrained samplers were being passed robot states with dirty link transforms. This is an issue when IKConstraintSamplers are used because they read the frame transforms to get the pose of the end-effector.