自动驾驶云服务 OCTOPUS-junction

时间:2024-10-30 16:07:46

junction

简述:地图场景为交叉口。lead_vehicle和主车Ego一前一后分别以LeadVehicle_TargetSpeed_Ve0和Ego_TargetSpeed_Ve0的初始速度向交叉口行驶,Ego设定了目标在右转车道上的目标点Target_position,仿真开始后激活Ego控制器(控制器会影响Ego去往Target_position的寻路算法,但目前仿真器B尚不支持寻路动作acquire_position)。另一路段上有一辆车vehicle1,也以LeadVehicle_TargetSpeed_Ve0的速度朝交叉口行驶。控制器有时会根据环境车的位置更改主车Ego的速度。

地图文件(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: vehicle with:
        keep(it.name == "Saimo")
        keep(it.initial_bm == "默认驾驶员")
    lead_vehicle: vehicle with:
        keep(it.name == "Saimo")        
        keep(it.initial_bm == "默认驾驶员")
    vehicle1: 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_TargetSpeed_Ve0)
        lead_vehicle.assign_init_position() with:
            lane(same_as: Ego)
            position(distance: 30.0m, ahead_of: Ego)
        lead_vehicle.assign_init_speed(LeadVehicle_TargetSpeed_Ve0)
        vehicle1.assign_init_position(position: Vehicle1_InitPosition)
        vehicle1.assign_init_speed(LeadVehicle_TargetSpeed_Ve0)

        Ego.activate_controller(true, true)
        Ego.acquire_position(target: Target_position)
support.huaweicloud.com/usermanual-octopus/octopus-13-0090.html