cloud_accumulator.h
Go to the documentation of this file.
1 #define PCL_NO_PRECOMPILE
2 #include "cloud_visualizer.h"
3 #include <tf2_ros/buffer.h>
4 #include <deque>
5 #include <boost/thread/mutex.hpp>
6 #include <nav_msgs/Path.h>
7 #include <geometry_msgs/PoseStamped.h>
8 #include <geometry_msgs/TransformStamped.h>
9 #include <std_srvs/Empty.h>
10 #include <pcl_ros/point_cloud.h>
11 #include <pcl/point_types.h>
12 #include <pcl/point_cloud.h>
13 
14 typedef pcl::PointXYZRGB point_t;
15 typedef pcl::PointCloud<point_t> pointcloud_t;
16 
17 namespace rc
18 {
19 
25 {
26 
27  public:
28  CloudAccumulator(double voxelgrid_size_display,
29  double voxelgrid_size_save,
30  double min_distance,
31  double max_distance,
32  std::string output_filename,
33  bool keep_high_res,
34  bool start_paused);
35 
45  void pointCloudCallback(const pointcloud_t::ConstPtr& pointcloud);
46 
48  void trajectoryCallback(const nav_msgs::PathConstPtr& path);
49 
51  void poseCallback(const geometry_msgs::PoseStampedConstPtr& current_pose);
52 
59  pointcloud_t::Ptr rebuildCloud();
60 
65  bool saveCloud(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp);
66 
68  bool togglePause(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp);
69 
70  private:
71  Eigen::Affine3f lookupTransform(double timestamp);
72 
73  //Members
74  std::deque<pointcloud_t::Ptr> clouds_;
75  boost::mutex tf_buffer_mutex_;
77  size_t num_poses_;
78  boost::mutex display_cloud_mutex_;
79  pointcloud_t::Ptr display_cloud_;
82  double min_distance_;
83  double max_distance_;
84  std::string output_filename_;
86  bool pause_;
88  boost::thread viewer_thread_;
90 };
91 
92 }//namespace rc
CloudAccumulator(double voxelgrid_size_display, double voxelgrid_size_save, double min_distance, double max_distance, std::string output_filename, bool keep_high_res, bool start_paused)
void trajectoryCallback(const nav_msgs::PathConstPtr &path)
Replace all saved camera poses by those in path.
bool pause_
Whether to ignore input data.
void poseCallback(const geometry_msgs::PoseStampedConstPtr &current_pose)
Saves camera pose.
CloudVisualizer viewer_
tf2_ros::Buffer tf_buffer_
Stores the history of poses and allows to interpolate.
void pointCloudCallback(const pointcloud_t::ConstPtr &pointcloud)
For each cloud.
double voxelgrid_size_save_
Filter size for the saved cloud.
Displays one cloud using the PCLVisualizer.
boost::thread viewer_thread_
pointcloud_t::Ptr display_cloud_
Cloud that is displayed.
std::string output_filename_
Where to save the cloud.
std::deque< pointcloud_t::Ptr > clouds_
Storage for later corraection and saving.
double voxelgrid_size_display_
Filter size for the display cloud.
double min_distance_
Discard points closer than this.
boost::mutex display_cloud_mutex_
pcl::PointXYZRGB point_t
boost::mutex tf_buffer_mutex_
Eigen::Affine3f lookupTransform(double timestamp)
double max_distance_
Discard points farther than this.
Demonstration for how to create a registered point cloud map using the rc_visard. ...
pointcloud_t::Ptr rebuildCloud()
For all saved clouds.
bool saveCloud(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp)
size_t num_poses_
Keep track of pose count (to show a good error message)
bool togglePause(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp)
Toggle whether to ignore incoming data.
pcl::PointCloud< point_t > pointcloud_t
bool keep_high_res_
If false, do not store clouds. On save, save display cloud.


rc_cloud_accumulator
Author(s): Felix Endres
autogenerated on Thu Jun 6 2019 20:08:45