Perceptions LiDAR Module

Defines

_USE_MATH_DEFINES

Typedefs

typedef struct radial radial_t

Radial struct for points.

Functions

inline radial_t point2radial(PointXYZ pt)

Converts (x,y,z) to (radius,ang,z), where ang is in radians.

Parameters:

pt – The (x,y,z) point to convert

Returns:

the converted point

inline PointXYZ radial2point(radial_t rd)

Converts (radius,ang,z) to (x,y,z), where ang is in radians.

Parameters:

rd – The (radius,ang,z) point to convert

Returns:

the converted point

inline radial_t min_height(vector<radial_t> bin)

Gets the minimum point in a bin.

Parameters:

bin – The bin to search

Returns:

the point with the lowest z

inline PointCloud<PointXYZ> GraceAndConrad(PointCloud<PointXYZ> cloud, double alpha, int num_bins, double height_threshold)

Function implementing the GraceAndConrad algorithm.

Parameters:
  • cloud – The input vector of rectangular points to parse

  • alpha – The size of each segment (radians)

  • num_bins – The number of bins per segment

  • height_threshold – Keep all points this distance above the best fit line

Returns:

A point cloud of ground-filtered points

inline double euclideanDistance(const PointXYZ &a, const PointXYZ &b)

Calculates Euclidean distance between two PointXYZ.

inline vector<int> regionQuery(PointCloud<PointXYZ> &cloud, const PointXYZ &point, double epsilon)

Returns indices of points in cloud that are within epsilon of point.

inline void expandCluster(PointCloud<PointXYZ> &cloud, vector<bool> &visited, vector<int> &cluster, int point_idx, vector<int> &neighbors, int cluster_id, double epsilon, int min_points)

Expands the cluster by checking neighbors and assigning them as needed.

inline PointCloud<PointXYZ> computeCentroids(PointCloud<PointXYZ> &cloud, const unordered_map<int, vector<int>> &clusters)

Computes centroids for the clusters.

inline PointCloud<PointXYZ> DBSCAN(PointCloud<PointXYZ> &cloud, double epsilon, int min_points)

Implementation of Density-Based Spatial Clustering of Applications with Noise (DBSCAN) to calculate cone centroids.

Parameters:
  • cloud – pointcloud

  • epsilon – neighborhood radius to search for each point

  • min_points – minimum number of points in a neighborhood to continute a dense cluster

Returns:

Clustered pointcloud.

inline PointCloud<PointXYZ> DBSCAN2(PointCloud<PointXYZ> &cloud, double epsilon, int min_points)

Implementation of Density-Based Spatial Clustering of Applications with Noise (DBSCAN) used for secondary filtering to get rid of extraneous clusters outside of cones.

Parameters:
  • cloud – pointcloud

  • epsilon – neighborhood radius to search for each point

  • min_points – minimum number of points in a neighborhood to continute a dense cluster

Returns:

Clustered pointcloud.

inline interfaces::msg::ConeArray color_cones_without_camera(const PointCloud<PointXYZ> &cloud)

Cone coloring implementation that uses a geometric approach to classifying cone colors. Point to pixel is not used.

inline interfaces::msg::ConeArray run_pipeline_dark(PointCloud<PointXYZ> &cloud, double alpha, int num_bins, double height_threshold, double epsilon, int min_points, double epsilon2, int min_points2, const rclcpp::Logger &logger)

Perceptions pipeline implementation without cameras (geometric coloring).

inline PointCloud<PointXYZ> run_pipeline(PointCloud<PointXYZ> &cloud, double alpha, int num_bins, double height_threshold, double epsilon, int min_points, double epsilon2, int min_points2, const rclcpp::Logger &logger)

Main Perceptions pipline function.

Parameters:
  • cloud – pointcloud

  • alpha – GraceAndConrad parameter

  • height_threshold – GraceAndConrad parameter

  • epsilon – DBSCAN parameter

  • min_points – DBSCAN parameter

  • epsilon2 – DBSCAN2 parameter

  • min_points2 – DBSCAN2 parameter

  • logger – ROS2 logger object for consistant logging

struct radial

Radial struct for points.

Public Members

double angle
double radius
double z
namespace std
namespace pcl