Exemple #1
0
def test_reachpositioncondition():
    cond = OSC.ReachPositionCondition(OSC.WorldPosition(), 0.01)
    OSC.prettyprint(cond.get_element())
Exemple #2
0
    pyoscx.AbsoluteSpeedAction(
        20,
        pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.step,
                                  pyoscx.DynamicsDimension.time, 1)))

init.add_init_action(targetname,
                     pyoscx.TeleportAction(pyoscx.LanePosition(50, 0, -2, 0)))
init.add_init_action(
    targetname,
    pyoscx.AbsoluteSpeedAction(
        10,
        pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.step,
                                  pyoscx.DynamicsDimension.time, 1)))

## do lanechange
lc_cond = pyoscx.ReachPositionCondition(pyoscx.LanePosition(40, 0, -4, 0), 1)
lc_event = pyoscx.Event('lanechange', pyoscx.Priority.parallel)
lc_event.add_action(
    'lanechangeaction',
    pyoscx.RelativeLaneChangeAction(
        -1, targetname,
        pyoscx.TransitionDynamics(pyoscx.DynamicsShapes.sinusoidal,
                                  pyoscx.DynamicsDimension.time, 3)))
lc_event.add_trigger(
    pyoscx.EntityTrigger('lanechangetrigger', 0, pyoscx.ConditionEdge.none,
                         lc_cond, egoname))

event = pyoscx.Event('speedchange', pyoscx.Priority.parallel)
event.add_action(
    'speedaction',
    pyoscx.AbsoluteSpeedAction(