Skip to content

Implicit movement constraints examples

Example: implicit constraints between movements

OSC2 code: implicit constraints between movements
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/highway.xodr"

extend top.main:
    car1: vehicle


    do serial():
        d1: car1.drive()
        d2: car1.drive()

Example: implicit constraint to be on same road element

OSC2 code: implicit constraint to be on same road element
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/highway.xodr"

extend top.main:
    do s1: sut.cut_in_on_highway()


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)