XML_commonRoad_XSD.xsd 13 KB
Newer Older
Markus Koschi's avatar
Markus Koschi committed
1 2
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Markus Koschi's avatar
Markus Koschi committed
3 4 5 6 7 8 9 10 11
__author__ = "Markus Koschi"
__copyright__ = "TUM Cyber-Physical System Group"
__credits__ = ["BMW Group CAR@TUM"]
__version__ = "2018b"
__maintainer__ = "Markus Koschi"
__email__ = "Markus.Koschi@tum.de"
__status__ = "in development"

""" XSD for CommonRoad benchmark scenarios """
Markus Koschi's avatar
Markus Koschi committed
12 13 14 15
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<!-- %%%%%%%%%%%%%%% auxiliary xsd elements %%%%%%%%%%%%%%% -->
Markus Koschi's avatar
Markus Koschi committed
16
    <!-- distance in meter (positive decimals) -->
Markus Koschi's avatar
Markus Koschi committed
17
    <xs:simpleType name="distance">
Markus Koschi's avatar
Markus Koschi committed
18
        <xs:restriction base="xs:decimal">
Markus Koschi's avatar
Markus Koschi committed
19 20 21
            <xs:minExclusive value="0.0" />
        </xs:restriction>
    </xs:simpleType>
Markus Koschi's avatar
Markus Koschi committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
	
	<!-- decimal value: either exact or interval -->
	<xs:complexType name="decimalExact">
        <xs:all>
            <xs:element name="exact" type="xs:decimal" />
        </xs:all>
    </xs:complexType>
	
	<xs:complexType name="decimalInterval">
        <xs:sequence>
            <xs:element name="intervalStart" type="xs:decimal" />
			<xs:element name="intervalEnd" type="xs:decimal" />
        </xs:sequence>
    </xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
37
    <xs:complexType name="decimalExactOrInterval">
Markus Koschi's avatar
Markus Koschi committed
38
        <xs:choice>
Markus Koschi's avatar
Markus Koschi committed
39
            <xs:element name="exact" type="xs:decimal" />
Markus Koschi's avatar
Markus Koschi committed
40
            <xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
41 42
                <xs:element name="intervalStart" type="xs:decimal" />
                <xs:element name="intervalEnd" type="xs:decimal" />
Markus Koschi's avatar
Markus Koschi committed
43 44 45 46
            </xs:sequence>
        </xs:choice>
    </xs:complexType>

Markus Koschi's avatar
Markus Koschi committed
47 48 49 50 51 52 53
	<!-- integer zero -->
	<xs:simpleType name="integerZero">
		<xs:restriction base="xs:nonNegativeInteger">
			<xs:minInclusive value="0" />
			<xs:maxInclusive value="0" />
		</xs:restriction>
	</xs:simpleType>
Markus Koschi's avatar
Markus Koschi committed
54
	
Markus Koschi's avatar
Markus Koschi committed
55 56
	<!-- integer value exact zero -->
	<xs:complexType name="integerExactZero">
Markus Koschi's avatar
Markus Koschi committed
57
        <xs:all>
Markus Koschi's avatar
Markus Koschi committed
58
			<xs:element name="exact" type="integerZero" />	
Markus Koschi's avatar
Markus Koschi committed
59 60 61
        </xs:all>
    </xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
62 63 64 65 66 67
	<!-- integer value greater than zero: either exact or interval -->	
    <xs:complexType name="integerIntervalGreaterZero">
		<xs:sequence>
			<xs:element name="intervalStart" type="xs:nonNegativeInteger" />
			<xs:element name="intervalEnd" type="xs:positiveInteger" />
		</xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
68 69
    </xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
70 71 72 73 74 75 76 77
    <xs:complexType name="integerExactOrIntervalGreaterZero">
        <xs:choice>
            <xs:element name="exact" type="xs:positiveInteger" />
            <xs:sequence>
                <xs:element name="intervalStart" type="xs:nonNegativeInteger" />
                <xs:element name="intervalEnd" type="xs:positiveInteger" />
            </xs:sequence>
        </xs:choice>
Markus Koschi's avatar
Markus Koschi committed
78 79 80
    </xs:complexType>
	
	<!-- %%%%%%%%%%%%%%% auxiliary CommonRoad elements %%%%%%%%%%%%%%% -->
Markus Koschi's avatar
Markus Koschi committed
81 82
    <xs:complexType name="point">
        <xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
83 84
            <xs:element name="x" type="xs:decimal" />
            <xs:element name="y" type="xs:decimal" />
Markus Koschi's avatar
Markus Koschi committed
85 86 87 88 89 90 91
        </xs:sequence>
    </xs:complexType>
	
    <xs:complexType name="rectangle">
        <xs:sequence>
            <xs:element name="length" type="distance" />
            <xs:element name="width" type="distance" />
Markus Koschi's avatar
Markus Koschi committed
92
            <xs:element name="orientation" type="xs:decimal" minOccurs="0" />
Markus Koschi's avatar
Markus Koschi committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
            <xs:element name="center" type="point" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="circle">
        <xs:sequence>
            <xs:element name="radius" type="distance" />
            <xs:element name="center" type="point" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="polygon">
        <xs:sequence>
            <xs:element name="point" type="point" 
				minOccurs="3" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="shape">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="rectangle" type="rectangle" />
            <xs:element name="circle" type="circle" />
            <xs:element name="polygon" type="polygon" />
        </xs:choice>
    </xs:complexType>
	
	<xs:complexType name="position">
		<xs:choice>
			<xs:element name="point" type="point" />
			<xs:element name="rectangle" type="rectangle" maxOccurs="unbounded" />
			<xs:element name="circle" type="circle" maxOccurs="unbounded" />
			<xs:element name="polygon" type="polygon" maxOccurs="unbounded" />
			<xs:element name="lanelet" type="laneletRef" maxOccurs="unbounded" />
		</xs:choice>
	</xs:complexType>
Markus Koschi's avatar
Markus Koschi committed
128 129 130 131 132 133 134
	
	<xs:complexType name="positionExact">
		<xs:all>
			<xs:element name="point" type="point" />
		</xs:all>
	</xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
135
	<xs:complexType name="positionInterval">
Markus Koschi's avatar
Markus Koschi committed
136 137 138 139 140 141 142 143
		<xs:choice>
			<xs:element name="rectangle" type="rectangle" maxOccurs="unbounded" />
			<xs:element name="circle" type="circle" maxOccurs="unbounded" />
			<xs:element name="polygon" type="polygon" maxOccurs="unbounded" />
			<xs:element name="lanelet" type="laneletRef" maxOccurs="unbounded" />
		</xs:choice>
	</xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
144
	<xs:complexType name="state">
Markus Koschi's avatar
Markus Koschi committed
145
        <xs:all>
Markus Koschi's avatar
Markus Koschi committed
146
            <xs:element name="position" type="position" />
Markus Koschi's avatar
Markus Koschi committed
147
            <xs:element name="orientation" type="decimalExactOrInterval" />
Markus Koschi's avatar
Markus Koschi committed
148
            <xs:element name="time" type="integerExactOrIntervalGreaterZero" />
Markus Koschi's avatar
Markus Koschi committed
149 150 151 152 153
            <xs:element name="velocity" type="decimalExactOrInterval" minOccurs="0" />
            <xs:element name="acceleration" type="decimalExactOrInterval" minOccurs="0" />
			<xs:element name="yawRate" type="decimalExactOrInterval" minOccurs="0" />
			<xs:element name="slipAngle" type="decimalExactOrInterval" minOccurs="0" />
        </xs:all>
Markus Koschi's avatar
Markus Koschi committed
154 155
    </xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
156
	<xs:complexType name="initialState">
Markus Koschi's avatar
Markus Koschi committed
157 158
        <xs:all>
            <xs:element name="position" type="position" />
Markus Koschi's avatar
Markus Koschi committed
159
            <xs:element name="orientation" type="decimalExactOrInterval" />
Markus Koschi's avatar
Markus Koschi committed
160
            <xs:element name="time" type="integerExactZero" />
Markus Koschi's avatar
Markus Koschi committed
161 162 163 164 165 166 167
            <xs:element name="velocity" type="decimalExactOrInterval" minOccurs="0" />
            <xs:element name="acceleration" type="decimalExactOrInterval" minOccurs="0" />
			<xs:element name="yawRate" type="decimalExactOrInterval" minOccurs="0" />
			<xs:element name="slipAngle" type="decimalExactOrInterval" minOccurs="0" />
        </xs:all>
    </xs:complexType>
	
Markus Koschi's avatar
Markus Koschi committed
168
	<xs:complexType name="initialStateExact">
Markus Koschi's avatar
Markus Koschi committed
169 170 171 172 173 174
        <xs:all>
            <xs:element name="position" type="positionExact" />
			<xs:element name="velocity" type="decimalExact" />
            <xs:element name="orientation" type="decimalExact" />
			<xs:element name="yawRate" type="decimalExact" />
			<xs:element name="slipAngle" type="decimalExact" />
Markus Koschi's avatar
Markus Koschi committed
175
            <xs:element name="time" type="integerExactZero" />
Markus Koschi's avatar
Markus Koschi committed
176 177 178 179 180
        </xs:all>
    </xs:complexType>
	
	<xs:complexType name="goalState">
        <xs:all>
Markus Koschi's avatar
Markus Koschi committed
181
			<xs:element name="time" type="integerIntervalGreaterZero" />
Markus Koschi's avatar
Markus Koschi committed
182 183 184
            <xs:element name="position" type="positionInterval" minOccurs="0" />
            <xs:element name="orientation" type="decimalInterval" minOccurs="0" />
			<xs:element name="velocity" type="decimalInterval" minOccurs="0" />         
Markus Koschi's avatar
Markus Koschi committed
185 186 187 188 189 190
        </xs:all>
    </xs:complexType>
	
    <xs:complexType name="occupancy">
        <xs:sequence>
            <xs:element name="shape" type="shape" />
Markus Koschi's avatar
Markus Koschi committed
191
            <xs:element name="time" type="integerExactOrIntervalGreaterZero" />
Markus Koschi's avatar
Markus Koschi committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
        </xs:sequence>
    </xs:complexType>    

	<!-- %%%%%%%%%%%%%%% main CommonRoad elements %%%%%%%%%%%%%%% -->
	<!-- lanelet -->
    <xs:simpleType name="lineMarking">
        <xs:restriction base="xs:string">
            <xs:enumeration value="dashed" />
            <xs:enumeration value="solid" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="bound">
        <xs:sequence>
            <xs:element name="point" type="point"
                minOccurs="2" maxOccurs="unbounded" />
            <xs:element name="lineMarking" type="lineMarking"
                minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="laneletRef">
        <xs:attribute name="ref" type="xs:integer" use="required" />
    </xs:complexType>

    <xs:simpleType name="drivingDir">
        <xs:restriction base="xs:string">
            <xs:enumeration value="same" />
            <xs:enumeration value="opposite" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="laneletAdjacentRef">
        <xs:attribute name="ref" type="xs:integer" use="required" />
        <xs:attribute name="drivingDir" type="drivingDir"
            use="required" />
    </xs:complexType>

    <xs:complexType name="lanelet">
        <xs:sequence>
            <xs:element name="leftBound" type="bound" />
            <xs:element name="rightBound" type="bound" />
            <xs:element name="predecessor" type="laneletRef"
                minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="successor" type="laneletRef"
                minOccurs="0" maxOccurs="unbounded" />
            <xs:element name="adjacentLeft" type="laneletAdjacentRef"
				minOccurs="0" />
			<xs:element name="adjacentRight" type="laneletAdjacentRef"
				minOccurs="0" />
Markus Koschi's avatar
Markus Koschi committed
242
			<xs:element name="speedLimit" type="xs:decimal"
Markus Koschi's avatar
Markus Koschi committed
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
				minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="id" type="xs:integer" use="required" />
    </xs:complexType>
	
	<!-- obstacle -->
	<xs:simpleType name="obstacleRole">
        <xs:restriction base="xs:string">
            <xs:enumeration value="static" />
            <xs:enumeration value="dynamic" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="obstacleType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="unknown" />
            <!-- static -->
            <xs:enumeration value="parkedVehicle" />
            <xs:enumeration value="constructionZone" />
            <xs:enumeration value="roadBoundary" />
            <!-- dynamic -->
            <xs:enumeration value="car" />
            <xs:enumeration value="truck" />
            <xs:enumeration value="bus" />
            <xs:enumeration value="bicycle" />
            <xs:enumeration value="pedestrian" />
            <xs:enumeration value="priorityVehicle" />
Markus Koschi's avatar
Markus Koschi committed
270
            <xs:enumeration value="train" />
Markus Koschi's avatar
Markus Koschi committed
271 272 273 274 275 276 277
        </xs:restriction>
    </xs:simpleType>
	
    <xs:complexType name="obstacle">
        <xs:sequence>
            <xs:element name="role" type="obstacleRole" />
            <xs:element name="type" type="obstacleType" />
Markus Koschi's avatar
Markus Koschi committed
278 279
            <xs:element name="shape" type="shape" />
			<xs:element name="initialState" type="initialState" />
Markus Koschi's avatar
Markus Koschi committed
280 281 282 283
            <xs:choice minOccurs="0">
                <xs:element name="trajectory">
                    <xs:complexType>
                        <xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
284
                            <xs:element name="state" type="state" maxOccurs="unbounded" />
Markus Koschi's avatar
Markus Koschi committed
285 286 287 288 289 290
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="occupancySet">
                    <xs:complexType>
                        <xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
291
                            <xs:element name="occupancy" type="occupancy" maxOccurs="unbounded" />
Markus Koschi's avatar
Markus Koschi committed
292 293 294 295 296 297 298 299 300 301 302
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:sequence>
        <xs:attribute name="id" type="xs:integer" use="required" />
    </xs:complexType>

	<!-- planning problem -->
	<xs:complexType name="planningProblem">
        <xs:sequence>
Markus Koschi's avatar
Markus Koschi committed
303
			<xs:element name="initialState" type="initialStateExact" />
Markus Koschi's avatar
Markus Koschi committed
304 305
            <xs:element name="goalState" type="goalState" 
				minOccurs="1" maxOccurs="unbounded" />
Markus Koschi's avatar
Markus Koschi committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
        </xs:sequence>
        <xs:attribute name="id" type="xs:integer" use="required" />
    </xs:complexType>

	<!-- %%%%%%%%%%%%%%% root CommonRoad element %%%%%%%%%%%%%%% -->
    <xs:element name="commonRoad">
        <xs:complexType>
            <xs:sequence>
				<xs:element name="lanelet" type="lanelet"
                    minOccurs="1" maxOccurs="unbounded" />
                <xs:element name="obstacle" type="obstacle"
                    minOccurs="0" maxOccurs="unbounded" />
                <xs:element name="planningProblem" type="planningProblem"
                    minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute name="commonRoadVersion" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
Markus Koschi's avatar
Markus Koschi committed
324
                        <xs:enumeration value="2018b" />
Markus Koschi's avatar
Markus Koschi committed
325 326 327
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
Markus Koschi's avatar
Markus Koschi committed
328 329 330 331 332 333 334
            <xs:attribute name="benchmarkID" type="xs:string" use="required" />
            <xs:attribute name="date" type="xs:date" use="required" />
			<xs:attribute name="author" type="xs:string" use="required" />
			<xs:attribute name="affiliation" type="xs:string" use="required" />
			<xs:attribute name="source" type="xs:string" use="required" />
			<xs:attribute name="tags" type="xs:string" use="required" />
            <xs:attribute name="timeStepSize" type="xs:decimal" use="required" />
Markus Koschi's avatar
Markus Koschi committed
335 336 337 338 339 340 341 342 343 344 345
        </xs:complexType>
        <xs:key name="id">
            <xs:selector xpath="./*" />
            <xs:field xpath="@id" />
        </xs:key>
        <xs:keyref name="idref" refer="id">
            <xs:selector xpath=".//*" />
            <xs:field xpath="@ref" />
        </xs:keyref>
    </xs:element>
</xs:schema>