2️⃣

Point Cloud Segmentation

What would be objects that appear in the pcd but are not obstacles? For the most part, any free space on the road is not an obstacle, and if the road is flat it’s fairly straightforward to pick out road points from non-road points. To do this we will use a method called Planar Segmentation which uses the RANSAC (random sample consensus) algorithm.

Point Cloud Processor

It has function for filtering, segmentation, clustering, load/save PCD, ...

Segmenting the Plane with PCL

We use max iteration and distance tolerance. We create a list of inliers (which is a list of ints) which is all the indecies from that point cloud that belong to the plane. We separate the points that belong to the road from the points that belong to the scene.

Timer

This can be useful for measuring how long it takes to run the function. If it’s taking a really long time to process the segmentation, then the function is not going to be useful running in real-time on a self-driving car.

// Time segmentation process
auto startTime = std::chrono::steady_clock::now();

// TODO:: Fill in the function to segment cloud into two parts, the drivable plane and obstaclesauto endTime = std::chrono::steady_clock::now();
auto elapsedTime = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime);
std::cout << "plane segmentation took " << elapsedTime.count() << " milliseconds" << std::endl;

Inliers

std::pair<typename pcl::PointCloud<PointT>::Ptr, typename pcl::PointCloud<PointT>::Ptr> segResult(obstCloud,planeCloud);

Obstacle Cloud

RANSAC Algorithm

RANSAC stands for Random Sample Consensus, and is a method for detecting outliers in data. RANSAC runs for a max number of iterations, and returns the model with the best fit. Each iteration randomly picks a sub-sample of the data and fits a model through it, such as a line or a plane. Then the iteration with the highest number of inliers or the lowest noise is used as the best model.

The situation is: →We have a data and we know that there is a line in it. But the data also has a ton of outliers. Applying linear regression here and taking the average of all points does not make sense, since it will also take the average of the outliers and will result in a very bad line that does not represent the actual line that you have.

Segmentation of Ground Plane from a Point Cloud

We do that because we want to know the height above ground for the different objects.

From sensor fusion perceptive, the ground plane is the road, and you get reflections from lane markings. So you can have all these lane markings in the ground plane as separate objects.

Do hills affect Lidar?

They do affect int in terms of FOV, you don't see over the crown of a hill, until you are relatively far up. There are ways to detect the slope of a hill using lidar.

So in general if doesn't affect the lidar, it is just sth in the environment that you would detect.