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

Nosille small bug fix #1412

Closed
wants to merge 1 commit into from
Closed

Conversation

Nosille
Copy link
Contributor

@Nosille Nosille commented Dec 12, 2024

I stumbled across a small indexing bug in adjustNormalsToViewPoint. I also noted a piece of unreachable code in LocalGridMaker.

Comment on lines 261 to 280
bool normalSegmentationTmp = normalsSegmentation_;
float minGroundHeightTmp = minGroundHeight_;
float maxGroundHeightTmp = maxGroundHeight_;
if(scan.is2d())
{
// if 2D, assume the whole scan is obstacle
normalsSegmentation_ = false;
minGroundHeight_ = std::numeric_limits<int>::min();
maxGroundHeight_ = std::numeric_limits<int>::min()+100;
}

createLocalMap(scan, node.getPose(), groundCells, obstacleCells, emptyCells, viewPoint);

if(scan.is2d())
{
// restore
normalsSegmentation_ = normalSegmentationTmp;
minGroundHeight_ = minGroundHeightTmp;
maxGroundHeight_ = maxGroundHeightTmp;
}
Copy link
Member

Choose a reason for hiding this comment

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

This is done in a special case when we combine 2D lidar data and 3D depth data into the local grid. Is it really never called even in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It grabbed my attention because of multiple checks for is2d() and occupancy == 0. However, after a second look, you are correct that occupancy == 2 could still get there.

My bad.

@@ -3530,7 +3530,7 @@ LaserScan adjustNormalsToViewPoint(

float result = v.dot(n);
if(result < 0
|| (groundNormalsUp>0.0f && ptr[nz] < -groundNormalsUp && ptr[2] < viewpoint[3])) // some far velodyne rays on road can have normals toward ground
Copy link
Member

Choose a reason for hiding this comment

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

viewpoint is an Eigen::Vector3f object, with indexes 0=x, 1=y and 2=z. 3 would be out of bounds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After, sending this I dug a little deeper and noted that there are several other places in the code where viewpoint[3] is used. The difference is that in those cases the vector is an Eigen::Vector4f, so it doesn't crash like this did. However, it seems to me that viewpoint[2] is likely the intended array value in those cases as well. Do you agree? Or am a missing something? It seems like a simple comparison between point.z and viewpoint.z, but I guess you could be doing something I am not following with the 4th value in the homogeneous coordinates.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the comment, the other places using viewpoint[3] are wrong. Here the ones I've found:
https://github.com/search?q=repo%3Aintrolab%2Frtabmap%20viewpoint%5B3%5D&type=code

I created an issue about it #1413

@Nosille Nosille force-pushed the nosille_small_bug_fix branch from 5e6d9b9 to 3e0d4c2 Compare December 23, 2024 21:40
@Nosille Nosille closed this Jan 3, 2025
@Nosille Nosille deleted the nosille_small_bug_fix branch January 3, 2025 21:54
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.

2 participants