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

修饰器(Modifiers)

修饰器(speed)

用途:设定动作主体actor在当前阶段的速度。可以修饰初始动作assign_init_speed

参数

表1 speed参数

Parameter

Type

Mandatory

Description

speed

speed

no

A target speed value, including a speed unit

faster_than

entity

no

set the speed target faster than another entity

slower_than

entity

no

set the speed target slower than another entity

same_as

entity

no

set the speed target same as another entity

  • faster_than、slower_than和same_as必须设置且仅设置一个。
  • 使用faster_than和slower_than时配合speed来设置相对速度。

使用speed+faster_than

cut_in_vehicle.assign_init_speed() with:
    speed(speed: 5mps, faster_than: Ego)

使用speed+slower_than

cut_in_vehicle.assign_init_speed() with:
    speed(speed: 5mps, slower_than: Ego)

使用same_as

cut_in_vehicle.assign_init_speed() with:
    speed(same_as: Ego)

修饰器(lane)

用途:设定动作主体actor所处的车道。可以修饰初始动作assign_init_position

参数

表2 lane参数

Parameter

Type

Mandatory

Description

lane

int

no

Relative value of the target lane_id

same_as

entity

no

Option to specify that the vehicle must be in the same lane as the referenced vehicle

side_of

entity

no

Option to specify that the vehicle must be in another lane than the referenced vehicle

side

side_left_right

no

Depending on the value the actor shall be on the right or left side of the referenced entity. How many lanes right or left of that entity is specified by the lane-parameter

offset

length

no

Lateral offset to the target lane

  • side_of和same_as必须设置且仅设置一个。
  • 使用side_of来设置车道时,必须同时使用lane和side。

使用lane+side_of

m_left: side_left_right = left
cut_in_vehicle.assign_init_position() with:
    lane(lane: 1, side_of: Ego, side: m_left)
    position(distance: 85.0m, behind: ego)

使用same_as

m_left: side_left_right = left
cut_in_vehicle.assign_init_position() with:
    lane(same_as: Ego)
    position(distance: 85.0m, behind: ego)

修饰器(position)

用途:设定动作主体actor所处的车道。可以修饰初始动作assign_init_position 。

参数

表3 position参数

Parameter

Type

Mandatory

Description

distance

length

no

A target length value including a length unit. The distance is calculated using the route-based s-coordinate

ahead_of

entity

no

specified by the lane-parameter

behind

entity

no

When behind is specified, the actor must be behind the entity by the specified value

代码样例

cut_in_vehicle.assign_init_position() with:
    lane(lane: raletive_lane_id, side_of: ego, side: left)
    position(distance: 85.0m, behind: ego)

相关文档