Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
fov_trimming.cpp
Go to the documentation of this file.
2
3bool FovTrimming::within_limits(float x, float y, float z, float intensity,
4 const TrimmingParameters& params, const double max_range) const {
5 bool ret = true;
6
7 if (params.apply_fov_trimming) {
8 const double angle = std::atan2(y, x) * 180.0 / M_PI;
9 const double half_fov = params.fov / 2.0;
10 if (angle < -half_fov || angle > half_fov) {
11 ret &= false;
12 }
13 }
14
15 double distance_squared = x * x + y * y;
16
17 ret &= z < (params.max_height - params.lidar_height);
18 ret &= (distance_squared > params.min_range * params.min_range) &&
19 (distance_squared <= max_range * max_range);
20
21 if (params.is_raining) {
22 // In rainy conditions, the intensity must be at greater or equal to 1 to be considered valid,
23 // as the water droplets cause 0 intensity points. It is not applied in normal conditions to
24 // preserve more points, as a lot of cone points have low intensity.
25 ret &= intensity >= params.minimum_intensity;
26 }
27
28 return ret;
29}
bool within_limits(float x, float y, float z, float intensity, const TrimmingParameters &params, const double max_range) const
Structure to hold parameters for trimming point cloud data.
float minimum_intensity
Minimum intensity for point to be considered valid in rain.
bool apply_fov_trimming
Whether to apply field of view trimming.
double max_height
Maximum point cloud height after trimming.
bool is_raining
Whether it is raining.
double fov
Field of view.
double min_range
Maximum point cloud distance after trimming.
double lidar_height
LIDAR current height.