From f0a0536ded75b38356baf775ae849ede6c9bcc1b Mon Sep 17 00:00:00 2001 From: Louis-Guillaume DUBOIS Date: Fri, 26 Jun 2015 20:45:52 +0200 Subject: [PATCH] rm useless test programms --- src/pcl_displayer.cpp | 49 ----------------- src/random_pcl_publisher.cpp | 104 ----------------------------------- 2 files changed, 153 deletions(-) delete mode 100644 src/pcl_displayer.cpp delete mode 100644 src/random_pcl_publisher.cpp diff --git a/src/pcl_displayer.cpp b/src/pcl_displayer.cpp deleted file mode 100644 index 6f96468..0000000 --- a/src/pcl_displayer.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// a not very useful test tool -#include -#include -#include - -#include -#include -#include - -typedef pcl::PointCloud PointCloud; - -class Callback { - public: - void - operator()(const PointCloud::ConstPtr& msg) - { - std::ostringstream stream; - stream << "PointCloud published :" << std::endl; - for(int i = 0; i < msg->points.size(); ++i) - { - pcl::PointXYZRGB p = msg->points[i]; - stream << std::endl - << "point # " << i << std::endl - << "x : " << p.x << std::endl - << "y : " << p.y << std::endl - << "z : " << p.z << std::endl - << "r : " << (int) p.r << std::endl - << "g : " << (int) p.g << std::endl - << "b : " << (int) p.b << std::endl; - } - ROS_INFO("%s", stream.str().c_str()); - } -}; - - int -main(int argc, char** argv) -{ - ros::init(argc, argv, "pcl_displayer"); - ros::NodeHandle node; - - // initialisation - ros::Subscriber subscriber = node.subscribe("input", 1, Callback()); - - // démarrage - ROS_INFO("node started"); - ros::spin(); - ROS_INFO("exit"); - return 0; -} diff --git a/src/random_pcl_publisher.cpp b/src/random_pcl_publisher.cpp deleted file mode 100644 index ea40b53..0000000 --- a/src/random_pcl_publisher.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// a not very useful test programm -#include -#include -#include -#include -// for UniformGenerator -#include -// for CloudGenerator -#include - -typedef pcl::PointCloud PointCloud; -typedef pcl::common::UniformGenerator UGenerator; - -class Generator -{ - public: - Generator(int len, double m, double M) - : length(len), min(m), max(M), cgen(), number(0) - { - UGenerator::Parameters params(min, max, -1); - cgen.setParameters(params); - } - - PointCloud::Ptr - operator()() - { - PointCloud::Ptr pcl(new PointCloud()); - cgen.fill(length, length, *pcl); - for (int i = 0; i < pcl->points.size(); ++i) - { - pcl->points[i].r = (uint8_t) 175; - pcl->points[i].g = (uint8_t) 120; - pcl->points[i].b = (uint8_t) 118; - } - ros::Time now = ros::Time::now(); - pcl->header.stamp = now.toNSec() / 1000; - pcl->header.seq = number++; - pcl->header.frame_id = "0"; - return pcl; - } - - private: - pcl::common::CloudGenerator cgen; - int length; - double min, max; - uint32_t number; -}; - -int -main(int argc, char** argv) -{ - ros::init(argc, argv, "random_pcl_publisher"); - ros::NodeHandle node("random"); - // paramètres - double freq; - if (node.getParam("freq", freq)) - { - ROS_INFO("freq : %f" , freq); - } else { - node.setParam("freq", 10); - node.getParam("freq", freq); - ROS_INFO("freq : %f (default value)", freq); - } - double min, max; - if (node.getParam("min", min)) - { - ROS_INFO("min : %f" , min); - } else { - node.setParam("min", 0.); - node.getParam("min", min); - ROS_INFO("min : %f (default value)", min); - } - if (node.getParam("max", max)) - { - ROS_INFO("max : %f" , max); - } else { - node.setParam("max", 100.); - node.getParam("max", max); - ROS_INFO("max : %f (default value)", max); - } - int length; - if (node.getParam("length", length)) - { - ROS_INFO("length : %d" , length); - } else { - node.setParam("length", 10); - node.getParam("length", length); - ROS_INFO("length : %d (default value)", length); - } - // initialisation - ros::Publisher publisher = node.advertise("output", 1); - Generator generator(length, min, max); - ros::Rate loop_rate(freq); - ROS_INFO("node started"); - while (ros::ok()) - { - publisher.publish(generator()); - ROS_INFO("random PointCloud published"); - ros::spinOnce(); - loop_rate.sleep(); - } - ROS_INFO("exit"); - return 0; -}