OpenScenario是驾驶仿真领域中描述动态参与者的标准,结合OpenCRG、OpenDrive可以呈现较为完整的自动驾驶方针场景。
动机:如图1所示,提供一套场景标准普遍适用于自动驾驶仿真工具以满足各个主机厂、研究机构的需求。
图1
OpenScenario计划有的产出:Test Tool、Validation Tools、Test Data、Support/Website、Format Specification。从官网的信息来看,目前提供了Format Specification的信息。
图2
OpenSCENARIO_0.9.1 版本的specification format为最新版本。对于FileHeader、ParameterDeclaration、Catalogs、RoadNetwork、Entities、Storyboard、Catalog进行了标准规范。OSCTypeDefs为对于各个模块进行说明。此文件的作用为对于编写OpenScenario
的代码进行说明规范。
图3
OpenScenario的代码也是根据以上几个模块进行编写的。例如:
图4
接下来对于各个模块进行说明:
一、 FileHeader: 由OSCFileHeader标准定义。OSCFileHeader在OSCTyepDefs目录下。
OSCFileHeader里面定义了FileHeader的标准:需要包含recMajor、revMinor、date、description、author等内容。
图5
例子:
<FileHeader revMajor="0" revMinor="9" date="2017-07-26T10:00:00" description="Sample Scenario - Double Lane Changer" author="Andreas Biehn"/>
二、 ParameterDeclaration: 由OSCParameterDeclaration标准定义。但在官网给出的例子中,ParameterDeclaration部分均没有说明。
图6
例子:<ParameterDeclaration/>
三、 Catalogs: 分为VehicleCatalog、DriverCatalog、PedestrianCatalog、PedestrianControllerCatalog、MisObjectCatalog、EnvironmentCatalog、ManeuverCatalog、TrajectoryCatalog、RouteCatalog组成。由OSCDictionary标准定义,指引到path。
图7
例子:
<Catalogs>
<VehicleCatalog>
<Directory path="Catalogs/VehicleCatalogs"/>
</VehicleCatalog>
</Catalogs>
四、 RoadNetwork: 分为以下几项。 OSCFile将指引到filepath。
图8
例子:
<RoadNetwork>
<Logics filepath="SampleDatabase_01.xodr"/>
<SceneGraph filepath="SampleDatabase_01.opt.osgb"/>
</RoadNetwork>
【SampleDatabase_01】为OpenScenario提供的一份关于道路信息的文件。
五、 Entities: Entity由Object组成。Object需要对name、Controller、choice进行定义。
图9
- name定义此Object的名字
- 选择Object的CatalogReference:对于CatalogReference的定义由标准OSCCaralogReference规定,由catalogName、entryName和Parameter Assignment定义。在catalogName中选择Vehicle、Pedestrian、MiscObject,在entryName中输入此种catalog的某个名字。例如选择VehicleCatalog为catalogName,entryName可以选择AudiA3_blue_147kW。 AudiA3_blue_147kW的性能可以根据OSCVehicle标准进行定义。
图10
图11 - 然后对此Object选择Controller,同样根据CatalogReference进行选择,输入catalogName和entryName。例如选择DriverCatalog为catalogName,entryName可以选择DefaultDriver。
图12
例子:
<Entities>
<Object name="Ego">
<CatalogReference catalogName="VechicleCatalog" entryName="AudiA3_blue_147kW"/>
<Controller>
<CatalogReference catalogName="DriverCatalog" entryName="DefaultDriver"/>
</Controller>
</Object>
</Entities>
六、 Storyboard:StoryBoard由三部分组成,Init、Story、EndConditions。
图13
- Init:对于Object最开始的状态进行定义,可以选择Global、UserDefined、Private。例如选择Private,然后选择在Entities定义的Object,再定义此Object的初始Action。例如选择Ego为Object,定义Action的标准参见OSCPrivateAction,对需要定义的内容进行定义。例如用Longitudinal对初始状态进行定义。
图14
图15
例子:
<Init>
<Actions>
<Private object="Ego">
<Action>
<Longitudinal>
<Speed>
<Dynamics shape="step"/>
<Target>
<Absolute value="3.6111111111111107e+01"/>
</Target>
</Speed>
</Longitudinal>
</Action>
</Private>
</Actions>
</Init>
- 进行Story的编写:定义story的名字(name)、主人公(owner)。然后定义这个故事要进行的动作(act)。Act由sequence和condition组成,Sequence为这个动作的内容,condition为这个动作发生的时间。
图16
例子:
<Story name="MyStory" owner="A1">
<Act name="MyAct">
2.1 Sequence: Sequence由以下几项构成。
图17
例子:<Sequence name="MySequence" numberOfExecutions="1">
2.1.1 Actors为执行此动作的对象。例如为这个故事的主人公:
<Actors>
<Entity name="$owner"/>
</Actors>
2.1.2 Maneuver为动作内容,通过OSCManeuver标准进行定义。
OSCManeuver定义如图:由name、parameterDeclaration、event组成。Event由name、priority、action、startcondition组成。Action为这个event的动作,startcondition为这个event 的开始条件。
图18
例子:
<Maneuver name="MyDoubleLaneChangeManeuver">
<Event name="MyLaneChangeRightEvent" priority="overwrite">
Action 有Private、Global、UserDefined之分。例如选择private的action。定义这个action的动作由OSCPrivateAction标准规范。例如在PrivateAction里面选择’Lateral’ 的‘LaneChange’。根据条件需要对参数进行赋值。
图19
图20
例子:
<Action name="MyLaneChangeRightAction">
<Private>
<Lateral>
<LaneChange>
<Dynamics shape="sinusoidal" time="2"/>
<Target>
<Relative object="$owner" value="-1"/>
</Target>
</LaneChange>
</Lateral>
</Private>
</Action>
StartCondition由OSCCondition标准进行定义。例如通过ByEntity对StartCondition进行定义。则需要对TriggeringEntities和condition进行定义。
图21
图22
例子:
<StartConditions>
<ConditionGroup>
<Condition name="MyStartCondition1" delay="0" edge="rising">
<ByEntity>
<TriggeringEntities rule="any">
<Entity name="$owner"/>
</TriggeringEntities>
<EntityCondition>
<Distance value="5.0000000000000000e+00" freespace="false" alongRoute="false" rule="greater_than">
<Position>
<RelativeObject object="Ego" dx="0.0000000000000000e+00" dy="0.0000000000000000e+00"/>
</Position>
</Distance>
</EntityCondition>
</ByEntity>
</Condition>
</ConditionGroup>
</StartConditions>
2.2 对Act发生的Conditon进行定义。Condition的执行标准与StartConditon一样,为OSCConditionGroup。
图23
例子:
<Conditions>
<Start>
<ConditionGroup>
<Condition name="" delay="0" edge="rising">
<ByValue>
<SimulationTime value="0" rule="equal_to"/>
</ByValue>
</Condition>
</ConditionGroup>
</Start>
</Conditions>
以上为对于OpenScenario Specification的调研。Specification就如同在定义Scenario的大纲和字典,使得场景的定义能够完成。在场景定义中最重要的时间是定义Story. OpenScenario官网给出了几个例子。这几个例子举了大致的书写规则,完整的书写规则需要参见Specification。
Example 1: simple steering command
storyboard
Story: owner = Ego
act 1: condition = simTime>2s
sequence 1.1:actor = $owner
maneuver 1.1.1: name = start driving
event 1.1.1: condition = upon start of act
action 1.1.1.1.1: apply throttle at 0.4
sequence 1.2:actor = $owner
maneuver 1.2.1: name = apply steering torque
event 1.2.1.1: condition = 10s after start of act
action 1.2.1.1.1: set throttle to 0.0
action 1.2.1.1.2: apply 2.0Nm torque to steering wheel
Example2: two lane changes in front of Ego vehicle, 3-lane motorway
【TTC】Time to Collision, 碰撞时间
Example 3: two lane changes in front of Ego vehicle, 3-lane motorway+ emergency brake
Example 4: Lane change right/left
Example 5: Overtaking
Example 6: Traffic Jam and Corridor
场景库举例
中国汽车技术研究中心有限公司数据资源中心
数据库的建设重要步骤:场景数据格式、虚拟仿真工具链与测试用例评价体系
虚拟场景数据的分类:
- 自然驾驶场景
- 危险工况场景
- 法律规范场景
- 参数重组场景
百度Apollo场景库:https://github.com/ApolloAuto/apollo/releases/tag/v2.5.0
Worldsim:由人为预设的 障碍物行为和交通灯状态构成的场景,可以简单高效的测试自动驾驶车辆,但缺 乏真实交通环境中复杂的情况
Logsim:由路测数据提取的场景,提供复杂多变 的障碍物行为和交通状况,使场景充满不确定性。
目前提供约200个场景,包括:
基于不同的路型,包括十字路口、调头、直行、三叉路口、弯道。
基于不同的障碍物类型,包括行人、机动车、非机动车及其他。
基于不同的道路规划,包括直行、调头、变道、左转、右转、并道。
基于不同的红绿灯信号,包括红灯、黄灯、绿灯。
51VR51Sim-One 案例库
51VR仿真平台案例库支持来自真实采集的危险工况和人工编辑的标准案例。 目前提供的场景包括:
基于不同的路型,包括直道、十字路口、弯道、调头、环岛、人行横道等。
基于不同的障碍物类型,包括行人、机动车、非机动车,静态物体等。
基于不同的道路规划,包括直行、突然插入,变道、转弯、并道, 超车, 靠边停车等。
基于不同的红绿灯信号,限速牌,停车牌等
GitHub上关于OpenScenario的资源:
https://github.com/esmini/esmini
https://github.com/carla-simulator/scenario_runner
https://github.com/OpenRCT2/OpenScenarios
https://github.com/MrMushroom/CarlaScenarioLoader
https://github.com/AndreaTagliavini/OpenScenario-scenarioGen
https://github.com/mhct/OpenScenario
https://github.com/fcagroupj/OpenScenario
https://github.com/matthewcoyle-cpc/esmini-visualiser