Solving scan matching using Ceres

504 views
Skip to first unread message

33 n

unread,
Aug 21, 2022, 10:44:37 PM8/21/22
to Ceres Solver
Hi Guys,

I am new to Ceres and I've been trying to use it to solve scan matching problems, for a simple 2D example, I have 3 parameters (2 translation and 1 rotation) and hundreds of residuals corresponding to the point cloud in my scan.
I observed that Ceres is very likely to stuck at its local minimum. Let's say the initial angle I provide is 30 deg while the truth would be 60 deg, Ceres always give me something like 33deg and terminates due to the reach of function tolerance. I keep most options default.
Is there any options I can play with to make the linear solver descend more "wildly" or did I set up the problem in a wrong manner? Please help, Thanks!

Александр Иванов

unread,
Aug 27, 2022, 7:58:50 PM8/27/22
to Ceres Solver
As I understand you match two 2d scans. One is probably the map and the other is from 2d lidar. Probably you do the  following:
1. Creating correspondences between two point clouds based on feature matching or on some initial transform
2. Creating residuals and running optimization

Such kind of problems like point cloud matching are very sensitive to initial conditions. If initial transform is not close to real one then distance based correspondences are very bad and typically senseless. In this case stucking in some local minimum is expected. However if you build correspondences using for example ground truth transform but setting initial transform to be a bad one then the solver should find the correct solution. In this case problem may be in code.

Also when solving point cloud matching problem I reestimate correspondences after each solution since if transform changes correspondences should also change.

понедельник, 22 августа 2022 г. в 05:44:37 UTC+3, n33...@gmail.com:

33 n

unread,
Aug 29, 2022, 11:04:21 PM8/29/22
to Ceres Solver
Thanks for your reply!

The cost function I built was basically the sum of probability of each cell where each point is transformed onto the map, at least in my understanding, there was no explicit correspondence in my setup. I will think about how to correctly add correspondences and try your suggestions to see how it works.

Александр Иванов

unread,
Aug 30, 2022, 11:17:07 AM8/30/22
to Ceres Solver
As I understand you implement the following scan matching variant: you have a 2d map repesented as probability occupancy grid and next each point from the lidar scan has its own likelihood depending on the cell it falls into. Each unoccupied cell though each lidar ray passes through also contributes to likelihood but as unoccupied cell. The final likelihood depends onto the transform. If so beaware that in case of such problem formulation solver may easily stuck at some unoptimal (and even at initial) point. Solver tries to slightly change transform to reduce negative likelihood but if you problem is not smooth then such slight change may result in completely the same likelihood so the solver may exit due to small function change convergence criterion (especially if likelihood is implemented like bernoulli likelihood). Typical solution is to introduce certain smoothness to likelihood (using gaussians and etc.).

P.S. Just to be sure try to set initial transform to ground truth one and check that optimization does not move far from it (some minor changes a possible of coarse). If everything is ok it is an evidence that everything is ok with problem formuation (unfortunately bugs are inevitable and hard to find in complex problem).
вторник, 30 августа 2022 г. в 06:04:21 UTC+3, n33...@gmail.com:

33 n

unread,
Sep 1, 2022, 2:53:40 AM9/1/22
to Ceres Solver
Yes, my problem is not smooth and I am facing the "exit due to small function change convergence criterion". Originally I thought stucking at local minima of such formulation was inevitable, but as you said, there are "typical solutions", sure I will give it a try! BTW, using GT to validate the problem formulation sounds like a good idea.
Thanks again.

Reply all
Reply to author
Forward
0 new messages