extract SensorMessages/LaserScan from SensorMessages/PointCloud2 created in simulation
Hello all,
This is my problem: v-rep publishes data from a simulated LMS100 in the form of SensorMessages/PointCloud2 on ROS, but i need SensorMessages/LaserScan. I have installed the pointcloud_to_laserscan package but it seems to be only for Kinect. I have no idea how to use it with pointcloud data already there(and not from Kinect).Can anyone help me with that please?
Thanks in advance.
you may just need to adjust some parameters. The pointcloud_to_laserscan essentially just takes a horizontal slice from the point cloud and makes that the "laser scan". The points in the point cloud could be out of that height range.
Thanks jdorich, but the problem is i have no idea how to use this pointcloud_to_laserscan package. So I wrote my own node which subscribes for pointclouds in vrep, #include "ros/ros.h" #include "std_msgs/String.h" #include <sensor_msgs pointcloud2.h=""> #include <sensor_msgs laserscan.h=""> /** * subscribe pointcloud from v-rep */ void cloudCallback(const sensor_msgs::PointCloud2::ConstPtr& Cloud) { ROS_INFO("Clouds Received"); } int main(int argc, char **argv) { ros::init(argc, argv, "cloudtoscan"); ros::NodeHandle n; ros::Subscriber cloud_sub = n.subscribe("/vrep/PointCloud2", 100, cloudCallback);
But from here i don't know how to write the program. I know how to change point data to angle data, but do not know how to do that in every single scan. Can u please help me with that?