예제 #1
0
    egomangr.add_actor(egoname)
    egomangr.add_maneuver(ego_man)

    tarmangr = pyoscx.ManeuverGroup('tarmangr')
    tarmangr.add_actor(targetname)
    tarmangr.add_maneuver(tar_man)

    # create act 
    act = pyoscx.Act('ccrm act',pyoscx.ValueTrigger('starttrigger',0,pyoscx.ConditionEdge.rising,pyoscx.SimulationTimeCondition(0,pyoscx.Rule.greaterThan)))

    act.add_maneuver_group(egomangr)
    act.add_maneuver_group(tarmangr)

    # create story
    story = pyoscx.Story('mystory')
    story.add_act(act)

    ## create the storyboard
    sb = pyoscx.StoryBoard(init,pyoscx.ValueTrigger('stop_simulation',0,pyoscx.ConditionEdge.rising,pyoscx.SimulationTimeCondition(ttc_at_speed*2+acceleration_time,pyoscx.Rule.greaterThan),'stop'))
    sb.add_story(story)

    ## create and return the scenario
    sce = pyoscx.Scenario('CCRm_v: ' +str(ego_speedvalue) + ', offset: ' + str(offset),'Mandolin',paramdec,entities=entities,storyboard = sb,roadnetwork=road,catalog=catalog)
    return sce

if __name__ == '__main__':
    all_egospeeds = [x for x in range(30,85,5)]
    all_offsets = [-50, -25, 0, 25, 50]
    sce = CCRm(all_egospeeds[-1],all_offsets[1])
    pyoscx.esminiRunner(sce)
예제 #2
0
# create a router

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


# create action
ego_action = pyoscx.AssignRouteAction(ego_route)


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


## create the storyboard
ego_man = pyoscx.Maneuver('ego_man')
ego_man.add_event(ego_event)

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

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

# display the scenario
pyoscx.prettyprint(sce.get_element())

pyoscx.esminiRunner(sce,esminipath='/home/mander76/local/scenario_creation/esmini')