finally, after much fucking headache I got it to successfully publish pcl data through a ROS messanger. The main fristration came from the fact that sensor_msgs::Pointcloud2 is depricated, and toROSMsg is depricated, so we instead have to use pcl::toPCLPointCloud2, and we have to convert our point clouds into a PCLPointcloud2 type, which is a type of message that ROS can use. Also, we had to include
. Also we had to changet he type of data we are publishing from Pointcloud2 to PCLPointCloud2 inside the advertise call in startPublishing