-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialize.py
70 lines (51 loc) · 1.84 KB
/
initialize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
def getSimSettings():
savePath = os.path.join('Figures', 'results.pdf')
########################################################
# defining road simulation properties
########################################################
allLanes = (0, 1, 2)
# allVelocities = (40, 50, 60, 100)
# allVelocities = (80, 100, 120, 200)
allVelocities = (20, 25, 30, 50)
# allowedLaneVelocites = [(40, 50), (50, 60), (60, 100)]
allowedLaneVelocites = [(20, 25), (25, 30), (30, 50)]
########################################################
# defining the end of the simulation
########################################################
# pY ranges from 0 - 4000
# maxDist = 800
# maxDist = 1600
maxDist = 400
# simulate maxTime time steps
maxTime = 6
goalX = 0
# goalYMin = 550
# goalYMin = 1100
goalYMin = 230
# goalYMax = 700
# goalYMax = 1400
goalYMax = 350
goalStates = makeGoalStates(goalX, goalYMin, goalYMax)
########################################################
# defining the car's initial state
########################################################
# lane number
initCarX = 0
# distance from the start of the highway where car starts
# CANT be 0
# initCarY = 200
initCarY = 100
# start the simulation at a time step of 0
initCarT = 0
# need to be safe and set some sort of min velocity
initCarVel = min(allowedLaneVelocites[initCarX])
return (allLanes, allVelocities, allowedLaneVelocites, maxDist,
maxTime, goalStates, initCarX, initCarY, initCarT, initCarVel,
savePath)
def makeGoalStates(goalX, goalYMin, goalYMax):
goalStates = []
for goalY in range(goalYMin, goalYMax + 1):
goal = (goalX, goalY)
goalStates.append(goal)
return goalStates