自动驾驶云服务 OCTOPUS-参数声明(Parameter Declarations):逻辑场景(Logical scenario)

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

逻辑场景(Logical scenario)

逻辑场景的参数声明通过:范围型[最小值..最大值] 和枚举型[值1, 值2] 的方式来实现泛化:

  • 范围型支持float和scalar类型。
  • 枚举型支持int, float, bool, str, enum和scalar类型,且需要保证枚举列表中的元素均为相同类型。

例1:范围型

m_value: float = [2.0..3.0]
v: speed = [5mps..10mps]
delay: time = [40s..60s]
m_a: acceleration = [0.00mpss..0.03mpss]

例2:枚举型

m_ id: int = [-1, 2]
m_value: float = [2.0, 3.0]
m_on_road: bool = [true, false]
Ego_name: string = ["Audi_A3_2009_black", "Audi_A3_2009_red"]
m_shape: dynamics_shape = [linear, sinusoidal]
m_side: side_left_right = [left, right]
v: speed = [5mps, 7mps, 10mps]
m_a: acceleration = [0.01mpss, 0.03mpss]
delay: time = [40s, 60s, 100s]
  • 通过泛化参数,可以实现实体entity 、动作act ,以及修饰器modifier的泛化。
  • Struct类型不能直接泛化,而是通过泛化参数来进行泛化。

例1:entity泛化

Ego_name: string = ["Audi_A3_2009_black", "Audi_A3_2009_red"]
Ego_controller: string = "DefaultDriver"
Ego: vehicle with:
    keep(it.name == Ego_name)
    keep(it.initial_bm == Ego_controller)

例2:act泛化

m_lateral: bool = [true, false]
m_speed: speed = [5mps..15mps]
m_rate_profile: dynamics_shape = linear
Ego.activate_controller(m_lateral, true)
Ego.change_speed(target: m_speed, rate_peak: 0.0mpss, rate_profile: m_rate_profile)

例3:modifier泛化

m_speed: speed = [5mps..15mps]
Ego.assign_init_speed() with:
    speed(speed: m_speed)

例4:Struct类型泛化

m_lane_id: int = [-1, 2]
m_odr: odr_point = map.create_odr_point(road_id: '0', lane_id:m_lane_id, s: 5.0m, t: 0.0m)

m_x: distance = [2m..7.5m]
m_position_3d: position_3d = map.create_xyz_point(x: m_x, y: 10.0m ,z: 0.0m)

m_pose_3d: pose_3d with:
    keep(it.odr_point == m_odr)
support.huaweicloud.com/usermanual-octopus/octopus-13-0007.html