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
+1 -2
View File
@@ -299,8 +299,7 @@ void LaserScan::init(
// 2D scan // 2D scan
is2D = true; is2D = true;
UASSERT(rangeMax>rangeMin); UASSERT(rangeMax>rangeMin);
UASSERT(angleMax>angleMin); UASSERT((angleIncrement>0 && angleMax>angleMin) || (angleIncrement<0 && angleMax<angleMin));
UASSERT(angleIncrement != 0.0f);
maxPoints_ = std::ceil((angleMax - angleMin) / angleIncrement)+1; maxPoints_ = std::ceil((angleMax - angleMin) / angleIncrement)+1;
} }
else else
+3 -3
View File
@@ -286,8 +286,8 @@ void OccupancyGrid::createLocalMap(
cv::Mat & emptyCells, cv::Mat & emptyCells,
cv::Point3f & viewPoint) const cv::Point3f & viewPoint) const
{ {
UDEBUG("scan format=%d, occupancyFromDepth_=%d normalsSegmentation_=%d grid3D_=%d", UDEBUG("scan format=%s, occupancyFromDepth_=%d normalsSegmentation_=%d grid3D_=%d",
node.sensorData().laserScanRaw().isEmpty()?0:node.sensorData().laserScanRaw().format(), occupancyFromDepth_?1:0, normalsSegmentation_?1:0, grid3D_?1:0); 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_) if((node.sensorData().laserScanRaw().is2d()) && !occupancyFromDepth_)
{ {
@@ -407,7 +407,7 @@ void OccupancyGrid::createLocalMap(
const Transform & t = node.sensorData().stereoCameraModel().localTransform(); const Transform & t = node.sensorData().stereoCameraModel().localTransform();
viewPoint = cv::Point3f(t.x(), t.y(), t.z()); 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);
} }
} }
} }
+1 -1
View File
@@ -122,7 +122,7 @@ void occupancy2DFromLaserScan(
} }
else else
{ {
scanNoHit = scanHitIn; scanNoHit = scanHit;
} }
std::map<int, Transform> poses; std::map<int, Transform> poses;