Roadrunner: Specifying type and sub-type through OpenDriveAssetData.xml not working

8 vues (au cours des 30 derniers jours)
Aravindhan Mani
Aravindhan Mani le 4 Déc 2020
Commenté : Johannes le 24 Mai 2023
In my scene file I have added a signal using "Auto Signalze" and chose "4-way protected left". After exporting to xodr I see the name field is empty, type field has "1000001" for few roads and "1000011" for few of them in the same junction. Also the subtype field is not consistent. I also read the documentation about OpenDriveAssetData.xml, but it doesn't work. Attached is this file (modifed extention to txt).
Questions
  1. With my current setup where does these numbers "1000001", etc are carried from?
  2. How to provide my own numbers for types and sub-types?
  3. How to populate the name field?
Using VectorZero RoadRunner 2019.2.12 (build 5161c15)
Thanks

Réponses (1)

John Pallag
John Pallag le 1 Juil 2021
1. Each RoadRunner project folder has a few sub folders: Assets, Exports, Project, Scenes.
In the Project folder, there is an OpenDriveAssetData.xml file. If one does not already exist, you can copy the one provided in the install location ResourceAssets and place it there.
For exporting signals, a <Signal> entry is required in the <Signals> section. Given this is a 4-way protected left intersection, you should likely have the following <Signal> entries:
<Signal>
<Type>1000001</Type>
<Variant>0</Variant>
<FilePath>Props/Signals/Signal_3Light_Post01.fbx</FilePath>
</Signal>
<Signal>
<Type>1000011</Type>
<SubType>10</SubType>
<Variant>1</Variant>
<FilePath>Props/Signals/Signal_3Light_Post01.fbx</FilePath>
</Signal>
<Signal>
<Type>1000011</Type>
<SubType>20</SubType>
<Variant>2</Variant>
<FilePath>Props/Signals/Signal_3Light_Post01.fbx</FilePath>
</Signal>
Be sure to check the <FilePath> to ensure the path, name, and extension are matching the signal you are using.
2. The "type" value corresponds to the <Type> entry and the "subtype" corresponds to the <SubType> entry.
3. The exported "name" value is always set to the file name of the asset. The <Name> field for <Object> or <Signal> entries in the OpenDriveAssetData.xml file is used during import of OpenDRIVE data.
  2 commentaires
Johannes
Johannes le 24 Mai 2023
Does someone has a file which includes all the types and the sub types for each sign?
Johannes
Johannes le 24 Mai 2023
I created a Python script to create this file. However, in OpenDRIVE you can als define the following attributes
value="100"
unit="km/h"
That doesn't seem to work here:
import os
import re
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
# Specify the folder path
folder_path = "Signs/Germany"
# Create the root element for the XML tree
root = ET.Element("Signals")
# Recursively traverse the folder and its subfolders
for root_folder, _, filenames in os.walk(folder_path):
for filename in filenames:
if filename.startswith("Sign_") and filename.endswith(".svg_rrx"):
name = os.path.splitext(filename)[0]
# Extract the type and subtype from the filename
match = re.search(r"Sign_([^()]+)(?:\((\d+)\))?", name)
if match:
file_type = match.group(1)
file_subtype = match.group(2) if match.group(2) else None
# Remove any trailing period from the type
file_type = file_type.rstrip(".")
else:
file_type = filename.split("_")[1].split(".")[0]
file_subtype = None
# Create the Signal element
signal_elem = ET.SubElement(root, "Signal")
# Create the Type element and set its text
type_elem = ET.SubElement(signal_elem, "Type")
type_elem.text = file_type
# Create the SubType element and set its text if available
if file_subtype:
subtype_elem = ET.SubElement(signal_elem, "SubType")
subtype_elem.text = file_subtype
if file_type.startswith("27"):
unit_elem = ET.SubElement(signal_elem, "Unit")
unit_elem.text = "km/h"
value_elem = ET.SubElement(signal_elem, "Value")
value_elem.text = file_subtype
# Create the FilePath element and set its text
file_path_elem = ET.SubElement(signal_elem, "FilePath")
file_path_elem.text = os.path.join(root_folder, filename).replace("\\", "/")
# Create the XML tree
tree = ET.ElementTree(root)
# Create a string representation of the XML tree
xml_str = ET.tostring(root, encoding="utf-8")
# Parse the string and create a pretty-printed version
dom = minidom.parseString(xml_str)
pretty_xml_str = dom.toprettyxml(indent=" ")
# Save the pretty-printed XML to a file
xml_file_path = "output.xml"
with open(xml_file_path, "w") as xml_file:
xml_file.write(pretty_xml_str)
print("XML file created successfully!")

Connectez-vous pour commenter.

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by