更新时间:2024-10-30 GMT+08:00
场景样例(Scenario Examples)
如下为具体场景和逻辑场景样例。
具体场景(Concrete Scenario)
具体场景样例:
import standard scenario my_scenario: # Road Network map: map map.set_map_file("./road.xodr") # Parameter Declarations m_z: length = 5.0m LeadVehicle_InitDistance: length = 20.0m Ego_InitSpeed: speed = 16.66666667mps delay1: time = 20s delay2: time = 5s Swerve_Offset: length = -1.0m Swerve_MaxLateralAcc: speed = 0.3mps m_sinusoidal: dynamics_shape = sinusoidal m_right: side_left_right = right m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) m_xyz: xyz_point = map.create_xyz_point(x: 0.0m, y: 10.0m,z: m_z) person_InitPosition: pose_3d with: keep(it.xyz_point == m_xyz) m_mode: distance_mode = reference_points m_direction: distance_direction = euclidianDistance m_profile: dynamics_shape = step m_side: lane_change_side = same # Entities Ego_name: string = "Audi_A3_2009_black" Side_vehicle_name: string = "Audi_A3_2009_red" 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 == Side_vehicle_name) woman: person with: keep(it.name == "Christian") keep(it.model == "female_adult") # Storyboard do parallel: # InitActions Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed) lead_vehicle.assign_init_position() with: lane(lane: 0, side_of: Ego, side: m_right) position(LeadVehicle_InitDistance, ahead_of: Ego) lead_vehicle.assign_init_speed() with: speed(same_as: Ego) woman.assign_init_position(person_InitPosition) # Story serial: # action 1: ActivateALKSController wait elapsed(delay1) Ego.activate_controller(true, true) serial: # action 2: SwerveAction wait elapsed(delay2) lead_vehicle.lane_offset(Swerve_Offset, Swerve_MaxLateralAcc, m_sinusoidal) serial: wait lead_vehicle.object_distance(reference: Ego, direction: m_direction, mode: m_mode) < 5m parallel: Ego.change_lane(side:m_side, reference: lead_vehicle, side:m_side, rate_profile: m_profile, rate_peak: 0.3mps) lead_vehicle.change_speed(target: 0.2mps, rate_profile: m_sinusoidal, rate_peak: -0.1mpss)
逻辑场景(Logical Scenario)
逻辑场景样例:
import standard scenario my_scenario: # Road Network map: map map.set_map_file("./road.xodr") # Parameter Declarations m_z: length = [0.0m..5.0m] LeadVehicle_InitDistance: length = 20.0m Ego_InitSpeed: speed = 16.66666667mps delay1: time = [10s, 20s, 60s] delay2: time = 5s Swerve_Offset: length = -1.0m Swerve_MaxLateralAcc: speed = 0.3mps m_sinusoidal: dynamics_shape = [linear, sinusoidal] m_right: side_left_right = [left, right] m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id: '-4', s: 5.0m, t: 0.0m) Ego_InitPosition: pose_3d with: keep(it.odr_point == m_odr) m_xyz: xyz_point = map.create_xyz_point(x: 0.0m, y: 10.0m,z: m_z) person_InitPosition: pose_3d with: keep(it.xyz_point == m_xyz) m_mode: distance_mode = reference_points m_direction: distance_direction = euclidianDistance m_profile: dynamics_shape = [step, linear] m_side: lane_change_side = [same, right] # Entities Ego_name: string = "Audi_A3_2009_black" Side_vehicle_name: string = "Audi_A3_2009_red" Ego_controller: string = ["DefaultDriver", "ComfortableDriver"] Ego: vehicle with: keep(it.name == Ego_name) keep(it.initial_bm == Ego_controller) lead_vehicle: vehicle with: keep(it.name == Side_vehicle_name) woman: person with: keep(it.name == "Christian") keep(it.model == "female_adult") # Storyboard do parallel: # InitActions Ego.assign_init_position(position: Ego_InitPosition) Ego.assign_init_speed(Ego_InitSpeed) lead_vehicle.assign_init_position() with: lane(lane: 0, side_of: Ego, side: m_right) position(LeadVehicle_InitDistance, ahead_of: Ego) lead_vehicle.assign_init_speed() with: speed(same_as: Ego) woman.assign_init_position(person_InitPosition) # Story serial: # action 1: ActivateALKSController wait elapsed(delay1) Ego.activate_controller(true, true) serial: # action 2: SwerveAction wait elapsed(delay2) lead_vehicle.lane_offset(Swerve_Offset, Swerve_MaxLateralAcc, m_sinusoidal) serial: wait lead_vehicle.object_distance(reference: Ego, direction: m_direction, mode: m_mode) < 5m parallel: Ego.change_lane(side:m_side, reference: lead_vehicle, side:m_side, rate_profile: m_profile, rate_peak: 0.3mps) lead_vehicle.change_speed(target: 0.2mps, rate_profile: m_sinusoidal, rate_peak: -0.1mpss)
父主题: 动态场景