45 const double& observation_keep_time, \
46 const double& expected_update_rate, \
47 const double& min_obstacle_height, \
48 const double& max_obstacle_height, \
49 const double& obstacle_range, \
51 const std::string& global_frame, \
52 const std::string& sensor_frame, \
53 const double& tf_tolerance, \
54 const double& min_d, \
55 const double& max_d, \
57 const double& vFOVPadding, \
59 const double& decay_acceleration, \
60 const bool& marking, \
61 const bool& clearing, \
62 const double& voxel_size, \
63 const bool& voxel_filter, \
64 const bool& enabled, \
65 const bool& clear_buffer_after_reading, \
68 _tf(tf), _observation_keep_time(observation_keep_time),
69 _expected_update_rate(expected_update_rate),_last_updated(
ros::Time::now()),
70 _global_frame(global_frame), _sensor_frame(sensor_frame),
71 _topic_name(topic_name), _min_obstacle_height(min_obstacle_height),
72 _max_obstacle_height(max_obstacle_height), _obstacle_range(obstacle_range),
73 _tf_tolerance(tf_tolerance), _min_z(min_d), _max_z(max_d),
74 _vertical_fov(vFOV), _vertical_fov_padding(vFOVPadding),
75 _horizontal_fov(hFOV), _decay_acceleration(decay_acceleration),
76 _marking(marking), _clearing(clearing), _voxel_size(voxel_size),
77 _voxel_filter(voxel_filter), _enabled(enabled),
78 _clear_buffer_after_reading(clear_buffer_after_reading),
79 _model_type(model_type)
95 pcl::PCLPointCloud2 pcl_pc2;
97 pcl::PointCloud < pcl::PointXYZ > pcl_cloud;
98 pcl::fromPCLPointCloud2(pcl_pc2, pcl_cloud);
101 catch (pcl::PCLException& ex)
103 ROS_ERROR(
"Failed to convert to pcl type, dropping observation: %s", \
111 pcl::PointCloud<pcl::PointXYZ>& cloud)
117 const std::string origin_frame =
\ 123 geometry_msgs::Quaternion orientation;
160 cld_global->header.stamp = cloud.header.stamp;
167 std::vector<int> indices;
168 pcl::removeNaNFromPointCloud(*cld_global, *cld_no_nan, indices);
172 pcl::ApproximateVoxelGrid<pcl::PointXYZ> sor1;
173 sor1.setInputCloud (cld_no_nan);
177 sor1.filter (*cld_global);
181 pcl::PointCloud<pcl::PointXYZ>& obs_cloud = \
183 unsigned int cloud_size = cld_global->points.size();
185 obs_cloud.points.resize(cloud_size);
186 unsigned int point_count = 0;
187 pcl::PointCloud<pcl::PointXYZ>::iterator it;
188 for (it = cld_global->begin(); it != cld_global->end(); ++it)
192 obs_cloud.points.at(point_count++) = *it;
197 obs_cloud.points.resize(point_count);
198 obs_cloud.header.stamp = cloud.header.stamp;
199 obs_cloud.header.frame_id = cld_global->header.frame_id;
206 "TF Exception for sensor frame: %s, cloud frame: %s, %s", \
207 _sensor_frame.c_str(), cloud.header.frame_id.c_str(), ex.what());
217 std::vector<observation::MeasurementReading>& observations)
225 observations.push_back(*it);
287 "%s buffer updated in %.2fs, it should be updated every %.2fs.",
void GetReadings(std::vector< observation::MeasurementReading > &observations)
pcl::PointCloud< pcl::PointXYZ >::Ptr _cloud
#define ROS_WARN_THROTTLE(rate,...)
void RemoveStaleObservations(void)
void BufferPCLCloud(const pcl::PointCloud< pcl::PointXYZ > &cloud)
double _vertical_fov_padding
pcl::PointCloud< pcl::PointXYZ >::Ptr point_cloud_ptr
bool UpdatedAtExpectedRate(void) const
void SetEnabled(const bool &enabled)
const ros::Duration _observation_keep_time
std::list< observation::MeasurementReading > _observation_list
void fromPCL(const pcl::uint64_t &pcl_stamp, ros::Time &stamp)
void ResetLastUpdatedTime(void)
static void quaternionTFToMsg(const Quaternion &bt, geometry_msgs::Quaternion &msg)
boost::recursive_mutex _lock
bool ClearAfterReading(void)
double _min_obstacle_height
void ResetAllMeasurements(void)
std::string _global_frame
bool _clear_buffer_after_reading
bool IsEnabled(void) const
tf::TransformListener & _tf
double _decay_acceleration
double _max_obstacle_height
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const tf::Transform &transform)
const ros::Duration _expected_update_rate
std::string _sensor_frame
void BufferROSCloud(const sensor_msgs::PointCloud2 &cloud)
MeasurementBuffer(const std::string &topic_name, const double &observation_keep_time, const double &expected_update_rate, const double &min_obstacle_height, const double &max_obstacle_height, const double &obstacle_range, tf::TransformListener &tf, const std::string &global_frame, const std::string &sensor_frame, const double &tf_tolerance, const double &min_d, const double &max_d, const double &vFOV, const double &vFOVPadding, const double &hFOV, const double &decay_acceleration, const bool &marking, const bool &clearing, const double &voxel_size, const bool &voxel_filter, const bool &enabled, const bool &clear_buffer_after_reading, const ModelType &model_type)
std::list< observation::MeasurementReading >::iterator readings_iter
void toPCL(const ros::Time &stamp, pcl::uint64_t &pcl_stamp)