From a78ad6ab5a99383c8111e9f7c66d12c2ed5e1a39 Mon Sep 17 00:00:00 2001 From: Louis-Guillaume DUBOIS Date: Wed, 22 Apr 2015 16:53:52 +0200 Subject: [PATCH] =?UTF-8?q?cr=C3=A9ation=20filtre=20passe-tout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hand_control/CMakeLists.txt | 4 +++- hand_control/src/filtre.cpp | 29 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/hand_control/CMakeLists.txt b/hand_control/CMakeLists.txt index 605d5d2..db4b01d 100644 --- a/hand_control/CMakeLists.txt +++ b/hand_control/CMakeLists.txt @@ -108,7 +108,9 @@ include_directories( # ) ## Declare a cpp executable -# add_executable(hand_control_node src/hand_control_node.cpp) +add_executable(filtre src/filtre.cpp) +target_link_libraries(filtre ${catkin_LIBRARIES}) +add_dependencies(filtre ${catkin_EXPORTED_TARGETS}) ## Add cmake target dependencies of the executable/library ## as an example, message headers may need to be generated before nodes diff --git a/hand_control/src/filtre.cpp b/hand_control/src/filtre.cpp index fa014d1..4e75676 100644 --- a/hand_control/src/filtre.cpp +++ b/hand_control/src/filtre.cpp @@ -2,27 +2,26 @@ #include #include -typedef pcl::PointCloud PointCloud; +typedef pcl::PointCloud PointCloud; -class Callback -{ +class Callback { public: - operator()(const PointCloud::Ptr& msg) - { - pub.publish(*msg); - } - + void operator()(const PointCloud::ConstPtr& msg) + { + // copie du nuage de point + PointCloud pcl = *msg; + // TODO : ôter les mauvais points + publisher.publish(pcl); + } Callback(ros::NodeHandle& node) - { - pub = node.advertise("output", 1); - } - + { + publisher = node.advertise("output", 1); + } private: - ros::Publisher pub; + ros::Publisher publisher; }; -int -main(int argc, char **argv) +int main(int argc, char** argv) { ros::init(argc, argv, "filtre"); ros::NodeHandle node;