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

Bug from upstream(karto) #601

Open
qlibp opened this issue May 30, 2023 · 3 comments
Open

Bug from upstream(karto) #601

qlibp opened this issue May 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@qlibp
Copy link
Contributor

qlibp commented May 30, 2023

https://github.com/SteveMacenski/slam_toolbox/blob/184f7278926eb365b41006805906468bb568af92/lib/karto_sdk/src/Mapper.cpp#LL627C15-L627C57

    bestResponse = CorrelateScan(pScan, rMean, fineSearchOffset, fineSearchResolution,
        0.5 * m_pMapper->m_pCoarseAngleResolution->GetValue(),
        m_pMapper->m_pFineSearchAngleOffset->GetValue(),
        doPenalize, rMean, rCovariance, true);

I believe the correct way to call should be

    bestResponse = CorrelateScan(pScan, rMean, fineSearchOffset, fineSearchResolution,
        m_pMapper->m_pFineSearchAngleOffset->GetValue(),
        0.5 * m_pMapper->m_pCoarseAngleResolution->GetValue(),
        doPenalize, rMean, rCovariance, true);
@qlibp qlibp changed the title Bug from upstream Bug from upstream(karto) May 30, 2023
@SteveMacenski
Copy link
Owner

That does indeed look like a bug - do you mind opening a PR? I'll backport across the distributions that fix. Good catch!

@SteveMacenski SteveMacenski added the bug Something isn't working label May 30, 2023
@qlibp
Copy link
Contributor Author

qlibp commented May 31, 2023

Yeah, though this seems like a bug, but I don't really test it out. Any idea on how to verify the fix is correct?

@qlibp
Copy link
Contributor Author

qlibp commented May 31, 2023

@SteveMacenski
OK, I guess I know how to prove it a bug. Here's the failure mode: Set some extreme param

karto::Mapper* pMapper = new karto::Mapper();
pMapper->Reset();
pMapper->setParamCoarseSearchAngleOffset(0.255);
pMapper->setParamCoarseAngleResolution(0.017);
pMapper->setParamFineSearchAngleOffset(0.051);
pMapper->setParamCorrelationSearchSpaceDimension(1);
pMapper->setParamCorrelationSearchSpaceResolution(0.01);
pMapper->setParamCorrelationSearchSpaceSmearDeviation(0.01);

Then do the process as usual, we will encounter an assertion fail:
math::DoubleEqual(angle, rSearchCenter.GetHeading() + searchAngleOffset)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants