Пример #1
0
def createStories(board):
    timeCondition1 = storyboard.TimeCondition(timeline.seconds(5))
    carSetCondition1 = storyboard.CarSetCondition("brokenVehicle1")
    signalEffect1 = storyboard.SignalEffect("stop")
    condition1 = storyboard.AndCondition(timeCondition1, carSetCondition1)
    story1 = storyboard.Story(condition1, [signalEffect1])

    timeCondition2 = storyboard.TimeCondition(timeline.seconds(250))
    carSetCondition2 = storyboard.CarSetCondition("brokenVehicle1")
    signalEffect2 = storyboard.SignalEffect("scenario_1")
    condition2 = storyboard.AndCondition(timeCondition2, carSetCondition2)
    story2 = storyboard.Story(condition2, [signalEffect2])

    board.registerStory(story1)
    board.registerStory(story2)
Пример #2
0
def createStories():
    # Create coordinates needed for the PolygonCondition
    coord0 = storyboard.Coord(0.0, 0.0)
    coord1 = storyboard.Coord(3000.0, 0.0)
    coord2 = storyboard.Coord(3000.0, 1600.0)
    coord3 = storyboard.Coord(0.0, 1600.0)

    # Create PolygonCondition
    cond0 = storyboard.PolygonCondition([coord0, coord1, coord2, coord3])

    # Create TimeCondition
    cond1 = storyboard.TimeCondition(timeline.milliseconds(15000))

    # Create CarSetCondition
    cond2 = storyboard.CarSetCondition({"flow1.0", "flow0.1", "flow0.2"})

    # Create SpeedEffect
    effect0 = storyboard.SpeedEffect(2.44)

    # Create AndConditions
    and0 = storyboard.AndCondition(cond0, cond1)
    and1 = storyboard.AndCondition(and0, cond2)

    # Create OrCondition
    cond3 = storyboard.TimeCondition(timeline.seconds(190))
    or0 = storyboard.OrCondition(cond3, and1)

    # Create Story
    story = storyboard.Story(or0, [effect0])

    # Create Story 2
    cond4 = storyboard.TimeCondition(timeline.seconds(50),
                                     timeline.seconds(60))
    effect1 = storyboard.SpeedEffect(2.44)
    story1 = storyboard.Story(cond4, [effect1])

    # Create Story 3, overlapping story0
    cond5 = storyboard.TimeCondition(timeline.seconds(200),
                                     timeline.seconds(210))
    cond6 = storyboard.CarSetCondition({"flow0.0", "flow0.1"})
    and2 = storyboard.AndCondition(cond5, cond6)
    effect2 = storyboard.SpeedEffect(0.1)
    story2 = storyboard.Story(and2, [effect2])

    # Create Story 4, SpeedConditionGreater
    cond7 = storyboard.SpeedConditionGreater(4.0)
    cond8 = storyboard.TimeCondition(timeline.seconds(20),
                                     timeline.seconds(30))
    and3 = storyboard.AndCondition(cond7, cond8)
    effect3 = storyboard.SpeedEffect(1.0)
    story3 = storyboard.Story(and3, [effect3])

    # Register Stories at the Storyboard
    board.registerStory(story)
    board.registerStory(story1)
    board.registerStory(story2)
    board.registerStory(story3)

    print("Stories loaded!")
Пример #3
0
def createStories():
	# Create coordinates needed for the PolygonCondition
	coord0 = storyboard.Coord(0.0, 0.0, 0.0)
	coord1 = storyboard.Coord(3000.0, 0.0, 0.0)
	coord2 = storyboard.Coord(3000.0, 1600.0, 0.0)
	coord3 = storyboard.Coord(0.0, 1600.0, 0.0)

	# Create PolygonCondition
	cond0 = storyboard.PolygonCondition([coord0, coord1, coord2, coord3])

	# Create TimeCondition
	cond1 = storyboard.TimeCondition(timeline.milliseconds(15000))

	# Create CarSetCondition
	cond2 = storyboard.CarSetCondition(["flow1.0", "flow0.1", "flow0.2"])

	# Create SpeedEffectFactory
	effectFactory0 = storyboard.SpeedEffectFactory(2.44)

	# Create AndConditions
	and0 = storyboard.AndCondition(cond0, cond1)
	and1 = storyboard.AndCondition(and0, cond2)

	# Create OrCondition
	cond3 = storyboard.TimeCondition(timeline.seconds(190))
	or0 = storyboard.OrCondition(cond3, and1)

	# Create Story
	story = storyboard.Story(or0, [effectFactory0])

	# Create Story 2
	cond4 = storyboard.TimeCondition(timeline.seconds(50), timeline.seconds(60))
	effectFactory1 = storyboard.SpeedEffectFactory(2.44)
	story1 = storyboard.Story(cond4, [effectFactory1])

	# Create Story 3, overlapping story0
	cond5 = storyboard.TimeCondition(timeline.seconds(200), timeline.seconds(210))
	cond6 = storyboard.CarSetCondition(["flow0.0", "flow0.1"])
	and2 = storyboard.AndCondition(cond5, cond6)
	effectFactory2 = storyboard.SpeedEffectFactory(0.1)
	story2 = storyboard.Story(and2, [effectFactory2])

	# Create Story 4, SpeedConditionGreater
	cond7 = storyboard.SpeedConditionGreater(4.0)
	cond8 = storyboard.TimeCondition(timeline.seconds(20), timeline.seconds(30))
	and3 = storyboard.AndCondition(cond7, cond8)
	effectFactory3 = storyboard.SpeedEffectFactory(1.0)
	story3 = storyboard.Story(and3, [effectFactory3])

	# Register Stories at the Storyboard
	board.registerStory(story)
	board.registerStory(story1)
	board.registerStory(story2)
	board.registerStory(story3)

	print("Stories loaded!")
Пример #4
0
def createStories(board):
    # Create TtcCondition
    ttcCondition = storyboard.TtcCondition(1.5,
                                           200)  # ttc 1.5sec | radius 200m
    speedConditonGreater = storyboard.SpeedDifferenceConditionFaster(
        5.55556)  # 20 km/h
    ttcSignalEffect = storyboard.SignalEffect("irc")
    speedAndTTC = storyboard.AndCondition(ttcCondition, speedConditonGreater)

    story = storyboard.Story(speedAndTTC, [ttcSignalEffect])

    # Vehicle stops at second 20
    timeToStop = storyboard.TimeCondition(timeline.seconds(40.5))
    vehicleToStop = storyboard.CarSetCondition("flow1.0")
    vehicleAndTimeToStop = storyboard.AndCondition(timeToStop, vehicleToStop)
    stopEffect = storyboard.StopEffect()

    stopStory = storyboard.Story(vehicleAndTimeToStop, [stopEffect])

    # Register Stories at the Storyboard
    board.registerStory(story)
    board.registerStory(stopStory)

    jamAreaCondition = storyboard.PolygonCondition([
        Coord(2920, 2673),
        Coord(2903, 2955),
        Coord(2882, 3154),
        Coord(2901, 3154),
        Coord(2923, 2955),
        Coord(2943, 2673)
    ])
    jamTimeCondition = storyboard.TimeCondition(timeline.seconds(60))
    jamTimeAndSpaceConditions = storyboard.AndCondition(
        jamTimeCondition, jamAreaCondition)
    jamConditions = storyboard.AndCondition(jamTimeAndSpaceConditions,
                                            storyboard.LimitCondition(10))
    jamStory = storyboard.Story(jamConditions, [stopEffect])
    board.registerStory(jamStory)

    print("Stories loaded!")
Пример #5
0
def createStories(board):
    # condition triggering after 10 simulated seconds
    timeCondition = storyboard.TimeCondition(timeline.seconds(10))

    # select police car
    carSetCondition = storyboard.CarSetCondition("police0")

    # create signal effect
    signalEffect = storyboard.SignalEffect("siren on")

    # combine conditions
    condition = storyboard.AndCondition(timeCondition, carSetCondition)

    # create story by linking effect and conditions together
    story = storyboard.Story(condition, [signalEffect])

    # activate story
    board.registerStory(story)
Пример #6
0
def createStories(board):
    # condition triggering after 10 simulated seconds
    timeCondition = storyboard.TimeCondition(timeline.seconds(10))

    # select police car
    carSetCondition = storyboard.CarSetCondition("police0")

    # create signal effect
    signalEffect = storyboard.SignalEffect("siren on")

    # combine conditions
    condition = storyboard.AndCondition(timeCondition, carSetCondition)

    # create story by linking effect and conditions together
    story = storyboard.Story(condition, [signalEffect])

    # activate story
    board.registerStory(story)