36 #include <pcl/point_types.h> 50 const float x,
const float y,
const float z)
59 const std::string& name)
63 int num_points, num_points_global;
64 pnh.
param(
"num_points", num_points, 3);
65 pnh.
param(
"num_points_global", num_points_global, 0);
69 double clip_near, clip_far;
70 pnh.
param(
"clip_near", clip_near, 0.5);
71 pnh.
param(
"clip_far", clip_far, 4.0);
75 double clip_z_min, clip_z_max;
76 pnh.
param(
"clip_z_min", clip_z_min, -2.0);
77 pnh.
param(
"clip_z_max", clip_z_max, 2.0);
81 double beam_likelihood_min;
82 pnh.
param(
"beam_likelihood", beam_likelihood_min, 0.2);
84 beam_likelihood_ = powf(beam_likelihood_min, 1.0 / static_cast<float>(num_points));
87 pnh.
param(
"ang_total_ref", ang_total_ref, M_PI / 6.0);
92 const size_t num_particles,
93 const size_t current_num_particles)
95 if (current_num_particles <= num_particles)
107 typename pcl::PointCloud<LidarMeasurementModelBase::PointType>::Ptr
109 const typename pcl::PointCloud<LidarMeasurementModelBase::PointType>::ConstPtr& pc)
const 121 pcl::PointCloud<LidarMeasurementModelBase::PointType>::Ptr pc_filtered(
122 new pcl::PointCloud<LidarMeasurementModelBase::PointType>);
125 std::remove_if(pc_filtered->begin(), pc_filtered->end(), local_points_filter), pc_filtered->end());
126 pc_filtered->width = 1;
127 pc_filtered->height = pc_filtered->points.size();
134 const typename pcl::PointCloud<LidarMeasurementModelBase::PointType>::ConstPtr& pc,
135 const std::vector<Vec3>& origins,
142 pcl::PointCloud<LidarMeasurementModelBase::PointType>::Ptr pc_particle(
143 new pcl::PointCloud<LidarMeasurementModelBase::PointType>);
144 std::vector<int> id(1);
145 std::vector<float> sqdist(1);
147 float score_beam = 1.0;
150 for (
auto& p : pc_particle->points)
152 const int beam_header_id = p.label;
155 s.
pos_ + s.
rot_ * origins[beam_header_id],
158 for (
auto point : ray)
160 if (point.collision_)
float beam_likelihood_min_
void transform(pcl::PointCloud< PointType > &pc) const
pcl::PointCloud< PointType >::Ptr filter(const pcl::PointCloud< PointType >::ConstPtr &pc) const
std::shared_ptr< ChunkedKdtree > Ptr
LidarMeasurementModelBeam(const float x, const float y, const float z)
LidarMeasurementResult measure(ChunkedKdtree< PointType >::Ptr &kdtree, const pcl::PointCloud< PointType >::ConstPtr &pc, const std::vector< Vec3 > &origins, const State6DOF &s) const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
size_t num_points_default_
pcl::PointCloud< POINT_TYPE >::Ptr sample(const typename pcl::PointCloud< POINT_TYPE >::ConstPtr &pc, const size_t num) const
void setGlobalLocalizationStatus(const size_t num_particles, const size_t current_num_particles)
void loadConfig(const ros::NodeHandle &nh, const std::string &name)
size_t num_points_global_
PointCloudRandomSampler sampler_