Ejemplo n.º 1
0
def test_follow_traj_action_polyline():

    positionlist = []
    positionlist.append(OSC.RelativeLanePosition(10, 0.5, -3, 'Ego'))
    positionlist.append(OSC.RelativeLanePosition(10, 1, -3, 'Ego'))
    positionlist.append(OSC.RelativeLanePosition(10, -1, -3, 'Ego'))
    positionlist.append(OSC.RelativeLanePosition(10, 0, -3, 'Ego'))
    OSC.prettyprint(positionlist[0].get_element())
    polyline = OSC.Polyline([0, 0.5, 1, 1.5], positionlist)

    traj = OSC.Trajectory('my_trajectory', False)
    traj.add_shape(polyline)

    trajact = OSC.FollowTrajectoryAction(traj, OSC.FollowMode.position)
    OSC.prettyprint(trajact.get_element())
Ejemplo n.º 2
0
positionlist = []
positionlist.append(pyoscx.RelativeLanePosition(0,0,0,targetname))
positionlist.append(pyoscx.RelativeLanePosition(20,0.5,0,targetname))
positionlist.append(pyoscx.RelativeLanePosition(40,-0.5,0,targetname))
positionlist.append(pyoscx.RelativeLanePosition(60,-1,0,targetname))

polyline = pyoscx.Polyline([0,0.5,1,1.5],positionlist)


traj = pyoscx.Trajectory('my_trajectory',False)
traj.add_shape(polyline)



trajact = pyoscx.FollowTrajectoryAction(traj,pyoscx.FollowMode.position,pyoscx.ReferenceContext.relative,1,0)

event.add_action('newspeed',trajact)


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

mangr = pyoscx.ManeuverGroup('mangroup')
mangr.add_actor('$owner')
mangr.add_maneuver(man)
starttrigger = pyoscx.ValueTrigger('starttrigger',0,pyoscx.ConditionEdge.rising,pyoscx.SimulationTimeCondition(0,pyoscx.Rule.greaterThan))
act = pyoscx.Act('my_act',starttrigger)
act.add_maneuver_group(mangr)
Ejemplo n.º 3
0
event.add_trigger(trigger)

positionlist = []
positionlist.append(pyoscx.RelativeLanePosition(0, 0, 0, targetname))
positionlist.append(pyoscx.RelativeLanePosition(20, 0.5, 0, targetname))
positionlist.append(pyoscx.RelativeLanePosition(40, -0.5, 0, targetname))
positionlist.append(pyoscx.RelativeLanePosition(60, -1, 0, targetname))
pyoscx.prettyprint(positionlist[0].get_element())
polyline = pyoscx.Polyline([0, 0.5, 1, 1.5], positionlist)

traj = pyoscx.Trajectory('my_trajectory', 'False')
traj.add_shape(polyline)

pyoscx.prettyprint(traj.get_element())

trajact = pyoscx.FollowTrajectoryAction(traj, 'position', 'relative', 1, 0)
pyoscx.prettyprint(trajact.get_element())
event.add_action('newspeed', trajact)

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

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