5 #include <visualization_msgs/Marker.h> 6 #include <visualization_msgs/MarkerArray.h> 7 #include <sensor_msgs/PointCloud2.h> 8 #include <nav_msgs/Odometry.h> 9 #include <geometry_msgs/PoseArray.h> 10 #include <geometry_msgs/Pose.h> 12 #include <dynamic_reconfigure/server.h> 16 #include <pcl_conversions/pcl_conversions.h> 17 #include <pcl/point_cloud.h> 18 #include <pcl/point_types.h> 19 #include <pcl/common/transforms.h> 20 #include <pcl/common/common.h> 21 #include <Eigen/Dense> 22 #include <Eigen/Geometry> 24 #include <tf/LinearMath/Matrix3x3.h> 25 #include <tf/transform_datatypes.h> 26 #include <tf/transform_listener.h> 27 #include <tf/transform_broadcaster.h> 28 #include "tf_conversions/tf_eigen.h" 29 #include <pcl/filters/passthrough.h> 30 #include <pcl/registration/icp.h> 33 #include <pcl/filters/voxel_grid.h> 34 #include <pcl/filters/approximate_voxel_grid.h> 35 #include <pcl/filters/statistical_outlier_removal.h> 37 #include <pcl/features/normal_3d.h> 38 #include <pcl/kdtree/kdtree.h> 39 #include <pcl/segmentation/extract_clusters.h> 40 #include <pcl/octree/octree_impl.h> 41 #include <pcl/octree/octree.h> 42 #include <pcl/octree/octree_key.h> 43 #include <pcl/octree/octree_pointcloud_adjacency.h> 44 #include <pcl/sample_consensus/method_types.h> 45 #include <pcl/sample_consensus/model_types.h> 46 #include <pcl/segmentation/sac_segmentation.h> 47 #include <pcl/ModelCoefficients.h> 48 #include <pcl/filters/extract_indices.h> 55 #define SQR(a) ((a)*(a)) 57 using namespace Eigen;
80 void init(ros::NodeHandle &nh, ros::NodeHandle &private_nh);
96 tf::TransformBroadcaster
br;
117 vector < pcl::PointCloud<pcl::PointXYZ>::Ptr, Eigen::aligned_allocator <pcl::PointCloud<pcl::PointXYZ>::Ptr > >
sourceClouds;
166 void cloud_cb (
const sensor_msgs::PointCloud2ConstPtr& cloud_msg);
175 void cloud_transform (
const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& cloud_in,
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_out);
184 void cloud_filter (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_in,
const string field,
float min,
float max);
197 void Voxel_filter (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_in,
198 const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_out,
199 float VOXEL_LEAF_SIZE);
209 void SOR_filter (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_in,
210 const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_out,
212 float SOR_STD_DEV_MUL_THRESH );
237 void Ransac_plane (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_in,
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_out);
249 void euclideancluster (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud,
250 float SEG_CLUSTER_TOLERANCE,
251 int SEG_MIN_CLUSTER_SIZE,
252 int SEG_MAX_CLUSTER_SIZE);
279 void detect_spatial_change (
const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_now,
280 const pcl::PointCloud<pcl::PointXYZ>::Ptr& cloud_to_compare,
281 const pcl::PointCloud<pcl::PointXYZ>::Ptr& dynamic_cloud,
282 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr& occuluded_cloud,
283 float OCTREE_RESOLUTION,
284 bool ENABLE_OCCLUSION_DETECTION);
301 bool is_in_bounding_area(
const pcl::PointCloud<pcl::PointXYZ>::Ptr& coord, pcl::PointXYZRGB pt );
305 void integrateOdom_ICP (
const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& obj_cloud,
const pcl::PointCloud<pcl::PointXYZ>::Ptr& ref_obj_cloud );
tf::StampedTransform current_cloud_transform
Container to store transform of latest pointcloud wrt /odom.
Definition: dynamic_obstacle_tracking.hpp:98
float PASS_X_MIN
minimum value in x direction
Definition: dynamic_obstacle_tracking.hpp:142
float PASS_X_MAX
maximum value in x direction
Definition: dynamic_obstacle_tracking.hpp:143
vector< tf::StampedTransform > sourceTransforms
Vector to store corresponding Transforms of each PointCloud in sourceClouds /odom to /base_link...
Definition: dynamic_obstacle_tracking.hpp:118
float PASS_Y_MIN
minimum value in y direction
Definition: dynamic_obstacle_tracking.hpp:144
bool ENABLE_OCCLUSION_DETECTION
Enable Occlusion detection so as to prevent false dynamic obstacles detection due to shadow : Default...
Definition: dynamic_obstacle_tracking.hpp:133
float VOXEL_LEAF_SIZE
Definition: dynamic_obstacle_tracking.hpp:135
tf::TransformBroadcaster br
TF brodcaster to broadcast relative transfom between current pointcloud and prev PointCloud.
Definition: dynamic_obstacle_tracking.hpp:96
ros::Publisher pub
publish point cloud after transforming it to base_link on topic /transformed_points ...
Definition: dynamic_obstacle_tracking.hpp:83
pcl::PointCloud< pcl::PointXYZRGB >::Ptr occuluded_cloud
container to store the points at current timestep that are in the areas which were occuluded in refer...
Definition: dynamic_obstacle_tracking.hpp:107
float PASS_Y_MAX
maximum value in y direction
Definition: dynamic_obstacle_tracking.hpp:145
float SEG_CLUSTER_TOLERANCE
Maximum distance between two points to be included in same cluster.
Definition: dynamic_obstacle_tracking.hpp:153
Definition: dynamic_obstacle_tracking.hpp:68
pcl::PointCloud< pcl::PointXYZRGB >::Ptr classified_cloud
Container to store final classified cloud = filtered_dynamic_cloud(Red) + occuluded_cloud(Green) + ne...
Definition: dynamic_obstacle_tracking.hpp:110
Definition: dynamic_obstacle_tracking.hpp:65
bool ENABLE_ICP
Enable use of ICP to better match obj_cloud with ref_obj_cloud : Default it is disabled bcoz of bad r...
Definition: dynamic_obstacle_tracking.hpp:130
pcl::PointCloud< pcl::PointXYZ >::Ptr obj_cloud
container to store pointcloud having both static and dynamic objects
Definition: dynamic_obstacle_tracking.hpp:105
Definition: dynamic_obstacle_tracking.hpp:75
float PASS_Z_MIN
minimum value in z direction
Definition: dynamic_obstacle_tracking.hpp:146
pcl::PointCloud< pcl::PointXYZ >::Ptr ref_obj_cloud
container to store object cloud to be used as reference for comparing with object cloud at current ti...
Definition: dynamic_obstacle_tracking.hpp:106
pcl::PointCloud< pcl::PointXYZRGB >::Ptr new_discovered_cloud
Container to store points at current timestep that are in the areas which are newly discovered...
Definition: dynamic_obstacle_tracking.hpp:108
bool ENABLE_GROUND_REMOVAL
Enable use of ransac plane fitting to remove ground points : Default it is disabled for ZR300 and ena...
Definition: dynamic_obstacle_tracking.hpp:131
tf::StampedTransform prev_cloud_transform
Container to store transform of previous pointcloud wrt /odom.
Definition: dynamic_obstacle_tracking.hpp:100
tf::TransformListener listener
A TF listener.
Definition: dynamic_obstacle_tracking.hpp:95
ros::Publisher pub_3
Publish pointcloud with dynamic obstacles on topic /dynamic_points.
Definition: dynamic_obstacle_tracking.hpp:85
ros::Subscriber sub
subscribes sensor_msgs::PointCloud2 from topic /cloud
Definition: dynamic_obstacle_tracking.hpp:89
float x
Definition: dynamic_obstacle_tracking.hpp:69
ros::Publisher centroids_pub
Publish geometry_msgs::PoseArray centroids of dynamic obstacles on topic /object_centroids.
Definition: dynamic_obstacle_tracking.hpp:87
string base_frame_id
Definition: dynamic_obstacle_tracking.hpp:127
tf::StampedTransform ref_cloud_transform
Container to store transform of reference pointcloud wrt /odom.
Definition: dynamic_obstacle_tracking.hpp:99
Eigen::Affine3f icp_transform_matrix
Definition: dynamic_obstacle_tracking.hpp:121
int SEG_MAX_CLUSTER_SIZE
Maximum number points to be included in same cluster.
Definition: dynamic_obstacle_tracking.hpp:155
string frame_id
Definition: dynamic_obstacle_tracking.hpp:126
bool ENABLE_VOXELISE
Enable voxel filter: Default it is enable for ZR300 and disabled for Velodyne.
Definition: dynamic_obstacle_tracking.hpp:132
vector< pcl::PointCloud< pcl::PointXYZ >::Ptr, Eigen::aligned_allocator< pcl::PointCloud< pcl::PointXYZ >::Ptr > > sourceClouds
vector to store the "OCTREE_WINDOW" number of obj_cloud in the memory
Definition: dynamic_obstacle_tracking.hpp:117
float SOR_MEAN_K
number of neighbors to analyze for each point
Definition: dynamic_obstacle_tracking.hpp:138
float SOR_STD_DEV_MUL_THRESH
distance in multiples of std dev after which point is considered an outlier
Definition: dynamic_obstacle_tracking.hpp:139
Eigen::Affine3d odom_transform_matrix
Container to store relative transform between obj_cloud and ref_obj_cloud.
Definition: dynamic_obstacle_tracking.hpp:120
int OCTREE_WINDOW
This parameter defines that current pointcloud will be compared with "OCTREE_WINDOW" times previous p...
Definition: dynamic_obstacle_tracking.hpp:150
float PASS_Z_MAX
maximum value in z direction
Definition: dynamic_obstacle_tracking.hpp:147
string sensor_frame_id
Definition: dynamic_obstacle_tracking.hpp:128
float y
Definition: dynamic_obstacle_tracking.hpp:70
int SEG_MIN_CLUSTER_SIZE
Minimum number of points that should be present within a cluster.
Definition: dynamic_obstacle_tracking.hpp:154
ros::Publisher pub_2
Publish pointcloud with dynamic obstacles on topic /dynamic_points.
Definition: dynamic_obstacle_tracking.hpp:84
bool ENABLE_SOR
Enable Statistical Outlier removal filter: Default it is enable for ZR300 and disabled for Velodyne...
Definition: dynamic_obstacle_tracking.hpp:137
float z
Definition: dynamic_obstacle_tracking.hpp:71
pcl::PointCloud< pcl::PointXYZRGB >::Ptr filtered_dynamic_cloud
Container to store filtered dynamic cloud (Red in colour) = dynamic_cloud - occuluded_cloud - new_dis...
Definition: dynamic_obstacle_tracking.hpp:109
float OCTREE_RESOLUTION
smallest dimension of octree leaf node
Definition: dynamic_obstacle_tracking.hpp:151
pcl::PointCloud< pcl::PointXYZ >::Ptr cloud_transformed
container to store current pointcloud after transforming it to /base_link frame from /sensor frame ...
Definition: dynamic_obstacle_tracking.hpp:104
int counter
Definition: dynamic_obstacle_tracking.hpp:125