Go to the documentation of this file.00001 #define PCL_NO_PRECOMPILE
00002 #include "cloud_accumulator.h"
00003 #include <ros/ros.h>
00004
00005
00006 int main(int argc, char **argv)
00007 {
00008 ros::init(argc, argv, "rc_cloud_accumulator");
00009 ros::NodeHandle nh;
00010 ros::NodeHandle pnh("~");
00011 std::string output_filename = pnh.param("output_filename", std::string("cloud.pcd"));
00012 double downsampling_size_display = pnh.param("voxel_grid_size_display", 0.05);
00013 double downsampling_size_save = pnh.param("voxel_grid_size_save", 0.01);
00014 double min_distance = pnh.param("minimum_distance", 0.0);
00015 double max_distance = pnh.param("maximum_distance", 5.0);
00016 bool start_paused = pnh.param("start_paused", false);
00017 bool keep_high_res = pnh.param("keep_high_resolution", true);
00018
00019 rc::CloudAccumulator acc(downsampling_size_display, downsampling_size_save,
00020 min_distance, max_distance,
00021 output_filename, keep_high_res, start_paused);
00022
00023 ros::Subscriber traj_sub;
00024 if(keep_high_res)
00025 {
00026 traj_sub = nh.subscribe<nav_msgs::Path>("trajectory", 2,
00027 &rc::CloudAccumulator::trajectoryCallback, &acc);
00028 }
00029
00030 ros::Subscriber cloud_sub =
00031 nh.subscribe<pointcloud_t>("stereo/points2", 1, &rc::CloudAccumulator::pointCloudCallback, &acc);
00032
00033 ros::Subscriber pose_sub =
00034 nh.subscribe<geometry_msgs::PoseStamped>("pose", 50, &rc::CloudAccumulator::poseCallback, &acc);
00035
00036 ros::ServiceServer pause_srv =
00037 pnh.advertiseService("toggle_pause", &rc::CloudAccumulator::togglePause, &acc);
00038
00039 ros::ServiceServer save_srv =
00040 pnh.advertiseService("save_cloud", &rc::CloudAccumulator::saveCloud, &acc);
00041
00042 ros::AsyncSpinner spinner(4);
00043 spinner.start();
00044 ros::waitForShutdown();
00045 }