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;