Example #1
0
def test_relativespeedcondition():
    cond = OSC.RelativeSpeedCondition(1, 'lessThan', 'Ego')
    OSC.prettyprint(cond.get_element())
Example #2
0
    25,
    pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.sinusoidal,
                              pyoscx.DynamicsDimension.time, 8))
egostart = pyoscx.TeleportAction(pyoscx.LanePosition(25, 0, -3, 0))

targetspeed = pyoscx.AbsoluteSpeedAction(15, step_time)
targetstart = pyoscx.TeleportAction(pyoscx.RoadPosition(30, -5, 0))

init.add_init_action(egoname, egospeed)
init.add_init_action(egoname, egostart)
init.add_init_action(targetname, targetspeed)
init.add_init_action(targetname, targetstart)

### create an event

trigcond = pyoscx.RelativeSpeedCondition(0, pyoscx.Rule.lessThan, egoname)

trigger = pyoscx.EntityTrigger('mytesttrigger', 0.2, pyoscx.ConditionEdge.none,
                               trigcond, targetname)

event = pyoscx.Event('myfirstevent', pyoscx.Priority.overwrite)
event.add_trigger(trigger)

sin_time = pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.linear,
                                     pyoscx.DynamicsDimension.time, 5)
action = pyoscx.RelativeLaneChangeAction(
    -8, targetname,
    pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.linear,
                              pyoscx.DynamicsDimension.time, 6), -10)
event.add_action('newspeed', action)