Exemple #1
0
import pyodrx

import os

# create some roads
roads = []

# create two simple roads to merge
roads.append(
    pyodrx.create_road(pyodrx.Line(100), id=0, left_lanes=0, right_lanes=2))
roads.append(
    pyodrx.create_road(pyodrx.Line(100), id=1, left_lanes=0, right_lanes=1))

# manually create the final road

# create the planview and the geometry
planview = pyodrx.PlanView()
planview.add_geometry(pyodrx.Line(200))

# create two different roadmarkings
rm_solid = pyodrx.RoadMark(pyodrx.RoadMarkType.solid,
                           0.2,
                           rule=pyodrx.MarkRule.no_passing)
rm_dashed = pyodrx.RoadMark(pyodrx.RoadMarkType.broken,
                            0.2,
                            rule=pyodrx.MarkRule.no_passing)

# create a centerlane (same centerlane can be used since no linking is needed for this)
centerlane = pyodrx.Lane(a=2)
centerlane.add_roadmark(rm_solid)
Exemple #2
0
import pyodrx 
import os

# create some simple roads
roads= []
# start road
roads.append(pyodrx.create_road([pyodrx.Spiral(-0.004,0.00001,100), pyodrx.Spiral(0.00001,0.005,50), pyodrx.Arc(0.005,50)],id =0,left_lanes=3,right_lanes=4))
# intermittent road
roads.append(pyodrx.create_road([pyodrx.Spiral(0.0001,0.003,65), pyodrx.Spiral(0.003,0.00001,50) ],id =1,left_lanes=3,right_lanes=3))


#exit road
roads.append(pyodrx.create_road(pyodrx.Line(50),id =2,left_lanes=0,right_lanes=1))
# junctions for exit
roads.append(pyodrx.create_road(pyodrx.Spiral(0.005,0.0001,50),id =3,left_lanes=3,right_lanes=3,road_type=1)) # continue
roads.append(pyodrx.create_road(pyodrx.Spiral(0.005,-0.02,100),id =4,left_lanes=0,right_lanes=1,road_type=1)) # exit

# final road
roads.append(pyodrx.create_road([pyodrx.Spiral(-0.00001,-0.003,45),pyodrx.Arc(-0.003,60)],id =5,left_lanes=2,right_lanes=3))

# entry junction
roads.append(pyodrx.create_road([pyodrx.Line(30) ],id =6,left_lanes=2,right_lanes=3,road_type=2)) # continue
roads.append(pyodrx.create_road([pyodrx.Spiral(0.004,0.000001,50) ],id =7,left_lanes=1,right_lanes=0,road_type=2)) # entry

# entry road
roads.append(pyodrx.create_road(pyodrx.Arc(0.004,60),id =8,left_lanes=1,right_lanes=0))


# add predecessors and succesors to the non junction roads
roads[0].add_successor(pyodrx.ElementType.junction,1)
roads[1].add_predecessor(pyodrx.ElementType.junction,1)