Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed in matching a PCD map created within a simulator with a Lanelet2 data created in real-world #1496

Closed
3 tasks done
sglee-morai opened this issue Aug 2, 2022 · 7 comments
Labels
component:localization Vehicle's position determination in its environment. (auto-assigned) component:map Map creation, storage, and loading. (auto-assigned) priority:high High urgency and importance. status:help-wanted Assistance or contributors needed.

Comments

@sglee-morai
Copy link

sglee-morai commented Aug 2, 2022

Checklist

Description

Basically, help from any member who is familiar with matching PCD data to lanelet2 data is needed to solve the following problem

A PCD map for ITRI Campus is created using MORAI SIM: Drive (Actually using AWSIM from TierIV as well).

I put the PCD map along with the original lanelet2 data in the same path.

When launching the Autoware using the command below, it is shown in the rviz that PCD data doesn't match the lanelet2 data. (It only shows PCD data. Lanelet2 data cannot be found)

ros2 launch autoware_launch autoware.launch.xml map_path:={the_path_including_pcd_map_and_lanelet2_data} vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

The picture below shows that the PCD data is not displayed on top of the lanelet2 data. (Note the PCD map here is only a partial one by the way)
image

When using PCD data created in the real-world instead, the PCD map and lanelet2 data match altogether correctly.
image

Purpose

This task is required to have an E2E simulator (either MORAI SIM: Drive or AWSIM) prepared for bus ODD development & testing.

Related Issues in the Simulation WG

Possible approaches

I'm guessing there must be a way to specify how to convert the PCD data onto the global coordinate system so that it can be matched onto the lanelet2 map.

I'm currently looking into map_loader package, but I cannot find one yet.

I know how to match this PCD data with the lanelet2 data theoretically, but I don't know how to let Autoware do that.

Here, the PCD data is described w.r.t. simulation map coordinate system whereas lanelet2 data is done so w.r.t. the global coordinate system. Therefore I believe the problem is simply specifying the projection for the map coordinate system.

FYI: Matching the ITRI map coordinate system (simulation) with the global coordinate system

Definition of done

When launching the Autoware using the command below, rviz should show PCD data on top of lanele2 data.

ros2 launch autoware_launch autoware.launch.xml map_path:={the_path_including_pcd_map_and_lanelet2_data} vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

@sglee-morai sglee-morai added status:help-wanted Assistance or contributors needed. priority:high High urgency and importance. component:map Map creation, storage, and loading. (auto-assigned) labels Aug 2, 2022
@sglee-morai sglee-morai added this to the Bus ODD July-Aug Milestone milestone Aug 2, 2022
@sglee-morai sglee-morai self-assigned this Aug 2, 2022
@sglee-morai sglee-morai added the component:localization Vehicle's position determination in its environment. (auto-assigned) label Aug 2, 2022
@sglee-morai sglee-morai removed their assignment Aug 2, 2022
@mitsudome-r
Copy link
Member

@sglee-morai If you would like to move pointcloud you can either use pcl_tools or CloudCompare

@VRichardJP
Copy link
Contributor

VRichardJP commented Aug 5, 2022

@sglee-morai If you would like to move pointcloud you can either use pcl_tools or CloudCompare

I second pcl-tools. In the past I had a similar issue: I created a lanelet2 map from JOSM (georeferenced) and had to match it on the PCD (which was not). You can use the following principle:

  1. Identify 2 points (or more) that are both on your lanelet and pcd. For each, find its global (latlon/mgrs/utm) and local (pcd) coordinates
  2. compute global and local coordinate of the center point
  3. compute average required rotation angle around the center point (stddev should be low). For example, something like:
rot = []
for p in pts:
  local_diff = p["local"] - center["local"]
  lobal_angle = atan2(local_diff.y, local_diff.x)
  global_diff = p["global"] - center["global"]
  global_angle = atan2(global_diff.y, global_diff.x)
  angle_diff = fmod((global_angle - local_angle) + pi, 2*pi) - pi
  rot.append(angle_diff)
avg_rot = np.mean(rot)
stddev_rot = np.std(rot)
  1. then run something like:
# change pcd origin to center point
pcl_transform_point_cloud src dst -trans -center_p["local"].x,-center_p["local"].y,0
# rotate pcd around the center point
pcl_transform_point_cloud dst dst -axisangle 0,0,1,avg_rot
# translate pcd back to match global coordinates
pcl_transform_point_cloud dst dst -trans center_p["global"].x,center_p["global].y,0
# eventually you may have to change the format to binary. You can do this with some python:
# pcl.save(pcl.load(input), output, binary=True)

Eventually double check that each point you used as referenced have been moved at the expected coordinate.

@sglee-morai
Copy link
Author

sglee-morai commented Aug 9, 2022

@mitsudome-r @VRichardJP Thanks a lot for providing highly detailed guidelines!

PCD map sample from the simulator & ITRI Campus Lanelet2 Map captured in the real-world campus

Here is a download link for the initial sample PCD map, created using MORAI SIM: Drive, that you might take a look at if you'd like.

Btw, the real-world lanelet2 data that I'm trying to match the PCD map to is the ITRI campus lanelet2 map uploaded in the CI/CD pipeline. (I believe I'm not able to share it publicly.)

Matching Result (Work-in-progress)

I'm currently trying it out and it seems like I'm almost there.

Due to some other issues, I wasn't able to follow the way that @VRichardJP has suggested yet, so far I just give a few numbers that look okay for now. That's why the matching doesn't seem accurate enough yet, which I'm going to work on this week and later.

Since I can create another PCD map, which looks much more similar to the real-world one than the current PCD map, I would like to create the map once again and then try matching them.

(The result so far 1): the real-world PCD map (blue) + PCD map from MORAI SIM: Drive, after roughly matching (red)

image

(The result so far 2): the PCD map from MORAI SIM (after roughly matched) + real-world lanelet2 data

image

@sglee-morai
Copy link
Author

sglee-morai commented Aug 16, 2022

[22-08-16] Update

Trying to test, but stuck at another issue (lidar driver)

I created some PCD maps and tried to do some testing before closing this issue.

For testing, I'm trying to run MORAI SIM: Drive with Autwoare to see whether localization is working fine, but I'm struggling in starting a lidar driver for Autoware.Universe

  • Velodyne models and Ouster models of the MORAI SIM: Drive send just like real-world sensors (Same UDP package)
  • I'm looking for how to run Velodyne driver and Ouster driver correctly for Autoware.Universe (FYI, for Autoware.Auto, the Velodyne driver was working fine)

Another Quick Question

Is it possible for a lanelet2 map for Autoware can have an arbitrary position (lat, lon) as the origin of the local map coordinate system? (NOT the origin of an MGRS system)

In other words, is there any way to specify georeference information as an arbitrary proj4 string (or something like UTM + offset value)?

@xmfcx
Copy link
Contributor

xmfcx commented Aug 16, 2022

https://github.com/tier4/velodyne_vls is being used in the Isuzu bus for velodyne driver.

@mitsudome-r
Copy link
Member

mitsudome-r commented Aug 16, 2022

Is it possible for a lanelet2 map for Autoware can have an arbitrary position (lat, lon) as the origin of the local map coordinate system? (NOT the origin of an MGRS system)

Yes.
You should be able to provide it as UTM origin by giving as a parameter to the loader with something similar to https://github.com/autowarefoundation/autoware.universe/blob/main/map/map_loader/config/lanelet2_map_loader.param.yaml

@sglee-morai
Copy link
Author

sglee-morai commented Aug 18, 2022

@xmfcx @mitsudome-r Thanks a lot for sharing!

I was following through how Autoware.Universe launches velodyne drivers, and I found this one: sample_sensor_kit_launch/launch/lidar.launch.xml

Is this the configuration file for lidar drivers when launching the Autoware using the autoware_launch/launch/autoware.launch.xml and sample_sensor_kit (the default value) is passed for sensor_model argument?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:localization Vehicle's position determination in its environment. (auto-assigned) component:map Map creation, storage, and loading. (auto-assigned) priority:high High urgency and importance. status:help-wanted Assistance or contributors needed.
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants