0
$\begingroup$

Rosanswers logo

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.


Originally posted by Yami on ROS Answers with karma: 1 on 2013-10-07

Post score: 0


Original comments

Comment by jdorich on 2013-10-07:
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.

Comment by Yami on 2013-10-07:
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);

Comment by Yami on 2013-10-07:
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?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I believe you can run the pointcloud_to_laserscan for any Sensor_msgs/PointCloud2 data by the following (in this case I've matched what you have put above for the vrep):

<launch>
  <!-- Fake Laser Standalone nodelet-->
  <node pkg="nodelet" type="nodelet" name="vrep_laser" args="standalone pointcloud_to_laserscan/CloudToScan" respawn="true">
    <param name="output_frame_id" value="/vrep_frame"/>
    <param name="min_height" value="-0.15"/>
    <param name="max_height" value="0.15"/>
    <remap from="cloud" to="/vrep/PointCloud2"/>
  </node> 

</launch>

Adjust the "output_frame_id", "min_height", and "max_height" as necessary for the vrep Sensor_msgs/PointCloud2 data.

This tutorial has information on nodelets and running standalone nodelets and this turtlebot file shows an example for how to run the pointcloud_to_laserscan nodelet. The code I have above follow these.

Hopefully this helps.


Originally posted by jdorich with karma: 211 on 2013-10-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Yami on 2013-10-09:
Thanks a lot jdorich . That is exactly what i looked for.

Comment by jdorich on 2013-10-10:
Great! See updated answer. I forgot that you could set standalone as an arg rather than loading a standalone nodelet manager.

Comment by Yami on 2013-10-10:
thanks again

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.