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

fixed gicp guess handling #989

Merged
merged 3 commits into from
Aug 23, 2016
Merged

Conversation

prclibo
Copy link
Contributor

@prclibo prclibo commented Nov 11, 2014

Denote final transformation result Y=X_guess. Gicp should either 1) optimize X from identity by comparing guess_source and target or 2) optimize Y starting from X by comparing source and target. Current GICP code messes these two approaches. In computeTransformation, it uses base_transformation_ = guess as the start of the optimization but use output = guess * source as the source cloud.

This PR fixed it to approach 1).

@VictorLamoine
Copy link
Contributor

Does it fix #754 ?

@prclibo
Copy link
Contributor Author

prclibo commented Nov 12, 2014

Yes it does

@VictorLamoine
Copy link
Contributor

Then would you be so kind as to integrate the test unit as well?
It is located here.

@prclibo
Copy link
Contributor Author

prclibo commented Nov 13, 2014

I took a look into the commit and it looks weird. The bunny test cloud is just 0.1m size. Why is the test giving a (20, -8, 1) to challenge it?

@taketwo
Copy link
Member

taketwo commented Nov 16, 2014

@VictorLamoine any comments? I think you are the original author of that line.

@VictorLamoine
Copy link
Contributor

I used a very big distance to make sure that one iteration could not get close to a perfect alignment.
Without using the guess transformation it is impossible that 1 iteration of GICP gets close to a good result.
With the guess transformation it is possible (especially in that case where the guess matrix is perfect)

@taketwo
Copy link
Member

taketwo commented Nov 22, 2014

I tried this PR against that test case and it failed:

77: /media/Workspace/Libraries/pcl/test/registration/test_registration.cpp:536: Failure
77: Expected: (reg.getFitnessScore ()) < (0.0001), actual: 0.000809606 vs 0.0001

Looking inside the code, I found it rather strange how the final transformation matrix is computed:

final_transformation_.topLeftCorner (3,3) = previous_transformation_.topLeftCorner (3,3) * guess.topLeftCorner (3,3);
final_transformation_(0,3) = previous_transformation_(0,3) + guess(0,3);
final_transformation_(1,3) = previous_transformation_(1,3) + guess(1,3);
final_transformation_(2,3) = previous_transformation_(2,3) + guess(2,3);

Though if replaced with matrix multiplication, the final fitness score only increases.

@prclibo
Copy link
Contributor Author

prclibo commented Nov 24, 2014

I did some experiments but still havn't get final conclusion yet. One un-confirmed observation is:

  • Ignoring the guess, if I transform src to transform_src and tgt to transform_tgt by the same transform. The registration will fail though it can do between src and tgt. This case happens when transform has a relatively large translation, i.e. both clouds are moved far away from the origin.

I don't know why this happen. But it may be the reason for this test case to fail, which is not related to the input guess.

Also, I noticed that the second registration should not re-use the first gicp instance, as some member variables seem not re-initialized.

@taketwo I agree that the final_transformation_ computation is wrong.

@prclibo
Copy link
Contributor Author

prclibo commented Nov 24, 2014

I got the testcase passed when by setting transform.translation () = Eigen::Vector3f (0.1, 0.2, 0.3);, which is already a large shift compared to the model size. Larger translation like (20, -8, 1) leads to test failure, probably due to numerial failure, I guess.

@VictorLamoine
Copy link
Contributor

I think this deserves a little bit of cleaning but otherwise the problem is solved right?

@prclibo
Copy link
Contributor Author

prclibo commented Feb 14, 2015

@VictorLamoine I think so

@prclibo
Copy link
Contributor Author

prclibo commented Feb 19, 2015

#1147
This might be related to the following observation

I got the testcase passed when by setting transform.translation () = Eigen::Vector3f (0.1, 0.2, 0.3);, which is already a large shift compared to the model size. Larger translation like (20, -8, 1) leads to test failure, probably due to numerial failure, I guess.

@prclibo prclibo force-pushed the master branch 2 times, most recently from cdb15df to 5bc058e Compare April 3, 2015 07:37
// final_transformation_.topLeftCorner (3,3) = previous_transformation_.topLeftCorner (3,3) * guess.topLeftCorner (3,3);
// final_transformation_(0,3) = previous_transformation_(0,3) + guess(0,3);
// final_transformation_(1,3) = previous_transformation_(1,3) + guess(1,3);
// final_transformation_(2,3) = previous_transformation_(2,3) + guess(2,3);
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for keeping these commented? Why not simply remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason the static equivalent methode raises an error

I am not sure what this means. Maybe a Eigen template problem at some versions, but anyway I am removing these comments.

@SergioRAgostinho SergioRAgostinho added the needs: author reply Specify why not closed/merged yet label Jul 14, 2016
@SergioRAgostinho SergioRAgostinho added this to the pcl-1.8.1 milestone Jul 14, 2016
@SergioRAgostinho
Copy link
Member

Note: incorporated changes from #972

@SergioRAgostinho
Copy link
Member

@prclibo Can you clean up the commit so that we can incorporate it in 1.8.1? Thank you

@SergioRAgostinho
Copy link
Member

Also, please squash your last 4 commits into a single one, basically only the commits in which you're the corresponding author.

@prclibo
Copy link
Contributor Author

prclibo commented Aug 22, 2016

@SergioRAgostinho OK I am newbie to rebase and I think I messed it up=( Any suggestions?
What I did:

git rebase -i 0d66be09a91bb1a6f43fde111c6c0c1924b9356e 07cfa84b1b9261e5b17e827b96e12e70961cdfbd
// Reordered my commits to the bottom.
git commit --amend --author="prclibo<prclibo@gmail.com>"
git checkout tmp
git branch -d master
git checkout -b master 
git push origin +master

@SergioRAgostinho
Copy link
Member

Whoops! This never happened to me before. Here's some options based on Google's first results.

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Aug 22, 2016

Another idea:

@VictorLamoine
Copy link
Contributor

VictorLamoine commented Aug 22, 2016

Backup your work first (create an other branch) 😉

VictorLamoine and others added 3 commits August 23, 2016 07:36
further fix gicp tests and gicp final_transformation computation noted by @taketwo

removed unused code

Author:    Bo Li
@prclibo
Copy link
Contributor Author

prclibo commented Aug 23, 2016

@SergioRAgostinho @VictorLamoine thanks for the help! It seems fixed and I hope I didn't miss anything.

@SergioRAgostinho SergioRAgostinho removed the needs: author reply Specify why not closed/merged yet label Aug 23, 2016
@SergioRAgostinho SergioRAgostinho merged commit 0c4ae84 into PointCloudLibrary:master Aug 23, 2016
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.

5 participants