trigger = xosc.EntityTrigger('mytesttrigger', 0.2, xosc.ConditionEdge.none,
                             trigcond, egoname)

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

sin_time = xosc.TransitionDynamics(xosc.DynamicsShapes.linear,
                                   xosc.DynamicsDimension.time, 3)
action = xosc.LongitudinalDistanceAction(-4,
                                         egoname,
                                         max_deceleration=3,
                                         max_speed=50)
event.add_action('newspeed', action)

## create the act,
man = xosc.Maneuver('my_maneuver')
man.add_event(event)

mangr = xosc.ManeuverGroup('mangroup')
mangr.add_actor('$owner')
mangr.add_maneuver(man)
starttrigger = xosc.ValueTrigger(
    'starttrigger', 0, xosc.ConditionEdge.rising,
    xosc.SimulationTimeCondition(0, xosc.Rule.greaterThan))
act = xosc.Act('my_act', starttrigger)
act.add_maneuver_group(mangr)

## create the story
storyparam = xosc.ParameterDeclarations()
storyparam.add_parameter(
    xosc.Parameter('$owner', xosc.ParameterType.string, targetname))
Beispiel #2
0
headway_cond_2 = xosc.TimeHeadwayCondition(speedyname,1,xosc.Rule.greaterThan)
headway_trigger_2 = xosc.EntityTrigger('trigger',0,xosc.ConditionEdge.none,headway_cond_2,egoname)

ttc_cond_2 = xosc.TimeToCollisionCondition(3,xosc.Rule.lessThan,entity=targetname)
collision_trigger_2 = xosc.EntityTrigger('trigger',0,xosc.ConditionEdge.none,ttc_cond_2,egoname)

lc_group = xosc.ConditionGroup()
lc_group.add_condition(headway_trigger_2)
lc_group.add_condition(collision_trigger_2)

lane_change_event.add_trigger(lc_group)



## create the storyboard
man = xosc.Maneuver('slow down maneuver')


man.add_event(slowdown_event)
man.add_event(lane_change_event)

sb = xosc.StoryBoard(init,xosc.ValueTrigger('stop_simulation',0,xosc.ConditionEdge.rising,xosc.SimulationTimeCondition(20,xosc.Rule.greaterThan),'stop'))
sb.add_maneuver(man,egoname)

## create the scenario
sce = xosc.Scenario('adaptspeed_example','User',paramdec,entities=entities,storyboard = sb,roadnetwork=road,catalog=catalog)

# Print the resulting xml
prettyprint(sce.get_element())

# write the OpenSCENARIO file as xosc using current script name
Beispiel #3
0
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
ego_man = xosc.Maneuver('ego_man')
ego_man.add_event(ego_event)

sb = xosc.StoryBoard(
    init,
    xosc.ValueTrigger('stop_simulation', 0, xosc.ConditionEdge.rising,
                      xosc.SimulationTimeCondition(10, xosc.Rule.greaterThan),
                      'stop'))
sb.add_maneuver(ego_man, egoname)

## create the scenario
sce = xosc.Scenario('adaptspeed_example',
                    'User',
                    paramdec,
                    entities=entities,
                    storyboard=sb,