更新时间:2024-05-13 GMT+08:00
分享

junction

简述:地图场景为交叉口.lead_vehicle和主车Ego一前一后向交叉口行驶,delay秒后激活Ego控制器.另一路段上有一辆车vehicle1,也在朝交叉口行驶.

地图文件(odr)

scenario Junction:
    m_scene: scenery

    lane_num: int = [2, 3, 4]
    bikeway: bool = false
    sidewalk: bool = false
    junction_type: junction_type = ["crossroad", "T-junction"]

    junction_1: junction with:
        keep(it.lane_num == lane_num)
        keep(it.bikeway == bikeway)
        keep(it.sidewalk == sidewalk)
        keep(it.junction_type == junction_type)

场景文件(osc)

import standard

scenario Junction:
    # map
    map: map
    map.set_map_file("./junction.odr")

    # parameter
    Ego_TargetSpeed_Ve0: speed = [50kph..60kph]
    Ego_InitPosition_RoadId: string = '1'
    Ego_InitPosition_LaneId: string = ['-1', '-2']
    Ego_InitPosition_s: length = [0m..100m]
    Ego_Odr: odr_point = map.create_odr_point(road_id: Ego_InitPosition_RoadId, lane_id: Ego_InitPosition_LaneId, s: Ego_InitPosition_s, t: 0.0m)
    Ego_InitPosition: pose_3d with:
        keep(it.odr_point == Ego_Odr)
    Target_xyz: xyz_point = map.create_xyz_point(x: 225m, y: -100m ,z: 0.0m)
    Target_position: pose_3d with:
        keep(it.xyz_point == Target_xyz)
    LeadVehicle_TargetSpeed_Ve0: speed = 45kph
    Vehicle1_Odr: odr_point = map.create_odr_point(road_id: '2', lane_id: '2', s: 100.0m, t: 0.0m)
    m_orientation: orientation_3d with:
        keep(it.roll == 0.0rad)
        keep(it.pitch == 0.0rad)
        keep(it.yaw == 1.57rad)
    Vehicle1_InitPosition: pose_3d with:
        keep(it.odr_point == Vehicle1_Odr)
        keep(it.orientation == m_orientation)
    m_profile: dynamics_shape = [sinusoidal, linear, step]
    m_rate_peak: acceleration = [5kmphps, 10kmphps]
    Duration: time = [100s, 120s]

    # entity
    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)
    lead_vehicle: vehicle with:
        keep(it.name == "Audi_A3_2009_blue")
    vehicle1: vehicle with:
        keep(it.name == "Audi_A3_2009_red")

    # storyboard
    do parallel(duration: Duration):
        # init
        Ego.assign_init_position(position: Ego_InitPosition)
        lead_vehicle.assign_init_position() with:
            lane(same_as: Ego)
            position(distance: 30.0m, ahead_of: Ego)
        vehicle1.assign_init_position(position: Vehicle1_InitPosition)

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

        Ego.change_speed(target: Ego_TargetSpeed_Ve0, rate_profile: m_profile, rate_peak: 3mpss)
        serial:
            wait Ego.speed > 1kph
            lead_vehicle.change_speed(target: LeadVehicle_TargetSpeed_Ve0, rate_profile: m_profile, rate_peak: m_rate_peak)

        serial:
            wait Ego.speed > 1kph
            vehicle1.change_speed(target: LeadVehicle_TargetSpeed_Ve0, rate_profile: m_profile, rate_peak: m_rate_peak)
分享:

    相关文档

    相关产品