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

Revision history [back]

click to hide/show revision 1
initial version

Hello,

As @tfoote says, the first thing you need to do is remap the scan topic to the one where the laser data is being published in your simulation. Here you have an example launch file (where the Hokuyo data is published into the /kobuki/laser/scan topic):

<launch>
  <node pkg="laser_assembler" type="laser_scan_assembler" output="screen"  name="laser_scan_assembler">
    <remap from="scan" to="/kobuki/laserscan"/>
    <param name="tf_cache_time_secs" type="double" value="10.0" />
    <param name="max_scans" type="int" value="400" />
    <param name="ignore_laser_skew" type="bool" value="true" />
    <param name="fixed_frame" type="string" value="odom" />
  </node>
</launch>

Also, the output provided by the laser_scan_assembler node is given through services, so you will need to perform a call to that service in order to get the Pointcloud data associated to your laser readings. Here you have an example code that does that:

#!/usr/bin/env python

import rospy 
from laser_assembler.srv import *
from sensor_msgs.msg import PointCloud2

rospy.init_node("client_test")
rospy.wait_for_service("assemble_scans2")
assemble_scans = rospy.ServiceProxy('assemble_scans2', AssembleScans2)
pub = rospy.Publisher ("/pointcloud", PointCloud2, queue_size=1)
r = rospy.Rate (1)

while not rospy.is_shutdown():
    try:
        resp = assemble_scans(rospy.Time(0,0), rospy.get_rostime())
        print "Got cloud with %u points" % len(resp.cloud.data)
        pub.publish (resp.cloud)

    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

    r.sleep()

So basically, what this code does is to perform calls to the /assemble_scan2 service, which provides the PointCloud2 data, and then publish this data into a topic, in order to visualize it through RViz.

I have also created this video whith the whole process which I think it may help you understand it better.

Hello,

As @tfoote says, the first thing you need to do is remap the scan topic to the one where the laser data is being published in your simulation. case. Here you have an example launch file (where the Hokuyo data is published into the /kobuki/laser/scan topic):

<launch>
  <node pkg="laser_assembler" type="laser_scan_assembler" output="screen"  name="laser_scan_assembler">
    <remap from="scan" to="/kobuki/laserscan"/>
    <param name="tf_cache_time_secs" type="double" value="10.0" />
    <param name="max_scans" type="int" value="400" />
    <param name="ignore_laser_skew" type="bool" value="true" />
    <param name="fixed_frame" type="string" value="odom" value="base_link" />
  </node>
</launch>

Also, the output provided by the laser_scan_assembler node is given through services, so you will need to perform a call to that service in order to get the Pointcloud data associated to your laser readings. Here you have an example code that does that:

#!/usr/bin/env python

import rospy 
from laser_assembler.srv import *
from sensor_msgs.msg import PointCloud2

rospy.init_node("client_test")
rospy.wait_for_service("assemble_scans2")
assemble_scans = rospy.ServiceProxy('assemble_scans2', AssembleScans2)
pub = rospy.Publisher ("/pointcloud", PointCloud2, queue_size=1)
r = rospy.Rate (1)

while not rospy.is_shutdown():
    try:
        resp = assemble_scans(rospy.Time(0,0), rospy.get_rostime())
        print "Got cloud with %u points" % len(resp.cloud.data)
        pub.publish (resp.cloud)

    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

    r.sleep()

So basically, what this code does is to perform calls to the /assemble_scan2 service, which provides the PointCloud2 data, and then publish this data into a topic, in order to visualize it through RViz.

I have also created this video whith the whole process which I think it may help you understand it better.

Hello,

As @tfoote says, the first thing you need to do is remap the scan topic to the one where the laser data is being published in your case. Here you have an example launch file (where the Hokuyo data is published into the /kobuki/laser/scan topic):

<launch>
  <node pkg="laser_assembler" type="laser_scan_assembler" output="screen"  name="laser_scan_assembler">
    <remap from="scan" to="/kobuki/laserscan"/>
    <param name="tf_cache_time_secs" type="double" value="10.0" />
    <param name="max_scans" type="int" value="400" />
    <param name="ignore_laser_skew" type="bool" value="true" />
    <param name="fixed_frame" type="string" value="base_link" />
  </node>
</launch>

Also, the output provided by the laser_scan_assembler node is given through services, so you will need to perform a call to that service in order to get the Pointcloud data associated to your laser readings. Here you have an example code that does that:

#!/usr/bin/env python

import rospy 
from laser_assembler.srv import *
from sensor_msgs.msg import PointCloud2

rospy.init_node("client_test")
rospy.wait_for_service("assemble_scans2")
assemble_scans = rospy.ServiceProxy('assemble_scans2', AssembleScans2)
pub = rospy.Publisher ("/pointcloud", PointCloud2, queue_size=1)
r = rospy.Rate (1)

while not rospy.is_shutdown():
    try:
        resp = assemble_scans(rospy.Time(0,0), rospy.get_rostime())
        print "Got cloud with %u points" % len(resp.cloud.data)
        pub.publish (resp.cloud)

    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

    r.sleep()

So basically, what this code does is to perform calls to the /assemble_scan2 service, which provides the PointCloud2 data, and then publish this data into a topic, in order to so you can, for instance, visualize it through in RViz.

I have also created this video whith the whole process which I think it may help you understand it better.