Created
July 15, 2021 19:09
-
-
Save michalpelka/a71cfec6fac6d9193ae88307d5452fe8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <ros/ros.h> | |
| #include <ros/subscriber.h> | |
| #include <ros/publisher.h> | |
| #include <pcl_ros/point_cloud.h> | |
| std::unique_ptr<ros::Publisher> publisher; | |
| void cloud_callback (const pcl::PointCloud<pcl::PointXYZI>& cloud_msg){ | |
| ROS_INFO("inside callback"); | |
| pcl::PointCloud<pcl::PointXYZI> cloud_out = cloud_msg; | |
| publisher->publish(cloud_out); | |
| } | |
| int main (int argc, char** argv) { | |
| ros::init (argc, argv, "cloud_sub"); | |
| ros::NodeHandle nh; | |
| ros::Rate loop_rate(10); | |
| ros::Subscriber sub; | |
| sub = nh.subscribe ("/livox/lidar", 1, cloud_callback); | |
| publisher = std::make_unique<ros::Publisher>(nh.advertise<pcl::PointCloud<pcl::PointXYZI>>("/livox/mirror", 1)); | |
| ros::spin(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment