Skip to content

Implicit movement constraints

Consecutive movement scenarios of the same actor obey some obvious implicit constraints. In the following example, the consecutive drive scenarios of car1 imply that the location, speed, and so on at the end of d1 are the same as those at the start of d2.

OSC2 code: implicit constraints between movements
    do serial():
        d1: car1.drive()
        d2: car1.drive()

See complete example.

In the following example, there is no along() modifier on the path of sut.car.drive(). It is not necessary because car1 and sut.car are connected by lane and position modifiers that implicitly require them to be on the same road element. However, you can of course add an along() modifier on sut.car.drive() for better readability.

OSC2 code: implicit constraint to be on same road element
scenario sut.cut_in_on_highway:
    car1: vehicle   # The "cut-in" car
    side: av_side   # The side of which car1 cuts in, left or right
    r: lane_section # lane_section is the longest piece of road with no intersections and constant number of lanes
    keep(r.lanes >= 3)

    do serial():
        change_lane: parallel(duration:[1.5..3]second, overlap:equal):
            sut.car.drive()
            car1.drive() with:
                lane(side_of: sut.car, side: side, at: start)
                position(time: [0.5..1]second, ahead_of: sut.car, at: start)
                lane(same_as: sut.car, at: end)
                position(time: [1.5..2]second, ahead_of: sut.car, at: end)
                along(r)

See complete example.

Furthermore, an actor can appear in any set of (potentially overlapping) movement scenarios. In fact, the movement of the same actor can be sliced in multiple ways. For example:

  • A traverse_junction scenario specifies three consecutive drive scenarios: enter, during and exit.
  • A tire_punctured scenario also specifies three consecutive drive scenarios: before, during and after. In after, the car drives more slowly and erratically.

In a particular test, a specific car can be active in both traverse_junction and tire_punctured. These scenarios can be in arbitrary relation to each other: they might completely or partially overlap. It is the job of the planner to solve them all together.