lgsvl / simulator

A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
Other
2.29k stars 779 forks source link

How to Create Some Roads with empty Scenes ? #60

Closed johnny77lee closed 5 years ago

johnny77lee commented 5 years ago

Hi ,

I want to create a new scenes to do simple test for Apollo. After Create Terrain in a empty scenes , about create roads I just find the "SF_Roads" in "Assets/Meshes" of Unity Editor. But the "SF_Roads" seems a Prefabs about all of Roads for San Francisco .

Could you provide the document about "How to Create Roads to build a simple map(maybe just have a ring road map with 4 roads) " ? or Could you explain How to Create a Prefabs like "SF_Roads" ?

Thanks

EricBoiseLGSVL commented 5 years ago

Hello,

This is not a simple task unfortunately. We are currently working on a way to streamline the process for creating custom environments but it is still early in development.

Here is a outline of the steps needed at this time:

1) To build/load the new scene:

2) Create any fbx road type and import into Unity.

3) Drag fbx into the new scene, which turns blue in the Hierarchy panel

4) Create a folder in the Project panel to hold the new prefab. Drag new prefab from the Hierarchy panel into this folder in Project panel. This effectively saves a prefab in Unity.

5) In Hierarchy panel, select road prefab, root level. In the Inspector panel (top of panel), change tag to Road and Layer to Ground and Road. If asked to change children, hit yes and make sure all children are the same as the root (tag and layer). Hit Apply (top again). This saves the changes to the prefab.

6) Add Mesh Colliders to root/children of road prefab that have a Mesh Renderer component in the Inspector panel. Hit Apply again. Road prefab is now set.

/ I have not tested these steps below and may be missing something /

7) You need to add a few prefabs to your new scene: HDMapTool.prefab and Map.prefab

8) Map.prefab is going to be a reference for you to create your own HDMap data. Create a new prefab called "YourScene"Map.prefab. Save the prefab as you did with the road prefab.

9) Use Map.prefab as an example (you can duplicate the objects you need or just take from the Map.prefab but don't apply changes to the Map.prefab) and create the HDMap data for export to Apollo. Use the MapToolPanel (Access at Unity top menu Window -> Map Tool Panel) This is the HD Map tool Unity Editor to edit HDMaps.

10) Once your "YourScene"Map.prefab is done, apply changes, delete SF.scene Map.prefab (it's only reference to help and not needed)

11) Select HDMapTool.prefab that you added to scene, set ExportScaleFactor = 1, Proximity = 1, ArrowSize = 50, FolderName = hd_map, Filename = base_map and press Export HD Map button. Save map.txt file to base_map.txt and save in new folder with name of new map

12) Convert HDMap file https://github.com/lgsvl/apollo/blob/simulator/scripts/generate_map.sh Use the name of the new map. This generates Apollo readable files from the base_map.txt.

13) Make sure Apollo can read the files https://github.com/lgsvl/apollo/tree/simulator/modules/map/data

14) See our implementation of SanFrancisco.scene and map data if stuck

Also, drag in SingleRosConnection.prefab into scene if you want to test from the new scene in editor and connect a Ego prefab in the public field, just like SanFrancisco.scene. If there are nulls or other systems that are missing, let me know

-Eric

johnny77lee commented 5 years ago

Hi Eric ,

I have 2 question about "Create any fbx road type" ,

  1. Would you have any suggest tool to create fbx type road model ?
  2. What kind of tool you used to create SF_Roads ?

thanks

martins-mozeiko commented 5 years ago

FBX is file format for arbitrary 3D assets. All the roads, sidewalks and buildings you see are 3d assets created in external software such as Autodesk Maya, Autodesk 3ds Max or Blender. You can try to open Assets/Meshes/SF_Roads.FBX file in one of these software and check how does it look like, and/or modify it.

This is typical workflow in Unity for 3d objects - create/modify them in external software and then place them inside scene for rendering.

johnny77lee commented 5 years ago

Hi Martins-Mozeiko ,

Thanks for your response .

I try to use Eric's Step build a simple scene "test1" , it just have 4 Roads(2way2Lane of road) & every 2 road have a cross intersection .

After I create HD Map Data by " Map Tool Panel " and export to base_map.txt by "HDMapTool.prefab" , I could Covert it to Apollo HD Map data in Apollo side successful .

But when I connected simulator & Apollo by RosBridge , I could not found HD Map Info(Lane & StopLine ...) in DreamView after select map / vehicle & enable Localization Module(simulator side GPS & IMU is enabled & RosBridge no Error) .

Double check the rostopic "/apollo/localization/pose" & "/apollo/sensor/gnss/best_pose" seems workable .

So.....Could you provide "What kind of minimum parts of Apollo HD Map could work normally ?" or Would you have any idea about the root cause of this issue ?

Thanks

martins-mozeiko commented 5 years ago

@johnny77lee We have published information on how to do map annotation in our simulator here: https://www.lgsvlsimulator.com/docs/map-annotation/ Please check if you have done the steps listed there.

johnny77lee commented 5 years ago

@martins-mozeiko

Thanks for your document .

But After I follow your document to do the map annotation , I still have some question :

  1. In your document , Map Annotation about Traffic Light seems need to copy another exist "signal light" . But I wouldn't have any exist "signal light" in my scene , Could you provide the Information about "How to create 1'st Signal light ?"
  2. In the SF scene TrafficLight seems not a prefab object .I try to create a traffic light & use the same script to control it , but after finish the map annotation & export HD Map trafficlight trafficlight_inspector stopline_signallight

    , Apollo perception seems couldn't get the ROI of the traffic light stop_by_trafficlight . Would you provide the correctly Step about "How to create Traffic Light and annotate it in Apollo HD Map ? "

  3. In my scene , after I annotate some road with 2 way 4 Lane and annotate double yellow line between different way roads in apollo HD Map . But I found some roads with 2 "double yellow line" like 2_double_yellow_2 . Would you have any idea about to solved it ?

Thanks

martins-mozeiko commented 5 years ago
  1. Currently creating traffic lights requires at least one annotation already in in scene. This is something we are working to fix in next versions. For now you can save existing annotation object into prefab and then instantiate it into your new scene.

Basically do following: a) in SF scene find HDMapSignalLight under Map object in scene hierarchy b) drag it into project panel c) open your scene d) drag HDMapSignalLight prefab from project panel into scene hierarchy e) continue with annotation tool

  1. Can you check if your annotation on traffic light has correct boundary? This is what sets where Apollo will look for traffic light. See following screenshot - red arrows point to this boundary rectangle. image

Please also check if traffic light has Hint Stopline set to annotated stop line on opposite side of intersection.

  1. This is know issue with Apollo annotation. For now just set boundary type to single yellow line.
johnny77lee commented 5 years ago

@martins-mozeiko ,

Thanks for your Information , the traffic light seems work normally in my Scene & could be detect by Apollo now .

But I still have a question about the HD Map Annotation Tool :
As I know , HD Map Annotation Tool seems just support StopSign & TrafficLight of Road Object . If I want to add more Road Object to Apollo HD Map (ex. crosswalk , YieldSign , SpeedBumper ...) ,Is it supported by lgsvl Simulator ? How to Add it to HD Map ?

Thanks

ninjacoder0 commented 5 years ago

Thank you loads for this conv, this is exactly when I am trying to do. I am stuck on point 11.

"11. Select HDMapTool.prefab that you added to scene, drag the new "yourscene"map.prefab to the Targets list (should be the only one) and click Export HD Map."

Could you please explain this, I can not find this "Target list" and believe I have followed all of the previous steps correctly. Thanks again!!

EricBoiseLGSVL commented 5 years ago

@ninjacoder0

No problem, let's see if I can help. This convo is a little old and the code has been updated. Now the HDMapTool.cs looks for the MapManager.cs class automatically so it can create the annotation relationships and then export. Before, it required the object(s) ref. I'll update my previous post, thanks for finding this.

ninjacoder0 commented 5 years ago

@EricBoiseLGSVL Or possibly suggest creating a YouTube video on building a HD maps. Or a written list like above would be amazing too!

thanks for your help

EricBoiseLGSVL commented 5 years ago

@ninjacoder0 No problem. We plan on releasing a new simulator soon with updated documentation and features. Keep a look out for new videos and blog posts.

ninjacoder0 commented 5 years ago

@EricBoiseLGSVL When do you think you will release this new simulator?

Do you have any documentation for building HDmaps from Unity which are up-to-date? Thanks

EricBoiseLGSVL commented 5 years ago

@ninjacoder0 We are on feature freeze right now. We are testing and bug fixing as much as possible now but should be wrapping up this week or early next week. We have full documentation on the new Annotation Tool and videos to follow soon after.

martins-mozeiko commented 5 years ago

@ninjacoder0 We have released new version for our simulator: 2019.07-rc1 It includes much simpler annotation tool. See the new documentation here: https://www.lgsvlsimulator.com/docs/map-annotation/

We also provide simply Unity scene to show how to create very simple maps with annotations: https://github.com/lgsvl/SingleLaneRoad/

If you have any more questions feel free to open new issue.