Rosanswers logo

I have .pcap file collected from VLP16 and I first run

roslaunch velodyne_pointcloud VLP16_points.launch pcap:=/home/soowon/Documents/111.pcap

I can now see in RVIZ in fixed frame of [velodyne]

Then I use

rosrun pointcloud_to_laserscan pointcloud_to_laserscan_node cloud_in:=/velodyne_points

to convert to 2d laser scan.

and then record it as rosbag file.

But when I want to combine it with laser_scan_matcher and gmapping, the frame is always not correct.

I searched online and it seems that I should reset frame_id when doing the first step. But I don't know what to do in detail.

Originally posted by Bill5785 on ROS Answers with karma: 141 on 2017-02-23

Post score: 0

Original comments

Comment by nxydes on 2017-02-23:
Does your robot model currently have a frame for velodyne and its just under a different name? If you aren't publishing a frame for the velodyne it simply won't work and I highly suggest publishing a velodyne frame before changing the name. http://wiki.ros.org/robot_state_publisher

Comment by Bill5785 on 2017-02-23:
@nxydes I'm not using a robot. Thats why I want to use laser_scan_matcher to get tf from /map to /base_link I dont know what should I do in this case. Can you tell me?

Comment by nxydes on 2017-02-23:
Try this then, publish a static transform from base_link to velodyne of all 0's. Will effectively make velodyne frame the same as base_link: rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link velodyne

Comment by Bill5785 on 2017-02-23:
@nxydes Thanks, I will try

Comment by Bill5785 on 2017-02-24:
@nxydes It works, but the tf has some problem. It has two branches:

  1. map->odom
  2. map->base_link->velodyne Generally there should only be one line, right?

Comment by nxydes on 2017-02-24:
Seems that laser scan matcher is publishing map->base_link. You need to set its "world frame" to be odom so it publishes odom-> baselink. See 4.3.1: http://wiki.ros.org/laser_scan_matcher

Comment by Bill5785 on 2017-02-24:
@nxydes Oh, you are really helpful. If you want, you can write a formal answer and I will choose yours


1 Answer 1


Rosanswers logo

Publish a tf for base_link -> velodyne via either robot state publisher or just a simple tf broadcaster

 rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link velodyne

Make sure you set laser scan matcher "world frame" to be odom as in section 4.3.1 in http://wiki.ros.org/laser_scan_matcher

Now gmapping will provide map -> odom

Laser scan matcher will provide odom -> base_link

Utilizing the static base_link -> velodyne

Originally posted by nxydes with karma: 81 on 2017-02-24

This answer was ACCEPTED on the original site

Post score: 3


Your Answer

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