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

How to make tf file for pcd/vector map

asked 2020-07-06 12:11:29 -0500

JoloGermanAg gravatar image


how do you make the tf file for use in the PCD maps? Is this the first line of the PCD file or what is it in relation to?

It seems that whenever I upload the PCD it is far away from the actual rosbag data.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-07-06 15:05:47 -0500

Josh Whitley gravatar image

@JoloGermanAg This is usually accomplished by having a static_transform_publisher publish a static transform between the frame of the PCD map and the frame of the vector map. It is most common that the PCD will have an origin which is at the location where the PCD recording started and that the vector map has an origin in a specific Japanese Plane Rectangular CS or other global coordinate system origin (like 0, 0, 0 latitude, longitude, and altitude). To get them to line up, you need to calculate the location of the PCD map's origin in the vector map's coordinate system (in meters) and enter them in a launch file like this:

<node pkg="tf" type="static_transform_publisher" name="pcd_to_vector" args="0 0 0 0 0 0 pcd_frame vector_frame 100" />

In the above, replace 0 0 0 0 0 0 with the coordinates of the PCD map's origin in the vector map's frame in x y z roll pitch yaw, replace pcd_frame with the frame of the published PCD map, and replace vector_frame with the frame of the published vector map. 100 is the frequency in Hz at which the transform will be published.

edit flag offensive delete link more


Ok I see, I used the MaptToolbox in Unity to create the ADASMap which gives me several .csv files. How do i find the origin in those? They are the same format as the online tierIV vector map builder as far as I can tell but which of those files contains the origin. Additionally, when I try using the TierIV map builder i get errors saying: ApplicationError: Imported point cloud has different grid-zone from Application. but i used the PCD origin as input for a lat/long to MGRS converter. I assume that the first GPS point in my rosbag that was used to create the PCD would be the origin for the PCD map correct?

JoloGermanAg gravatar image JoloGermanAg  ( 2020-07-06 16:44:27 -0500 )edit

well, I used the default values for MGRS and it worked fine - weird but I apparently don't understand the MGRS format haha. Either way, when i download the lanelet2 map in the .osm type it shows the gps data almost correct. It's off by about a mile which i am not sure where that comes from. Would that difference then be put in as the xyz tf ?

JoloGermanAg gravatar image JoloGermanAg  ( 2020-07-06 22:01:25 -0500 )edit

Just as update, using 0 0 0 0 0 0 for the tf launch resulted in having both the pcd and vector map as well as lanelet2map aligned. The only issue I have now is that the points_raw do not align at all (they are in the same location but do not follow the map). Is this a tf issue?

JoloGermanAg gravatar image JoloGermanAg  ( 2020-07-07 15:33:49 -0500 )edit

There are several things that could be causing this but it depends on a lot. Are you using rviz to visualize the points and the map? Is localization working? What fixed frame are you using in rviz? Is there a valid TF from the frame of your points_raw data to base_link?

Josh Whitley gravatar image Josh Whitley  ( 2020-07-08 21:59:20 -0500 )edit

Now that i am thinking about it, i didn't run any nodes for localization. The rosbag has the gps data ... I guess i could run either fix2tfpose or nmea2tfpose, or ndt_matching. I'll give you an update once i get it up! Thanks for all your help!

And yes - using rviz. Fixed frame is /world if i am not mistaken but i am sure the issue was localization unless there is another step i am missing to ensure a tf between base_link and world

JoloGermanAg gravatar image JoloGermanAg  ( 2020-07-09 11:31:34 -0500 )edit

Question Tools

1 follower


Asked: 2020-07-06 12:11:29 -0500

Seen: 819 times

Last updated: Jul 06 '20