云服务器内容精选

  • 触发器与触发条件 Trigger and condition 用户可以使用wait+触发条件的方式来设置动作的触发条件condition ,可以使用的触发条件有: elapsed 、 object_distance、 point_distance 、time_to_collision、 time_headway 、 speed ,和acceleration . 如果不满足等待时长或触发条件,后续动作将无法执行. 使用wait来设定触发条件condition时,必须在serial:下执行,否则wait无效. 触发条件 elapsed 触发条件 object_distance 触发条件 point_distance 触发条件 time_to_collision 触发条件 time_headway 触发条件 speed 触发条件 acceleration 父主题: 代码样例 Code Examples
  • 车辆和控制器(Vehicle and controller) 通过车辆名: vehicle的方式来为车辆命名。通过keep(it.name == 指定车型名称)的方式来指定车辆类型。通过keep(it.initial_bm == 指定controller名称)的方式来指定controller类型,目前均只能支持仿真器A或仿真器B内置的车辆和controller类型。生成文件会自动适配车辆信息。 name,initial_bm等车辆属性需要在仿真器的catalog列表中定义,不同仿真器的预定义的catalog内容有所不同,需要在撰写场景文件时确认使用的车型、controller名称在仿真器catalog中已经存在。 name为必选项,initial_bm非必选项。 主车必须命名为Ego,否则仿真器A/仿真器B将无法识别。 例1(仿真器A):主车,指定initial_bm Ego_name: string = "Audi_A3_2009_black" Ego_controller: string = "DefaultDriver" Ego: vehicle with: keep(it.name == Ego_name) keep(it.initial_bm == Ego_controller) 例2(仿真器A):非主车,不指定initial_bm cut_in_vehicle: vehicle with: keep(it.name == "Audi_A3_2009_red") 例3(仿真器B):主车,指定initial_bm cut_in_vehicle: vehicle with: keep(it.name == "Saimo") keep(it.initial_bm == "默认驾驶员") 例4(仿真器B):非主车,不指定initial_bm cut_in_vehicle: vehicle with: keep(it.name == "Saimo")
  • 行人(Pedestrian) 通过行人名: person的方式来为行人命名。通过keep(it.name == 指定行人名称)的方式来指定行人类型。通过keep(it. model == 指定行人特征)的方式来指定行人的性别、年龄特征。行人的name和model同样只能使用仿真器A自带的类型。 样例 Dude: person with: keep(it.name == "Christian") keep(it.model == "male_adult")
  • 动作(lane_offset) 动作主体:车辆vehicle 结束时间:当动作主体actor到达目标偏移offset处时,动作结束。 是否支持modifier:否 参数:参数如下表,支持位置参数和关键字参数。参数target非必选项,不设置target时采用绝对偏移,设置target时采用相对偏移。 表7 lane_offset参数 Parameter Type Mandatory Description offset length yes Signed number in meters the vehicle should respect as an offset from the center of the current lane rate_peak speed yes Target value for the peak lateral velocity that must be achieved during the action dynamics_shape dynamics_shape yes Geometrical shape of the LaneOffsetAction's dynamics target entity no Reference entity offset值不能超出当前所在lane的宽度范围。 绝对偏移 m_shape: dynamics_shape = step Ego.lane_offset(0.8m, 0.5mps, m_shape) 相对偏移 m_shape: dynamics_shape = linear side_vehicle.lane_offset(offset:1.0m, rate_peak: 1.5mps, dynamics_shape:m_shape, target: Ego)
  • 动作(acquire_position) 动作主体:车辆vehicle或行人pedestrian。 结束时间:当动作主体actor获取目标位置position时,动作结束。 是否支持modifier:否 参数表: 参数如下表,pose_3d是point和orientation的组合结构, point可以使用xyz_point或odr_point或road_point中的任意一个,orientation非必选项。 表8 acquire_position参数 Parameter Type Mandatory Description target pose_3d yes target position acquire_position与acquire_position_init的使用方法相同,但由于不是初始动作,可以设置触发条件。 仿真器A对于acquire_position_init的支持程度更好,如无需设置触发条件,建议使用acquire_position_init。 仿真器B尚未支持acquire_position动作。 代码样例见初始动作(acquire_position_init)。
  • 动作(change_speed) 动作主体:车辆vehicle或行人pedestrian。 结束时间:当动作主体actor达到目标速度target ,动作结束。 是否支持modifier:否 参数:参数如下表,支持位置参数和关键字参数。 表4 change_speed参数 Parameter Type Mandatory Description reference entity no Default=it.actor. Reference to the entity that is used to determine the target speed. If this argument is omitted, the actor itself is used as reference target speed yes Target value for the speed at the end of the action rate_profile dynamics_shape yes Assign a shape for the change of the speed variable. This profile affects the acceleration during action execution rate_peak acceleration yes Target value for the peak acceleration that must be achieved during the action 目标速度不能超出所在道路的限速值。 当rate_profile为step时,瞬间达到目标速度,不会受到rate_peak值的影响。 样例 m_profile: dynamics_shape = sinusoidal Ego.change_speed(reference: lead_vehicle, target: -5.0mps, rate_profile: m_profile, rate_peak: 2mpss)
  • 动作(change_lane) 动作主体:车辆vehicle 结束时间:当动作主体actor位于目标车道lane中、目标偏移offset处时,动作结束。 是否支持modifier:否 参数:参数如下表,支持关键字参数。rate_peak和rate_profile是必选项,用于设置osc1中的dynamics、target和reference必须设置且只设置其中之一,前者用于指定绝对车道,后者用于指定相对车道。 表5 change_lane参数 Parameter Type Mandatory Description number_of_lanes uint no The target lane is "num_of_lanes" to the side of the reference entity. Use in conjunction with "side" side lane_change_side no Select on which side of the reference entity reference entity no Default=it.actor. Reference to the entity that is used to determine the target lane. If this argument is omitted, the actor itself is used as reference offset length no Default=0.0. Target offset from center of the target lane that the actor follows at the end of the action rate_profile dynamics_shape yes Assign a shape for the change of the lateral position variable (t-axis). This profile affects the lateral velocity during action execution rate_peak speed yes Target value for the peak lateral velocity that must be achieved during the action target lane_id(uint) no The actor starts and finishes the action in the target lane 目标lane必须在地图上。 中心线左侧的lane_id为正,如'1','2'。右侧的lane_id为负,如'-1','-3'。绝对值越大,距离中心线越远。 offset值不能超出当前所在lane的宽度范围。 使用相对位置时,参考对象reference必须是车辆,否则仿真器A无法支持。 rate_profile只能选择linear或step。 绝对车道1 my_lane: lane with: keep(it.lane_id == '1') m_profile: dynamics_shape = linear side_vehicle.change_lane(target: my_lane, rate_profile: m_profile, rate_peak: 0.3mps) 绝对车道2 my_lane: lane with: keep(it.lane_id == '-1') m_profile: dynamics_shape = linear side_vehicle.change_lane(target: my_lane, offset: -0.2m, rate_profile: m_profile, rate_peak: 0.4mps) 相对车道1 m_profile: dynamics_shape = step m_side: lane_change_side = left m_profile: dynamics_shape = step Ego.change_lane(number_of_lanes: 2, side: m_side, reference: side_vehicle, offset: 0.8m, rate_profile: m_profile, rate_peak: 0.3mps) 相对车道2 m_profile: dynamics_shape = step m_side: lane_change_side = same m_profile: dynamics_shape = step Ego.change_lane(number_of_lanes: 1, reference: side_vehicle, side:m_side, rate_profile: m_profile, rate_peak: 0.3mps)
  • 动作(activate_controller) 动作主体:车辆vehicle 结束时间:激活或停用控制器controller后,动作结束。 是否支持modifier:否 参数:参数如下表,支持位置参数和关键字参数。 表6 activate_controller参数 Parameter Type Mandatory Description lateral bool yes In lateral domain: Activate or deactivate controller defined (e.g. automated, autonomous) behavior longitudinal bool yes In longitudinal domain: Activate or deactivate autonomous behavior 代码样例: Ego.activate_controller(lateral:true, longitudinal:true)
  • 初始动作(assign_init_position) 动作主体:车辆vehicle或行人pedestrian。 结束时间:当动作主体actor到达指定的位置坐标时,动作结束。 是否支持modifier:是 参数:参数如下表 表2 assign_init_position参数 Parameter Type Mandatory Description position pose_3d no Desired position assigned by the user assign_init_position支持设置绝对位置和相对位置,设置相对位置时使用修饰器(position)和修饰器(lane)来给出相对值。 当初始位置需要车辆转换朝向时,通过设置pose_3d的orientation来设定朝向,以与所在车道朝向一致,例如车辆所在车道和road0呈90°夹角时,设置orientation的yaw为1.57rad,否则车辆启动后会有转向行为,影响场景的正常执行。 设置初始位置时所采用的地图元素必须是对应的地图中有的元素,比如设置绝对位置create_odr_point('0', '-4', 5.0m, 0.0m)时,地图上必须有id为'0'的road,该road上必须有lane_id为 '-4'的lane,该lane至少有5.0m以上的长度。如果设置的初始位置找不到地图中的对应元素,将泛化出无效的场景。 绝对位置 m_odr: odr_point = map.create_odr_point('0', '-4', 5.0m, 0.0m) m_orientation: orientation_3d with: keep(it.roll == 0.0rad) keep(it.pitch == 0.0rad) keep(it.yaw == 1.57rad) init_position: pose_3d with: keep(it.odr_point == m_odr) keep(it.orientation == m_orientation) Ego.assign_init_position(position: init_position) 相对位置 cut_in_vehicle.assign_init_position() with: lane(lane: raletive_lane_id, side_of: Ego, side: left) position(distance: 85.0m, behind: Ego)
  • 初始动作(acquire_position_init) 动作主体:车辆vehicle或行人pedestrian。 结束时间:当动作主体actor获取目标位置position时,动作结束。 是否支持modifier:否 参数表: 参数如下表,pose_3d是point和orientation的组合结构,point可以使用xyz_point或odr_point或road_point中的任意一个,orientation非必选项。 表3 acquire_position_init参数 Parameter Type Mandatory Description target pose_3d yes target position 目标位置必须在地图设定的道路上,且是可达的。 xyz_point,有方向要求 m_x: length = 0.0m m_xyz: xyz_point = map.create_xyz_point(x: m_x, y: 10.0m ,z: 0.0m) m_heading: angle = 1.57rad m_orientation: orientation_3d with: keep(it.roll == 0.0rad) keep(it.pitch == 0.0rad) keep(it.yaw == m_heading) m_position: pose_3d with: keep(it.xyz_point == m_xyz) keep(it.orientation == m_orientation) Ego.acquire_position_init(target: m_position) odr_point,无方向要求 m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) m_position: pose_3d with: keep(it.odr_point == m_odr) Ego.acquire_position_init(target: m_position) road_point,无方向要求 m_road: road_point = map.create_road_point(road_id: '0', s: 5.0m, t: 0.0m) m_position: pose_3d with: keep(it.road_point == m_road) Ego.acquire_position_init(target: m_position)
  • 动作 Actions 用户首先使用初始动作InitActions 来初始化实体entities ,接着使用其他动作Actions 展开实体entities 的场景故事story . 初始动作 assign_init_speed 初始动作 assign_init_position 初始动作 acquire_position_init 动作 change_speed 动作 change_lane 动作 activate_controller 动作 lane_offset 动作 acquire_position 父主题: 代码样例 Code Examples
  • 动作 Actions 用户首先使用初始动作InitActions 来初始化实体entities ,接着使用其他动作Actions 展开实体entities 的场景故事story . 初始动作 assign_init_speed 初始动作 assign_init_position 初始动作 acquire_position_init 动作 change_speed 动作 change_lane 动作 activate_controller 动作 lane_offset 动作 acquire_position 父主题: 代码样例 Code Examples