Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

XML_commonRoad_XSD.xsd 12.7 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8"?>
Markus Koschi's avatar
Markus Koschi committed
2
<!--
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
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 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 242 243
  <!-- %%%%%%%%%%%%%%% auxiliary xsd elements %%%%%%%%%%%%%%% -->
  <!-- distance in meter (positive decimals) -->
  <xs:simpleType name="positiveDecimal">
    <xs:restriction base="xs:decimal">
      <xs:minExclusive value="0.0"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- 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>
  <xs:complexType name="decimalExactOrInterval">
    <xs:choice>
      <xs:element name="exact" type="xs:decimal"/>
      <xs:sequence>
        <xs:element name="intervalStart" type="xs:decimal"/>
        <xs:element name="intervalEnd" type="xs:decimal"/>
      </xs:sequence>
    </xs:choice>
  </xs:complexType>
  <!-- integer value exact zero -->
  <xs:complexType name="integerExactZero">
    <xs:all>
      <xs:element name="exact" type="integerZero"/>
    </xs:all>
  </xs:complexType>
  <xs:simpleType name="integerZero">
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="0"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- 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>
  </xs:complexType>
  <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>
  </xs:complexType>
  <!-- %%%%%%%%%%%%%%% auxiliary CommonRoad elements %%%%%%%%%%%%%%% -->
  <xs:complexType name="point">
    <xs:sequence>
      <xs:element name="x" type="xs:decimal"/>
      <xs:element name="y" type="xs:decimal"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="rectangle">
    <xs:sequence>
      <xs:element name="length" type="positiveDecimal"/>
      <xs:element name="width" type="positiveDecimal"/>
      <xs:element name="orientation" type="xs:decimal" minOccurs="0"/>
      <xs:element name="center" type="point" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="circle">
    <xs:sequence>
      <xs:element name="radius" type="positiveDecimal"/>
      <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>
  <xs:complexType name="positionExact">
    <xs:all>
      <xs:element name="point" type="point"/>
    </xs:all>
  </xs:complexType>
  <xs:complexType name="positionInterval">
    <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>
  <xs:complexType name="state">
    <xs:all>
      <xs:element name="position" type="position"/>
      <xs:element name="orientation" type="decimalExactOrInterval"/>
      <xs:element name="time" type="integerExactOrIntervalGreaterZero"/>
      <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>
  <xs:complexType name="initialState">
    <xs:all>
      <xs:element name="position" type="position"/>
      <xs:element name="orientation" type="decimalExactOrInterval"/>
      <xs:element name="time" type="integerExactZero"/>
      <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>
  <xs:complexType name="initialStateExact">
    <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"/>
      <xs:element name="time" type="integerExactZero"/>
      <xs:element name="acceleration" type="decimalExact" minOccurs="0"/>
    </xs:all>
  </xs:complexType>
  <xs:complexType name="goalState">
    <xs:all>
      <xs:element name="time" type="integerIntervalGreaterZero"/>
      <xs:element name="position" type="positionInterval" minOccurs="0"/>
      <xs:element name="orientation" type="decimalInterval" minOccurs="0"/>
      <xs:element name="velocity" type="decimalInterval" minOccurs="0"/>
    </xs:all>
  </xs:complexType>
  <xs:complexType name="occupancy">
    <xs:sequence>
      <xs:element name="shape" type="shape"/>
      <xs:element name="time" type="integerExactOrIntervalGreaterZero"/>
    </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"/>
      <xs:element name="speedLimit" type="xs:decimal" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:positiveInteger" 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"/>
      <xs:enumeration value="train"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="obstacle">
    <xs:sequence>
      <xs:element name="role" type="obstacleRole"/>
      <xs:element name="type" type="obstacleType"/>
      <xs:element name="shape" type="shape"/>
      <xs:element name="initialState" type="initialState"/>
      <xs:choice minOccurs="0">
        <xs:element name="trajectory">
          <xs:complexType>
Markus Koschi's avatar
Markus Koschi committed
244
            <xs:sequence>
245
              <xs:element name="state" type="state" maxOccurs="unbounded"/>
Markus Koschi's avatar
Markus Koschi committed
246
            </xs:sequence>
247 248 249 250
          </xs:complexType>
        </xs:element>
        <xs:element name="occupancySet">
          <xs:complexType>
Markus Koschi's avatar
Markus Koschi committed
251
            <xs:sequence>
252
              <xs:element name="occupancy" type="occupancy" maxOccurs="unbounded"/>
Markus Koschi's avatar
Markus Koschi committed
253
            </xs:sequence>
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="id" type="xs:positiveInteger" use="required"/>
  </xs:complexType>
  <!-- planning problem -->
  <xs:complexType name="planningProblem">
    <xs:sequence>
      <xs:element name="initialState" type="initialStateExact"/>
      <xs:element name="goalState" type="goalState" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:positiveInteger" use="required"/>
  </xs:complexType>
  <xs:complexType name="geoReference" mixed="true">
    <!-- mixed="true" allows text content AND elements like userData -->
  </xs:complexType>
  <xs:complexType name="additionalTransformation">
    <xs:sequence>
      <xs:element name="xTranslation" type="xs:decimal"/>
      <xs:element name="yTranslation" type="xs:decimal"/>
      <xs:element name="zRotation" type="xs:decimal"/>
      <xs:element name="scaling" type="positiveDecimal"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="geoTransformation">
    <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element name="geoReference" type="geoReference"/>
      <xs:element name="additionalTransformation" type="additionalTransformation"/>
    </xs:sequence>
  </xs:complexType>
  <!-- %%%%%%%%%%%%%%% root CommonRoad element %%%%%%%%%%%%%%% -->
  <xs:element name="commonRoad">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="geoTransformation" type="geoTransformation" minOccurs="0" maxOccurs="1"/>
        <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">
            <xs:enumeration value="2018b"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <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
308
    </xs:complexType>
309 310 311 312 313 314 315 316 317 318
    <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>