更新时间:2024-10-30 GMT+08:00
分享

merge

简述:地图场景为匝道合流。主车Ego在主道行驶,初始速度为Ego_InitSpeed_Ve0,Ego设定了目标在主道右侧2车道上的目标点Target_position,仿真开始后激活Ego控制器(控制器会影响Ego去往Target_position的寻路算法,但目前仿真器B尚不支持寻路动作acquire_position),从车side_vehicle在匝道行驶,初始速度为SideVehicle_InitSpeed_Ve0.side_vehicle从匝道汇入主道。控制器有时会根据side_vehicle的位置更改主车Ego的速度。

地图文件(odr)

scenario Merge:
    m_scene: scenery
    lane_width: length = [3m, 4m]
    radius_of_curvature: length = [200m..1000m]
    ramp_lane_num: int = 1
    ramp_length: length = [200m..300m]
    main_speed: speed = 120kph
    ramp_speed: speed = 60kph
    road_aids_type: road_aids_type = ["DType-1", "DType-2", "PType"]

    merge_1: merge with:
        keep(it.lane_width == lane_width)
        keep(it.left_lane_num == 0)
        keep(it.right_lane_num == 2)
        keep(it.ramp_lane_num == ramp_lane_num)
        keep(it.main_speed == main_speed)
        keep(it.ramp_speed == ramp_speed)
        keep(it.radius_of_curvature == radius_of_curvature)
        keep(it.ramp_length == ramp_length)
        keep(it.road_aids_type == road_aids_type)

场景文件(osc)

import standard

scenario Merge:
    # map
    map: map
    map.set_map_file("./merge.odr")

    # parameter
    Ego_InitSpeed_Ve0: speed = [90kph..110kph]
    Ego_InitPosition_LaneId: string = ['-1', '-2']
    Ego_InitPosition_s: length = [0m..30m]
    Ego_Odr: odr_point = map.create_odr_point(road_id: '10', lane_id: Ego_InitPosition_LaneId, s: Ego_InitPosition_s, t: 0.0m)
    Ego_InitPosition: pose_3d with:
        keep(it.odr_point == Ego_Odr)
    SideVehicle_InitSpeed_Ve0: speed = [45kph, 50kph, 55kph]
    SideVehicle_s: length = [30.0m..80.0m]
    SideVehicle_Odr: odr_point = map.create_odr_point(road_id: '1', lane_id: '-1', s: SideVehicle_s, t: 0.0m)
    SideVehicle_InitPosition: pose_3d with:
        keep(it.odr_point == SideVehicle_Odr)
    Target_xyz: xyz_point = map.create_xyz_point(x: 530m, y: -2m ,z: 0.0m)
    Target_position: pose_3d with:
        keep(it.xyz_point == Target_xyz)
    Duration: time = 100s

    # entity
    Ego: vehicle with:
        keep(it.name == "Saimo")
        keep(it.initial_bm == "默认驾驶员")
    side_vehicle: vehicle with:
        keep(it.name == "Saimo")
        keep(it.initial_bm == "默认驾驶员")

    # storyboard
    do parallel(duration: Duration):
        # init
        Ego.assign_init_position(position: Ego_InitPosition)
        Ego.assign_init_speed(Ego_InitSpeed_Ve0)
        side_vehicle.assign_init_position(position: SideVehicle_InitPosition)
        side_vehicle.assign_init_speed(SideVehicle_InitSpeed_Ve0)

        Ego.activate_controller(true, true)
        Ego.acquire_position(target: Target_position)

相关文档