From c36ff5a5aa95234e90c96999dbeabed73e1850a2 Mon Sep 17 00:00:00 2001 From: Louis-Guillaume DUBOIS Date: Thu, 30 Apr 2015 17:30:53 +0200 Subject: [PATCH] correct bad inequality --- src/filtre.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/filtre.cpp b/src/filtre.cpp index fca30d7..1249544 100644 --- a/src/filtre.cpp +++ b/src/filtre.cpp @@ -10,27 +10,21 @@ class Callback { void operator()(const PointCloud::ConstPtr& msg) { - ROS_INFO("PointCloud received"); - // pour publier un shared_ptr (mieux) PointCloud::Ptr pcl(new PointCloud()); - // filtrage - double zmax(0.); - ros::param::getCached("/filtre/zmax", zmax); - ROS_INFO("zmax : %f", zmax); for (int i = 0; i < msg->points.size(); ++i) { - if (msg->points[i].z > zmax) + if (msg->points[i].z < zmax) pcl->points.push_back(msg->points[i]); } - // publication publisher.publish(pcl); - ROS_INFO("PointCloud published"); } - Callback(ros::Publisher& pub) : publisher(pub) {} + Callback(ros::Publisher& pub, float z) + : publisher(pub), zmax(z) {} private: ros::Publisher publisher; + float zmax; }; int @@ -50,9 +44,9 @@ main(int argc, char** argv) ROS_INFO("zmax : %f (default value)", zmax); } - // initialisation + // initialisatio ros::Publisher publisher = node.advertise("output", 1); - Callback callback(publisher); + Callback callback(publisher, (float) zmax); ros::Subscriber subscriber = node.subscribe("input", 1, callback); // démarrage