Esempio n. 1
0
def test_route():
    route = OSC.Route('myroute')

    route.add_waypoint(OSC.WorldPosition(0, 0, 0, 0, 0, 0),
                       OSC.RouteStrategy.shortest)
    route.add_waypoint(OSC.WorldPosition(1, 1, 0, 0, 0, 0),
                       OSC.RouteStrategy.shortest)

    prettyprint(route.get_element())
def test_route_position():
    route = OSC.Route('myroute')

    route.add_waypoint(OSC.WorldPosition(), OSC.RouteStrategy.shortest)

    route.add_waypoint(OSC.WorldPosition(1, 1, 1), OSC.RouteStrategy.shortest)

    routepos = OSC.RoutePositionOfCurrentEntity(route, 'Ego')
    prettyprint(routepos.get_element())
    routepos = OSC.RoutePositionInRoadCoordinates(route, 1, 3)
    prettyprint(routepos.get_element())
    routepos = OSC.RoutePositionInLaneCoordinates(route, 1, 'a', 2)
    prettyprint(routepos.get_element())
def test_assign_route():
    route = OSC.Route('myroute')
    route.add_waypoint(OSC.WorldPosition(0,0,0,0,0,0),OSC.RouteStrategy.shortest)
    route.add_waypoint(OSC.WorldPosition(1,1,0,0,0,0),OSC.RouteStrategy.shortest)
    OSC.AssignRouteAction(route)
Esempio n. 4
0
### create init

init = xosc.Init()

init.add_init_action(egoname,
                     xosc.TeleportAction(xosc.LanePosition(50, 0, 1, 0)))
init.add_init_action(
    egoname,
    xosc.AbsoluteSpeedAction(
        10,
        xosc.TransitionDynamics(xosc.DynamicsShapes.step,
                                xosc.DynamicsDimension.time, 1)))

# create a router

ego_route = xosc.Route('ego_route')
ego_route.add_waypoint(xosc.LanePosition(30, 0, 1, 0),
                       xosc.RouteStrategy.fastest)
ego_route.add_waypoint(xosc.LanePosition(10, 0, -1, 1),
                       xosc.RouteStrategy.fastest)

# create action
ego_action = xosc.AssignRouteAction(ego_route)

ego_event = xosc.Event('ego_event', xosc.Priority.overwrite)
ego_event.add_action('ego_route', ego_action)
ego_event.add_trigger(
    xosc.ValueTrigger('target_start', 0, xosc.ConditionEdge.none,
                      xosc.SimulationTimeCondition(1, xosc.Rule.greaterThan)))

## create the storyboard