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

there exit serious bug in funciton "inline double ScanMatcher::score" and inline unsigned int "ScanMatcher::likelihoodAndScore" #25

Open
chenxianbo opened this issue Dec 7, 2018 · 2 comments

Comments

@chenxianbo
Copy link

chenxianbo commented Dec 7, 2018

inline double ScanMatcher::score(const ScanMatcherMap& map, const OrientedPoint& p, const double* readings) const{
        .......
	double freeDelta=map.getDelta()*m_freeCellRatio;
	for (const double* r=readings+m_initialBeamsSkip; r<readings+m_laserBeams; r++, angle++){
		IntPoint ipfree=map.world2map(pfree);
		for (int xx=-m_kernelSize; xx<=m_kernelSize; xx++)
		for (int yy=-m_kernelSize; yy<=m_kernelSize; yy++){
			IntPoint pr=iphit+IntPoint(xx,yy);
			IntPoint pf=pr+ipfree;
	                .......
			//}
		}
	}
}

the line "IntPoint ipfree=map.world2map(pfree);" exist bug, it cannot calculate relative grid position.

IntPoint Map<Cell,Storage,isClass>::world2map(const Point& p) const
{
	return IntPoint( (int)round((p.x-m_center.x)/m_delta)+m_sizeX2, (int)round((p.y-m_center.y)/m_delta)+m_sizeY2);
}

assume pfree = (0.1, 0.1), m_center=(0,0),m_delta = 0.05, m_sizeX2 = 200,m_sizeY2=200,then calculate ipfree=(202,202)
so in function "socre", the distance between pr and pf is about ipfree=(202,202),it isn't right,so do in the function "likelihoodAndScore".

@topin89
Copy link

topin89 commented Nov 3, 2019

Yeah, you're right. Good thing this can be fixed by changing lines

pfree=pfree-phit;
...
IntPoint pf=pr+ipfree;

to

//pfree=pfree-phit;
...
IntPoint pf=ipfree+IntPoint(xx,yy);

Looks like the whole point of ipfree is to make sure there is empty space right before the wall, so we don't score anything inside of it.

So another way to fix it is to drop fcell from the condition:

if (((double)cell )> m_fullnessThreshold /*&& ((double)fcell )<m_fullnessThreshold*/)

Also, see #15

@topin89
Copy link

topin89 commented Nov 3, 2019

Oh, there is a PR to fix that: #10

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

No branches or pull requests

2 participants