pointcloud_to_laserscan , Can't transform pointcloud from frame error.

asked 2020-05-08 07:13:47 -0500

erdmhn gravatar image

updated 2020-05-08 14:55:35 -0500

Hi i am trying to transfrom PointCloud2 message from a lidar sensor to laserscan for using in hector_slam but when i launch the launch file and try to make rostopic echo for check it gives errors like these:

Can't transform pointcloud from frame velodyne to camera_link at time 1588865937.438738688, reason: 0

rostopic list shows that /sensor/lidar subscribed by pointcloud_to_laserscan

EDIT: /sensor/lidar (pointcloud2 )is publishing correctly but /sensor/lidarLaser (laserscan one) is not publishing

and rostopic echo /sensor/lidarLaser gives nothing

and here is my launch file: `

<node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan">

<remap from="cloud_in" to="/sensor/lidar"/>
<remap from="scan" to="/sensor/lidarLaser"/>
    target_frame: camera_link # Leave disabled to output scan in pointcloud frame
    transform_tolerance: 0.01
    min_height: 0.0
    max_height: 3.0

    angle_min: -1.5708 # -M_PI/2
    angle_max: 1.5708 # M_PI/2
    angle_increment: 0.0087 # M_PI/360.0
    scan_time: 0.3333
    range_min: 0.45
    range_max: 9.0
    use_inf: true
    inf_epsilon: 1.0

    # Concurrency level, affects number of pointclouds queued for processing and number of threads used
    # 0 : Detect number of cores
    # 1 : Single threaded
    # 2->inf : Parallelism level
    concurrency_level: 1


edit retag flag offensive close merge delete


So sensor/lidar is a pointcloud but rostopic echo sensor/lidar gives back nothing? In this case one would expect to get nothing out of pointcloud_to_laserscan. Why is the pointcloud not publishing? Be aware that with some Ros distros I had a problem with "spelling". As "rostopic echo /sensor/lidar" i s not the same as "rostopic echo sensor/lidar" note the missing "/". Next thing would be to print the tf tree -- rosrun tf view_frames -- and post the generated tf tree picture.

Dragonslayer gravatar image Dragonslayer  ( 2020-05-08 09:10:31 -0500 )edit

That error message seems to indicate a transform is missing, do you have a transform publisher setup for all the frame IDs (velodyne, camera_link, etc). I generally put these sorts of static transforms in a URDF and use the 'robot_state_publisher' node to publish/broadcast them (http://wiki.ros.org/robot_state_publi...)

KurtR gravatar image KurtR  ( 2020-05-08 09:16:26 -0500 )edit

no problem about /sensor/lidar pointcloud2 comes correctly. problem about /sensor/lidarLaser (laserscan one). Edited the question to be more understandable.

and i didnt understand about transform publisher? what is it? (Lidar is publishing at /sensor/lidar topic correctly as PointCloud2) Lidar data comes from a simulator (LGSVL) and it comes correctly.

erdmhn gravatar image erdmhn  ( 2020-05-08 14:53:17 -0500 )edit

If the sensors are producing data in different frames of reference (specified in the 'frame_id' portion of the message header), the relationship between the frames has to be established somehow. This is typically handled using ROS transforms (http://wiki.ros.org/tf). The 'robot_state_publisher' node linked above provides a mechanism to establish those relationships. It effectively tells ROS where sensors are relative to each other (x,y,z,roll,pitch,yaw).

KurtR gravatar image KurtR  ( 2020-05-08 15:23:59 -0500 )edit

"what is tf" - tf reference frames are the relevant parts of the robot. This parts are called "links" and they are connected to each other by "joints" (revolute, fixed, prismatic) Usually they build up from the base_link (=robot base, mounting plate etc.) and the other frames are then the links (parts) of the robot arm, or wheels, or sensors. You need this information to make sense of encoder and sensor data, so the robot can get a picture of itself in space. Specially in pointcloud to laserscan you want to know the hight of the sensor, so as to then chose at which level above the ground you want to generate the laserscan, or later then want to mark obstacles defined by hight. For all this you need to know what is the viewpoint of the pointcloud source, this viewpoint is the tf transform and the node gets it by ...(more)

Dragonslayer gravatar image Dragonslayer  ( 2020-05-09 08:49:31 -0500 )edit