LaserScanToPointCloud(ros::NodeHandle n) : n_(n), laser_sub_(n_, "/robot_1/base_scan", 10), laser_notifier_(laser_sub_,listener_, "/robot_1/base_link", 10) { laser_notifier_.registerCallback( boost::bind(&LaserScanToPointCloud::scanCallback, this, _1)); laser_notifier_.setTolerance(ros::Duration(0.01)); scan_pub_ = n_.advertise<sensor_msgs::PointCloud>("/my_cloud",1); }
TrajGenerator(ros::NodeHandle nh) : nh_(nh), people_sub_(nh_,"people_tracker_measurements",10), people_notifier_(people_sub_,tfl_,fixed_frame,10) { people_notifier_.registerCallback(boost::bind(&TrajGenerator::peopleCallback, this, _1)); people_notifier_.setTolerance(ros::Duration(0.01)); markers_pub_ = nh_.advertise<visualization_msgs::Marker>("visualization_marker", 20); }
LaserScanReceiver(ros::NodeHandle node, std::string tf, std::string topic) : n(node), base_tf(tf), laser_topic(topic), laser_sub(n, topic, 10), laser_notifier(laser_sub,listener, tf, 10) { laser_notifier.registerCallback(&LaserScanReceiver::scanCallback, this); laser_notifier.setTolerance(ros::Duration(0.2)); laser_count = 0; pcl_pub = node.advertise<sensor_msgs::PointCloud>("laser_pcl",1); }
//Nodelet initialization virtual void onInit() { ros::NodeHandle& nh = getNodeHandle(); ros::NodeHandle& private_nh = getPrivateNodeHandle(); private_nh.getParam("min_height", min_height_); private_nh.getParam("max_height", max_height_); private_nh.getParam("base_frame", baseFrame); private_nh.getParam("laser_frame", laserFrame); NODELET_INFO("CloudToScanHoriz min_height: %f, max_height: %f", min_height_, max_height_); NODELET_INFO("CloudToScanHoriz baseFrame: %s, laserFrame: %s", baseFrame.c_str(), laserFrame.c_str()); //Set up to process new pointCloud and tf data together cloudSubscriber.subscribe(nh, "cloud_in", 5); tfFilter = new tf::MessageFilter<PointCloud>(cloudSubscriber, tfListener, laserFrame, 1); tfFilter->registerCallback(boost::bind(&CloudToScanHoriz::callback, this, _1)); tfFilter->setTolerance(ros::Duration(0.05)); laserPublisher = nh.advertise<sensor_msgs::LaserScan>("laserScanHoriz", 10); };
ScanToPointCloud2For2Lasers(ros::NodeHandle n) : _nodeHandle(n), target_frame("/rotary_base"), _laser_sub(_nodeHandle, "/scan",300), _laser_tfMessagefilter(_laser_sub, _tfListener, "/laser", 300), producedPcdCount(0), maxToProducePcdCount(5), bRunning(true), isSkipThisCloud(true), // set it to true to skip the first cloud _the_last_1st_yaw(0), _the_last_2nd_yaw(0) { _laser_tfMessagefilter.setTolerance(ros::Duration(0.1)); _laser_tfMessagefilter.registerCallback(boost::bind(&ScanToPointCloud2For2Lasers::scanCallback, this, _1)); _scan_pub = _nodeHandle.advertise<sensor_msgs::PointCloud2> ("/cloud", 100); std::stringstream pid; pid << getpid(); pcd_prefix = pid.str(); }