ROS 订阅雷达信息却显示没订阅

背景

在做深度图转为虚拟激光雷达与激光雷达融合,需要同时订阅雷达和相机

问题

无论怎么改,都查不到订阅的雷达/laser_scan

解决方法

订阅代码:

ros::Subscriber laser_sub_ = pnh_.subscribe("/laser_scan", 10, DepthImageToLaserScanROS::laserCb,this); 

这句也不报错,但是没存储订阅的雷达信息
改为另一种方式订阅:

ros::Subscriber laser_sub_;
laser_sub_ = new ros::Subscriber(pnh_.subscribe<sensor_msgs::LaserScan>("/laser_scan", 10, &DepthImageToLaserScanROS::laserCb,this));

猜你喜欢

转载自blog.csdn.net/qq_41746268/article/details/116381712
今日推荐