ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Transforming PointCloud topic to LaserScan topic

asked 2013-08-15 14:40:09 -0500

mozcelikors gravatar image

updated 2013-11-18 19:04:54 -0500

tfoote gravatar image

Hello there,

I have been trying to convert a PointCloud topic which is generated by gazebo_ros_openni_kinect into LaserScan topic. The gazebo plugin publishes a simulated openni output to /cam3d/depth/points topic, and it seems to work correctly.

I was able to inspect the code that pcl_to_scan package has, and managed to rebuilt it into a standalone working source file using the ros kinect publisher tutorials and disabling dynamic reconfigure. The file publishes some laser data. However, the laser data seems to decrease over time, and when it reaches 0, it starts over.

For example, when the data is first published: (Range values are around 0.8)

> angle_min: -1.57079637051 angle_max:
> 1.57079637051 angle_increment: 0.0174532923847 time_increment: 0.0 scan_time: 0.0333333350718 range_min:
> 0.10000000149 range_max: 10.0 ranges: [0.8371890783309937,
> 0.8371157646179199, 0.8371505737304688, 0.841155469417572, 0.8416852355003357, 0.8424785137176514, 0.7871079444885254, 0.7877516150474548, 0.7892191410064697, 0.7909254431724548, 0.7928680777549744, 0.7950447797775269, 0.7974526882171631, 0.8000890612602234, 0.8029510378837585, 0.8060353398323059, 0.8093387484550476, 0.8137710094451904, 0.8175548315048218, 0.8215464353561401, 0.8268224000930786, 0.831267774105072, 0.8370987176895142, 0.8419783115386963, 0.8483396172523499, 0.8549846410751343, 0.8604996800422668, 0.8676356673240662, 0.8750333786010742, 0.882685124874115, 0.892191469669342, 0.900374710559845, 0.9087872505187988, 0.9191746711730957, 0.9280658960342407, 0.939006507396698, 0.9502314925193787, 0.9617291688919067, 0.9734877347946167, 0.9875211715698242, 0.9998075366020203, 1.014427661895752, 1.0293407440185547, 1.0445315837860107, 1.0622141361236572, 1.0779519081115723, 1.0962239503860474, 1.1171224117279053, 1.1359834671020508, 1.157501220703125, 1.1817551851272583, 1.2038718461990356, 1.2287416458129883, 1.256429672241211, 1.2844353914260864, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0]

And after a while, it is like this: (Range values are ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-08-15 16:20:06 -0500

updated 2013-08-15 16:22:40 -0500

Why don't you just do something like this?

<launch>

<!-- Do whatever you need to do to publish /cam3d/depth/points -->



<!-- nodelet manager -->
  <node pkg="nodelet" type="nodelet" name="nodelet_manager" output="screen" respawn="true" args="manager"/>


<!-- throttling -->
  <node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle nodelet_manager" respawn="true">
    <param name="max_rate" value="20.0"/>
    <remap from="cloud_in" to="/cam3d/depth/points"/>
    <remap from="cloud_out" to="cloud_throttled"/>
  </node>

<!-- Fake Laser -->
  <node pkg="nodelet" type="nodelet" name="fake_laser" args="load pointcloud_to_laserscan/CloudToScan nodelet_manager" respawn="true">
    <param name="output_frame_id" value="/your_frame_id"/>
    <param name="min_height" value="-0.15"/><!-- Or any other value that suits you etter -->
    <param name="max_height" value="0.15"/><!-- Or any other value that suits you etter -->
    <remap from="cloud" to="/cloud_throttled"/>
  </node>

  <!-- Fake Laser (narrow one, for localization -->
  <node pkg="nodelet" type="nodelet" name="my_laser_narrow" args="load pointcloud_to_laserscan/CloudToScan nodelet_manager" respawn="true">
    <param name="output_frame_id" value="/your_frame_id"/>
    <param name="min_height" value="-0.025"/><!-- Or any other value that suits you etter -->
    <param name="max_height" value="0.025"/><!-- Or any other value that suits you etter -->
    <remap from="cloud" to="/cloud_throttled"/>
    <remap from="scan" to="/narrow_scan"/>
  </node>
</launch>

Although implementing your own version of pcl_to_scan might be a good programming exercise, I don't see why you need to do it that way, when you can just play with the tools provided by ROS. Just an opinion, I might have misunderstood your purpose. Cheers

edit flag offensive delete link more

Comments

I tried doing this but I cant get it working. Maybe I need some groundwork for it. How do I install the dependencies to use this launch file? You actually understood my purpose. I need to convert a pcl topic to laserscan. But can't use launch files that use openni, because I'm simulating openni with gazebo_ros_openni_kinect.

mozcelikors gravatar image mozcelikors  ( 2013-08-15 16:26:15 -0500 )edit

Okay, here is the error to the launch file that you've provided. I really need your help: [ERROR] [1376620187.308327378, 19.779000000]: Failed to load nodelet [/fake_laser] of type [pointcloud_to_laserscan/CloudToScan]: According to the loaded plugin descriptions the class pointcloud_to_laserscan/CloudToScan with base class type nodelet::Nodelet does not exist. Declared types are cmd_vel_mux/CmdVelMuxNodelet depth_image_proc/convert_metric depth_image_proc/disparity depth_image_proc/point_cloud_xyz depth_image_proc/point_cloud_xyzrgb depth_image_proc/register depthimage_to_laserscan/DepthImageToLaserScanNodelet image_proc/crop_decimate image_proc/debayer image_proc/rectify image_view/disparity image_view/image kobuki_auto_docking/AutoDockingNodelet kobuki_bumper2pc/Bumper2PcNodelet kobuki_controller_tutorial/BumpBlinkControllerNodelet kobuki_node/KobukiNodelet kobuki_safety_controller/SafetyControllerNodelet nodelet_tutorial_math/Plus openni_camera/driver pcl/BAGReader pcl/ExtractInd

mozcelikors gravatar image mozcelikors  ( 2013-08-15 16:30:46 -0500 )edit

I downloaded nodelet package and catkinized it, now I have this error: ERROR: cannot launch node of type [nodelet/nodelet]: can't locate node [nodelet] in package [nodelet]

mozcelikors gravatar image mozcelikors  ( 2013-08-15 16:46:42 -0500 )edit

which version of ros are you using? if you use groovy you can install the nodelet package with: sudo apt-get install ros-groovy-nodelet (but I think it should be already installed by default) I am looking into which package provides the nodelet pointcloud_to_laserscan, I will let you know asap

Martin Peris gravatar image Martin Peris  ( 2013-08-15 20:40:56 -0500 )edit

I'm using groovy. I have tried installing from source and package, Still can't get it working. What should I do?

mozcelikors gravatar image mozcelikors  ( 2013-08-16 02:33:49 -0500 )edit
3

This actually works. My package name and tf turned out to be faulty, and now they all are corrected. Accept my delayed gratitude.

mozcelikors gravatar image mozcelikors  ( 2013-08-23 11:56:04 -0500 )edit

@mozcelikors when i run launch file, i am getting same error. How did you solve it ?

bvbdort gravatar image bvbdort  ( 2014-01-28 21:47:32 -0500 )edit

please tell me how to convert laserscan to pointcloud with urg04lx laser scanner . Everyone tells me laser_geometry but how???

Mekateng gravatar image Mekateng  ( 2017-07-24 04:01:18 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-08-15 14:40:09 -0500

Seen: 2,427 times

Last updated: Jul 24 '17