Ask Your Question

Change [velodyne] frame for gmapping

asked 2017-02-23 11:42:39 -0600

Bill5785 gravatar image

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.

edit retag flag offensive close merge delete


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.

nxydes gravatar image nxydes  ( 2017-02-23 19:06:53 -0600 )edit

@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?

Bill5785 gravatar image Bill5785  ( 2017-02-23 19:26:14 -0600 )edit

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

nxydes gravatar image nxydes  ( 2017-02-23 19:47:08 -0600 )edit

@nxydes Thanks, I will try

Bill5785 gravatar image Bill5785  ( 2017-02-23 20:27:06 -0600 )edit

@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?

Bill5785 gravatar image Bill5785  ( 2017-02-24 03:03:36 -0600 )edit

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:

nxydes gravatar image nxydes  ( 2017-02-24 12:39:02 -0600 )edit

@nxydes Oh, you are really helpful. If you want, you can write a formal answer and I will choose yours

Bill5785 gravatar image Bill5785  ( 2017-02-24 15:18:54 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-02-24 16:10:04 -0600

nxydes gravatar image

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

Now gmapping will provide map -> odom

Laser scan matcher will provide odom -> base_link

Utilizing the static base_link -> velodyne

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-02-23 11:42:39 -0600

Seen: 1,877 times

Last updated: Feb 24 '17