Fixed create2DMap assert on 32FC2 when subscribing 2D scans with intensity. LaserScan: fixed assert when angle_min > angle_max (with angle_increment < 0)

This commit is contained in:
matlabbe
2021-02-16 10:47:31 -05:00
parent f871e4359d
commit bb7e9edb9b
3 changed files with 5 additions and 6 deletions

View File

@@ -299,8 +299,7 @@ void LaserScan::init(
// 2D scan
is2D = true;
UASSERT(rangeMax>rangeMin);
UASSERT(angleMax>angleMin);
UASSERT(angleIncrement != 0.0f);
UASSERT((angleIncrement>0 && angleMax>angleMin) || (angleIncrement<0 && angleMax<angleMin));
maxPoints_ = std::ceil((angleMax - angleMin) / angleIncrement)+1;
}
else

View File

@@ -286,8 +286,8 @@ void OccupancyGrid::createLocalMap(
cv::Mat & emptyCells,
cv::Point3f & viewPoint) const
{
UDEBUG("scan format=%d, occupancyFromDepth_=%d normalsSegmentation_=%d grid3D_=%d",
node.sensorData().laserScanRaw().isEmpty()?0:node.sensorData().laserScanRaw().format(), occupancyFromDepth_?1:0, normalsSegmentation_?1:0, grid3D_?1:0);
UDEBUG("scan format=%s, occupancyFromDepth_=%d normalsSegmentation_=%d grid3D_=%d",
node.sensorData().laserScanRaw().isEmpty()?"NA":node.sensorData().laserScanRaw().formatName().c_str(), occupancyFromDepth_?1:0, normalsSegmentation_?1:0, grid3D_?1:0);
if((node.sensorData().laserScanRaw().is2d()) && !occupancyFromDepth_)
{
@@ -407,7 +407,7 @@ void OccupancyGrid::createLocalMap(
const Transform & t = node.sensorData().stereoCameraModel().localTransform();
viewPoint = cv::Point3f(t.x(), t.y(), t.z());
}
createLocalMap(LaserScan(util3d::laserScanFromPointCloud(*cloud, indices), 0, 0.0f, LaserScan::kXYZRGB), node.getPose(), groundCells, obstacleCells, emptyCells, viewPoint);
createLocalMap(LaserScan(util3d::laserScanFromPointCloud(*cloud, indices), 0, 0.0f), node.getPose(), groundCells, obstacleCells, emptyCells, viewPoint);
}
}
}

View File

@@ -122,7 +122,7 @@ void occupancy2DFromLaserScan(
}
else
{
scanNoHit = scanHitIn;
scanNoHit = scanHit;
}
std::map<int, Transform> poses;