main.cc
Go to the documentation of this file.
1 #define PCL_NO_PRECOMPILE
2 #include "cloud_accumulator.h"
3 #include <ros/ros.h>
4 
5 
6 int main(int argc, char **argv)
7 {
8  ros::init(argc, argv, "rc_cloud_accumulator");
10  ros::NodeHandle pnh("~");
11  std::string output_filename = pnh.param("output_filename", std::string("cloud.pcd"));
12  double downsampling_size_display = pnh.param("voxel_grid_size_display", 0.05);//0.0 or less: Off
13  double downsampling_size_save = pnh.param("voxel_grid_size_save", 0.01);//0.0 or less: Off
14  double min_distance = pnh.param("minimum_distance", 0.0);
15  double max_distance = pnh.param("maximum_distance", 5.0);
16  bool start_paused = pnh.param("start_paused", false);
17  bool keep_high_res = pnh.param("keep_high_resolution", true);
18 
19  rc::CloudAccumulator acc(downsampling_size_display, downsampling_size_save,
20  min_distance, max_distance,
21  output_filename, keep_high_res, start_paused);
22 
23  ros::Subscriber traj_sub;
24  if(keep_high_res)
25  {
26  traj_sub = nh.subscribe<nav_msgs::Path>("trajectory", 2,
28  }
29 
30  ros::Subscriber cloud_sub =
31  nh.subscribe<pointcloud_t>("stereo/points2", 1, &rc::CloudAccumulator::pointCloudCallback, &acc);
32 
33  ros::Subscriber pose_sub =
34  nh.subscribe<geometry_msgs::PoseStamped>("pose", 50, &rc::CloudAccumulator::poseCallback, &acc);
35 
36  ros::ServiceServer pause_srv =
37  pnh.advertiseService("toggle_pause", &rc::CloudAccumulator::togglePause, &acc);
38 
39  ros::ServiceServer save_srv =
40  pnh.advertiseService("save_cloud", &rc::CloudAccumulator::saveCloud, &acc);
41 
42  ros::AsyncSpinner spinner(4);//Async spinner, since the save_cloud service may take long
43  spinner.start();
45 }
void trajectoryCallback(const nav_msgs::PathConstPtr &path)
Replace all saved camera poses by those in path.
void poseCallback(const geometry_msgs::PoseStampedConstPtr &current_pose)
Saves camera pose.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void pointCloudCallback(const pointcloud_t::ConstPtr &pointcloud)
For each cloud.
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void spinner()
bool param(const std::string &param_name, T &param_val, const T &default_val) const
int main(int argc, char **argv)
Definition: main.cc:6
Demonstration for how to create a registered point cloud map using the rc_visard. ...
bool saveCloud(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp)
bool togglePause(std_srvs::Empty::Request &req, std_srvs::Empty::Request &resp)
Toggle whether to ignore incoming data.
pcl::PointCloud< point_t > pointcloud_t
ROSCPP_DECL void waitForShutdown()


rc_cloud_accumulator
Author(s): Felix Endres
autogenerated on Mon Jun 10 2019 14:34:34