Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
himmelsbach.hpp
Go to the documentation of this file.
1#pragma once
3
4int constexpr NUM_RINGS = 40;
5
10struct Ring {
11 std::vector<int> indices;
12
13 Ring() = default;
14};
15
20struct Slice {
21 std::vector<Ring> rings{::NUM_RINGS};
22
23 Slice() = default;
24};
25
32class Himmelsbach : public GroundRemoval {
33public:
43 Himmelsbach(const double grid_angle, const double max_slope, const double initial_alpha,
44 const double alpha_augmentation_m, const double start_augmentation,
45 TrimmingParameters trim_params);
46
47 Himmelsbach() = default;
48
56 void ground_removal(const sensor_msgs::msg::PointCloud2::SharedPtr& trimmed_point_cloud,
57 sensor_msgs::msg::PointCloud2::SharedPtr& ground_removed_point_cloud,
58 GroundGrid& ground_grid) const override;
59
60private:
61 double grid_angle_; // Angle increment for slicing the point cloud
62 double max_slope_; // Maximum slope to consider a point as ground candidate
63 double initial_alpha_; // Initial distance threshold for ground classification of candidates
64 double alpha_augmentation_m_; // Increase of alpha by meter
65 double start_augmentation_; // Range at which distance threshold starts to increase
67 std::shared_ptr<std::vector<Slice>>
68 slices_; // Vector containing all slices, initialized in constructor
69
77 void process_slice(const sensor_msgs::msg::PointCloud2::SharedPtr& trimmed_point_cloud,
78 sensor_msgs::msg::PointCloud2::SharedPtr& ground_removed_point_cloud,
79 size_t slice_idx, GroundGrid& ground_grid) const;
80
86 void split_point_cloud(const sensor_msgs::msg::PointCloud2::SharedPtr& input_cloud) const;
87};
Class to represent a ground height grid for ground proximity checks.
Abstract class for ground removal from a point cloud.
Ground removal using the Himmelsbach algorithm.
Himmelsbach()=default
double initial_alpha_
double alpha_augmentation_m_
std::shared_ptr< std::vector< Slice > > slices_
double max_slope_
TrimmingParameters trim_params_
double start_augmentation_
void ground_removal(const sensor_msgs::msg::PointCloud2::SharedPtr &trimmed_point_cloud, sensor_msgs::msg::PointCloud2::SharedPtr &ground_removed_point_cloud, GroundGrid &ground_grid) const override
Perform ground removal on a point cloud.
double grid_angle_
void process_slice(const sensor_msgs::msg::PointCloud2::SharedPtr &trimmed_point_cloud, sensor_msgs::msg::PointCloud2::SharedPtr &ground_removed_point_cloud, size_t slice_idx, GroundGrid &ground_grid) const
Process a single slice for ground removal.
void split_point_cloud(const sensor_msgs::msg::PointCloud2::SharedPtr &input_cloud) const
Split the input point cloud into slices and rings.
int constexpr NUM_RINGS
Stores indices of points in a single ring.
Ring()=default
std::vector< int > indices
Represents a horizontal slice of the LiDAR scan.
Slice()=default
std::vector< Ring > rings
Structure to hold parameters for trimming point cloud data.