3. Carla导入openDRIVE地图
OpenDRIVE standalone mode
在其他為默認設置的情況下,將xodr格式文件導入到Carla中的方法可以總結為以下2步:
This feature allows users to ingest any OpenDRIVE file as a CARLA map out-of-the-box. In order to do so, the simulator will automatically generate a road mesh for actors to navigate through.
? Overview
? Run a standalone map
? Mesh generation
該功能允許用戶將任何OpenDRIVE文件作為即開即用的CARLA 地圖。為了做到這一點,模擬器將自動生成一個道路路網供車輛進行導航通過。
Overview(概述)
This mode runs a full simulation using only an OpenDRIVE file, without the need of any additional geometries or assets. To this end, the simulator takes an OpenDRIVE file and procedurally creates a temporal 3D mesh to run the simulation with.
此模式僅使用OpenDRIVE文件運行完整的模擬,而不需要任何其他幾何圖形或特性。為此,模擬器獲取一個OpenDRIVE文件并創建一個臨時的3D路網來進行仿真模擬。
產生的路網以極簡的方式描述道路的定義。所有元素都將與OpenDRIVE文件相對應,但除此之外,為了防止車輛從路上掉下來,采取了兩項措施。
The resulting mesh describes the road definition in a minimalistic manner. All the elements will correspond with the OpenDRIVE file, but besides that, there will be only void. In order to prevent vehicles from falling off the road, two measures have been taken.
? Lanes are a bit wider at junctions, where the flow of vehicles is most complex.
? Visible walls are created at the boundaries of the road, to act as a last safety measure.
? ?在車流最復雜的路口,車道要寬一些。
? ?在道路的邊界上創建了可見的墻,作為最后的安全措施。
Traffic lights, stops and yields will be generated on the fly. Pedestrians will navigate over the sidewalks and crosswalks that appear in the map. All of these elements, and every detail on the road, are based on the OpenDRIVE file. As the standalone mode uses the .xodr directly, any issues in it will propagate to the simulation. This could be an issue especially at junctions, where many lanes are mixed.
交通燈、停車和讓行標志將在飛行中產生。行人將行走在地圖中的人行道和人行橫道。所有這些元素以及道路上的每個細節,都是基于OpenDRIVE文件。由于獨立模式直接使用.xodr,因此其中的任何問題都會傳播到模擬中。這可能是一個問題,特別是在車道混合的交叉路口路段。
Important
It is especially important to double check the OpenDRIVE file. Any issues in it will propagate when running the simulation.
Run a standalone map(運行獨立地圖)
Open an OpenDRIVE file is just a matter of calling client.generate_opendrive_world() through the API. This will generate the new map, and block the simulation until it is ready. The method needs for two parameters.
只需通過API調用client.generate_opendrive_world()即可打開OpenDRIVE文件。這將生成新的映射,并阻塞模擬,直到準備好為止。該方法需要兩個參數。
? opendrive is the content of the OpenDRIVE file parsed as a string.
? parameters is a carla.OpendriveGenerationParameters containing settings for the generation of the mesh. This argument is optional.
?OpenDRIVE是被解析為字符串的OpenDRIVE文件的內容。
?參數是 carla.OpendriveGenerationParameters的一個參數,包含了生成路網的相關設置。這個參數是可選的。
o vertex_distance (default 2.0 meters) — Distance between the vertices of the mesh. The bigger, the distance, the more inaccurate the mesh will be. However, if the distance is too small, the resulting mesh will be too heavy to work with.
頂點間的距離:(默認2.0米)-路網頂點之間的距離。距離越大,路網就越不準確。然而,如果距離太小,產生的路網就會太重而無法處理。
o max_road_length (default 50.0 meters) — Maximum length of a portion of the mesh. The mesh is divide in portions to reduce rendering overhead. If a portion is not visible, UE will not render it. The smaller the portions, the more probably they are discarded. However, if the portions are too small, UE will have too many objects to manage, and performance will be affected too.
最大道路長度:(默認為50.0米)-路網部分的最大長度。路網被分成若干部分以減少渲染開銷。如果部分不可見,UE將不渲染它。分量越小,就越有可能被丟棄。但是,如果這些部分太小,UE就會有太多的對象需要管理,性能也會受到影響。
o wall_height (default 1.0 meters) — Height of the additional walls created on the boundaries of the road. These prevent vehicles from falling to the void.
墻的高度:(默認1.0米),在道路邊界上創建的附加墻體的高度。這樣可以防止車輛掉到空中。
o additional_width (default 0.6 meters, 0.3 on each side) — Small width increment applied to the junction lanes. This is a safety measure to prevent vehicles from falling.
額外的寬度:(默認為0.6米,每邊0.3米),應用于交叉口車道的小寬度增量。這是防止車輛墜落的安全措施。
o smooth_junctions (default True) — If True, some information of the OpenDRIVE will be reinterpreted to smooth the final mesh at junctions. This is done to prevent some inaccuracies that may occur when various lanes meet. If set to False, the mesh will be generated exactly as described in the OpenDRIVE.
平滑鏈接:(默認為真),如果為True, OpenDRIVE的一些信息將被重新編譯以平滑最終的路網鏈接。這樣做是為了防止在不同的車道相遇時發生一些不準確的情況。如果設置為False,路網將完全按照OpenDRIVE中描述的那樣生成
o enable_mesh_visibility (default True) — If False, the mesh will not be rendered, which could save a lot of rendering work to the simulator.
啟用路網的可見性:(默認為真),如果為False,路網將不會被渲染,這可以為模擬器節省很多渲染工作。
In order to easily test this feature, the config.py script in PythonAPI/util/ has a new argument, -x or --xodr-path. This argument expects a string with the path to the .xodr file, such as path/example.xodr. If the mesh is generated with this script, the parameters used will always be the default ones.
為了方便地測試這個特性,PythonAPI/util/中的config.py腳本有一個新的參數-x或——xord -path。這個參數需要一個帶有.xodr文件路徑的字符串,比如path/example.xodr。如果路網是用這個腳本生成的,使用的參數將始終是默認的。
這個功能可以用CARLA提供的新TownBig來測試。
This feature can be tested with the new TownBig provided by CARLA.
python3 config.py -x opendrive/TownBig.xodr
Important
client.generate_opendrive_world() uses content of the OpenDRIVE file parsed as string. On the contrary, config.py script needs the path to the .xodr file.
Mesh generation(路網的生成)
The generation of the mesh is the key element of this mode. The feature can only be successful if the resulting mesh is smooth and fits its definition perfectly. For that reason, this step is constantly being improved. In the last iterations, junctions have been polished to avoid inaccuracies that occur, especially where uneven lanes joined.
路網的生成是該模式的關鍵。只有最終得到的路網平滑且完美地符合其定義,該特征才能成功。因此,這一步驟正在不斷得到改進。在最后的迭代中,路口已經被拋光,以避免出現不準確,特別是在不均勻的車道連接。
When generating junction meshes, higher lanes tend to block the ones below them. The parameter smooth_junctions prevents this kind of issue.
在生成結點網格時,較高的車道往往會阻塞較低的車道。參數smooth_junction防止了這類問題。
Besides that, instead of creating the whole map as a unique mesh, different portions are created. By dividing the mesh, the simulator can avoid rendering portions that are not visible, and save up costs. Working smaller also allows to generate huge maps and contain issues that may occur on a small portion of the mesh.
除此之外,不是創建整個地圖作為一個獨特的網格,而是創建不同的部分。通過劃分網格,模擬器可以避免渲染不可見的部分,并節省成本。更小的工作也允許產生巨大的地圖和包含問題,可能發生在網格的一小部分。
對于當前網格生成的狀態,需要考慮一些問題。
Regarding the current state of the mesh generation, some considerations should be taken into account.
? Junction smoothing. The default smoothing prevents the issues at tilted junctions described above. However, it will modify the original mesh in the process. Set smooth_junctions to False to disable the smoothing if preferred.
? 連接平滑。默認的平滑防止了上面描述的傾斜節點的問題。但是,它會在這個過程中修改原來的網格。將“平滑節點”設置為False可以禁用平滑效果。
? 橫向坡度。這個特性目前還沒有集成到CARLA中。
? Lateral slope. This feature is currently not integrated in CARLA.
? 人行道高度。目前,所有人行道的贏編碼都是一樣的。人行道必須高于道路水平,才能檢測到碰撞,但RoadRunner不會將此值導出到OpenDRIVE文件。高度是硬編碼的,以保證碰撞。
? Sidewalk height. This is currently hard-coded for all the sidewalks the same. Sidewalks must be higher than the road level for collisions to be detected, but RoadRunner does not export this value to the OpenDRIVE file. The height is hard-coded to guarantee collisions.
That covers all there is to know so far, regarding the OpenDRIVE standalone mode. Take the chance and use any OpenDRIVE map to test it in CARLA.
這涵蓋了到目前為止關于OpenDRIVE獨立模式的所有知識。抓住機會,使用任何OpenDRIVE地圖在Carla中測試它。
總結
以上是生活随笔為你收集整理的3. Carla导入openDRIVE地图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: eclipse语言包安装后如何进行英语中
- 下一篇: 计算机控制系统第二章答案,计算机控制技术