@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.
Originally posted by Josh Whitley with karma: 1766 on 2020-07-06
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by JoloGermanAg on 2020-07-06:
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?
Comment by JoloGermanAg on 2020-07-06:
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 ?
Comment by JoloGermanAg on 2020-07-07:
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?
Comment by Josh Whitley on 2020-07-08:
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
?
Comment by JoloGermanAg on 2020-07-09:
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