List of commits:
Subject Hash Author Date (UTC)
Commit after fixing issues during lecture 93b7f5e88a7a4427867054ebabe0505963b14da0 Jan Allersma 2017-12-13 12:49:55
Some more fixes :D 09f121a8de8ef6f49abbf0a52b0e9d9c033ade58 Jan Allersma 2017-12-09 15:09:38
Also added additional waypoints for 106. 1567c42fbaa689848d2ca2620e37bb83bb30eaf4 Jan Allersma 2017-12-07 13:40:56
Fixed some bugs (See TestResultsSimulator.txt for more info). 7c4466770f8b4da0af1156856a40b32cd11b6d37 Jan Allersma 2017-12-07 13:31:04
Werk van Simulator na testen 05/12/17. 80af7ffb5438b855a2e73fb185ba66c1cd50efe3 Jan Allersma 2017-12-05 09:45:11
Nieuwe plattegrond toegevoegd. b520f51bdd4a4d25e5d1a54cd094cf3b4632a369 Jan Allersma 2017-12-02 14:19:52
More Waypoints! 465108ac6a127bbda26b40989fd6a68cd3e00aad Jan Allersma 2017-11-30 12:52:22
Added voetganger. dad12c3d2eb2a7160838c3495e4a7a2d382e493f Jan Allersma 2017-11-30 12:32:35
Added all waiting waypoints for 1xx. bbba002738e0a26b085673400c76329d3055d8ba Jan Allersma 2017-11-29 12:00:37
Simulation now working correctly for ID's 101, 102 and 103. 1bc2fb65bb75b3a1f63cf7690472152fe1f32564 Jan Allersma 2017-11-28 16:22:53
Autos kunnen gespawned worden en rijden dan de goede richting op. b36ef1cafeda20d5753b72c6f8e6ac8423c42d95 Jan Allersma 2017-11-26 21:44:39
Last changes before test case 5. 258ba4735dfd2078f8e4f034fffed2bbbb086f2a Jan Allersma 2017-11-22 14:08:37
hallo dit is kapot maar het werkt woehoe 4475c2633e962688c71634d633ac8789524f16cf XCBouke 2017-11-22 13:58:54
It's actually working now! With a gameloop and new icons :D 0b65d450fea6d9f679029f2d6765c7e2d1126cdd Jan Allersma 2017-11-20 22:02:23
Something... Works?? 9a6afe028642b571483fccd6d6bdab10dee68e9c Jan Allersma 2017-11-20 15:14:07
User input for sending msg. cdd1c17cfe8cc73985945aad5878e4891e92eab1 Jan Allersma 2017-11-14 23:05:53
prutsen veel prusten f37cf730ff7a0ad2e08cd769da5f488051ac6dd4 XCBouke 2017-11-09 21:32:15
uglyJsonCode created online with Bitbucket ed6c9c541947ec64827b6e80ed959feb1b0f9b85 XCBouke 2017-11-09 14:29:36
Connectie created online with Bitbucket (send en recieve in 1) b484aff52014ff8d1dbaf8387cf1479cf236f33a XCBouke 2017-11-09 14:28:29
Ready for test case 3. Also BIG cleanup. bda906e19e3b82fb91df53eb2208e8def822c6b5 Jan Allersma 2017-11-05 21:38:16
Commit 93b7f5e88a7a4427867054ebabe0505963b14da0 - Commit after fixing issues during lecture
Author: Jan Allersma
Author date (UTC): 2017-12-13 12:49
Committer name: Jan Allersma
Committer date (UTC): 2017-12-13 12:49
Parent(s): 09f121a8de8ef6f49abbf0a52b0e9d9c033ade58
Signing key:
Tree: aa027b6ecf42a2f956a7ecb16d8555db44df26af
File Lines added Lines deleted
simulatie/connection.py 41 6
simulatie/model.py 2 2
simulatie/pyg.py 19 10
simulatie/traffic.py 4 4
simulatie/trafficModel.py 31 31
File simulatie/connection.py changed (mode: 100644) (index fc6cd90..fd3f1a3)
... ... def callback(ch, method, prop, body):
61 61 print(model.sendQueue + ': status recieved!') print(model.sendQueue + ': status recieved!')
62 62 pyg.update(body.decode('utf-8', 'ignore')) pyg.update(body.decode('utf-8', 'ignore'))
63 63
64 def sendMsg(msg, index, amount):
64 def purelySendMsg(msg):
65 channel.basic_publish (
66 exchange='',
67 routing_key=model.sendQueue,
68 body=msg
69 )
70
71 print('Msg sent.')
72
73 def sendMsg(msg, index, amount, dirRequests):
65 74 channel.basic_publish ( channel.basic_publish (
66 75 exchange='', exchange='',
67 76 routing_key=model.sendQueue, routing_key=model.sendQueue,
 
... ... def sendMsg(msg, index, amount):
71 80 print('Msg sent.') print('Msg sent.')
72 81
73 82 for i in range(0, amount): for i in range(0, amount):
74 pyg.spawnVehicle(index)
83 pyg.spawnVehicle(index, dirRequests)
75 84 time.sleep(2) time.sleep(2)
76 85
77 86 def update(index, addCars, dirRequests): def update(index, addCars, dirRequests):
78 87 if inputEnabled: if inputEnabled:
79 88 lights[index][1] += addCars lights[index][1] += addCars
80 lights[index][2] = dirRequests
89 #lights[index][2] = dirRequests
81 90 waitingVehicles = None waitingVehicles = None
82 91 vehicleMutation = 0 vehicleMutation = 0
83 92
 
... ... def update(index, addCars, dirRequests):
86 95
87 96 for i in range(0, vehicleMutation): for i in range(0, vehicleMutation):
88 97 if addCars > 0: if addCars > 0:
89 lights[index][2].append(dirRequests[i])
98 lights[index][2].append(dirRequests)
90 99 else: else:
91 100 lights[index][2].pop() lights[index][2].pop()
92 101
93 102 if len(lights[index][2]) > 0: if len(lights[index][2]) > 0:
94 103 waitingVehicles = lights[index][2] waitingVehicles = lights[index][2]
104 print(waitingVehicles)
95 105
96 106 msg = json.dumps({ msg = json.dumps({
97 107 "TrafficUpdate": { "TrafficUpdate": {
98 108 "LightId": lights[index][0], "LightId": lights[index][0],
99 109 "Count": lights[index][1], "Count": lights[index][1],
100 "DirectionRequests": waitingVehicles
110 "DirectionRequests": dirRequests
111 }
112 }, sort_keys=True, indent=4, separators=(',',': '))
113
114 sendMsg(msg, index, addCars, dirRequests) # Geeft deze functie de bug bij een transform?
115
116 else:
117 print("INPUT IS DISABLED!")
118
119 def transform(index, original):
120 if inputEnabled:
121 msg = json.dumps({
122 "TrafficUpdate": {
123 "LightId": lights[original][0],
124 "Count": 0,#lights[index][1],
125 "DirectionRequests": None
126 }
127 }, sort_keys=True, indent=4, separators=(',',': '))
128
129 purelySendMsg(msg)
130
131 msg = json.dumps({
132 "TrafficUpdate": {
133 "LightId": lights[index][0],
134 "Count": 1,#lights[index][1],
135 "DirectionRequests": None
101 136 } }
102 137 }, sort_keys=True, indent=4, separators=(',',': ')) }, sort_keys=True, indent=4, separators=(',',': '))
103 138
104 sendMsg(msg, index, amountOfCars) # Geeft deze functie de bug bij een transform?
139 purelySendMsg(msg)
105 140
106 141 else: else:
107 142 print("INPUT IS DISABLED!") print("INPUT IS DISABLED!")
File simulatie/model.py changed (mode: 100644) (index 58417b9..dc24b85)
1 1 # Jan Allersma: groep 8. Maakt simulator. # Jan Allersma: groep 8. Maakt simulator.
2 2 uname = 'softdev' uname = 'softdev'
3 3 passwd = 'softdev' passwd = 'softdev'
4 vhost = '/11'
5 host = '127.0.0.1'
4 vhost = '/9'
5 host = '141.252.237.86'
6 6
7 7 recieveQueue = 'simulator' recieveQueue = 'simulator'
8 8 sendQueue = 'controller' sendQueue = 'controller'
File simulatie/pyg.py changed (mode: 100644) (index 1ff7bbf..8e2eb29)
... ... class Light(object):
31 31
32 32 def lightCheck(self): def lightCheck(self):
33 33 self.lamp_tint = self.lamp.copy() self.lamp_tint = self.lamp.copy()
34 #if tm.lights[self.lightIndex] == 0: # ROOD
35 # self.lamp_tint.fill((250, 150, 150), None, pygame.BLEND_RGB_MULT)
36 #elif tm.lights[self.lightIndex] == 1: # ORANJE
37 self.lamp_tint.fill((190, 60, 60), None, pygame.BLEND_RGB_MULT)
38 #elif tm.lights[self.lightIndex] == 2: # GROEN
39
34 if tm.lights[self.lightIndex] == 0: # ROOD
35 self.lamp_tint.fill((250, 150, 150), None, pygame.BLEND_RGB_MULT)
36 elif tm.lights[self.lightIndex] == 1: # ORANJE
37 self.lamp_tint.fill((190, 60, 60), None, pygame.BLEND_RGB_MULT)
38 elif tm.lights[self.lightIndex] == 2: # GROEN
39 self.lamp_tint.fill((40, 190, 40), None, pygame.BLEND_RGB_MULT)
40
40 41 screen.blit(self.lamp_tint, self.rect) screen.blit(self.lamp_tint, self.rect)
41 42
42 43
 
... ... class Vehicle(object):
64 65 self.direction = 1 self.direction = 1
65 66 else: else:
66 67 print("ERROR: DIRECTION REQUEST NOT FOUND!") print("ERROR: DIRECTION REQUEST NOT FOUND!")
68 self.direction = 0
67 69
68 70 self.rect = self.auto.get_rect() self.rect = self.auto.get_rect()
69 71 self.dest = [x,y] self.dest = [x,y]
 
... ... class Vehicle(object):
130 132 print("NW: " + str(self.wp) + " / " + str(len(tm.waypoints[self.trafficId][self.direction]))) print("NW: " + str(self.wp) + " / " + str(len(tm.waypoints[self.trafficId][self.direction])))
131 133
132 134 elif not self.waiting: # Check for transform elif not self.waiting: # Check for transform
133 if self.transform != 0:
134 self.trafficId = self.transform
135 if str(self.transform) != "0":# and self.transform != None and self.transform != "":
136 #self.trafficId = self.transform
135 137 self.wp = 1 self.wp = 1
136 138 self.waiting = True self.waiting = True
137 139
138 140 self.transform = self.checkForTransform() self.transform = self.checkForTransform()
139 connection.update(self.trafficId, 1, self.direction)
141 connection.transform(self.transform, self.trafficId) # Connection.update moet geen nieuwe vehicle spawnen
142 self.trafficId = self.transform
143 print("TRANSFORM: " + str(self.transform))
140 144 else: else:
141 145 pass # Destructor here? pass # Destructor here?
142 146
 
... ... class Vehicle(object):
149 153 return return
150 154 self.waiting = False self.waiting = False
151 155 self.wp = 0 self.wp = 0
152 connection.update(self.trafficId, -1, self.direction)
156 connection.update(self.trafficId, -1, None)#self.direction)
153 157 self.update() self.update()
154 158
155 159 clock = pygame.time.Clock() clock = pygame.time.Clock()
 
... ... clock = pygame.time.Clock()
157 161 def update(jsonObj): def update(jsonObj):
158 162 result = json.loads(jsonObj) result = json.loads(jsonObj)
159 163 tm.lights = result['Lights'] tm.lights = result['Lights']
164 #for i in range(0, len(lights)):
165 #lights[i].lighCheck()
160 166
161 167
162 168 def spawnTrein(naarGroningen): def spawnTrein(naarGroningen):
 
... ... def spawnTrein(naarGroningen):
169 175 def spawnVehicle(index, dirRequest): def spawnVehicle(index, dirRequest):
170 176 vehicles.append(Vehicle(tm.queues[index][0][0], tm.queues[index][0][1], index, dirRequest)) vehicles.append(Vehicle(tm.queues[index][0][0], tm.queues[index][0][1], index, dirRequest))
171 177
178 for i in range(0, len(tm.lightsPos)):
179 lights.append(Light(i))
180
172 181 # Mainloop # Mainloop
173 182 def gameloop(): def gameloop():
174 183 #id = 12 #id = 12
File simulatie/traffic.py changed (mode: 100644) (index 8b0a0b6..db87130)
... ... while True:
11 11 print("Direction Reqeust:") print("Direction Reqeust:")
12 12 direction = raw_input() direction = raw_input()
13 13 #ui = list(ui) #ui = list(ui)
14 if direction == None:
15 print([connection.lights[int(vehicle)], connection.lights[1] + 1, None])
14 if direction == None or direction == "":
15 #print([connection.lights[int(vehicle)], connection.lights[1] + 1, 2])
16 16 connection.update(int(vehicle), 1, None) connection.update(int(vehicle), 1, None)
17 17 else: else:
18 print([connection.lights[int(vehicle)], connection.lights[1] + 1, int(direction)])
19 connection.update(int(vehicle), 1, int(direction))
18 #print([connection.lights[int(vehicle)], connection.lights[1] + 1, int(direction)])
19 connection.update(int(vehicle), 1, [int(direction)])
20 20
21 21 sys.exit() sys.exit()
File simulatie/trafficModel.py changed (mode: 100644) (index df788e2..d671846)
... ... lights = [
152 152 lightsPos = [ lightsPos = [
153 153 { {
154 154 "Id": 101, "Id": 101,
155 "position": [0, 0],
155 "position": [0, 50],
156 156 }, },
157 157 { {
158 158 "Id": 102, "Id": 102,
159 "position": [0, 0]
159 "position": [20, 50]
160 160 }, },
161 161 { {
162 162 "Id": 103, "Id": 103,
163 "position": [0, 0]
163 "position": [40, 50]
164 164 }, },
165 165 { {
166 166 "Id": 104, "Id": 104,
167 "position": [0, 0]
167 "position": [60, 50]
168 168 }, },
169 169 { {
170 170 "Id": 105, "Id": 105,
171 "position": [0, 0]
171 "position": [80, 50]
172 172 }, },
173 173 { {
174 174 "Id": 106, "Id": 106,
175 "position": [0, 0]
175 "position": [100, 50]
176 176 }, },
177 177 { {
178 178 "Id": 107, "Id": 107,
179 "position": [0, 0]
179 "position": [120, 50]
180 180 }, },
181 181 { {
182 182 "Id": 108, "Id": 108,
183 "position": [0, 0]
183 "position": [140, 50]
184 184 }, },
185 185 { {
186 186 "Id": 109, "Id": 109,
187 "position": [0, 0]
187 "position": [160, 50]
188 188 }, },
189 189 { {
190 190 "Id": 110, "Id": 110,
191 "position": [0, 0]
191 "position": [180, 50]
192 192 }, },
193 193 { {
194 194 "Id": 201, "Id": 201,
195 "position": [0, 0]
195 "position": [200, 50]
196 196 }, },
197 197 { {
198 198 "Id": 301, "Id": 301,
199 "position": [0, 0]
199 "position": [220, 50]
200 200 }, },
201 201 { {
202 202 "Id": 302, "Id": 302,
203 "position": [0, 0]
203 "position": [240, 50]
204 204 }, },
205 205 { {
206 206 "Id": 303, "Id": 303,
207 "position": [0, 0]
207 "position": [260, 50]
208 208 }, },
209 209 { {
210 210 "Id": 304, "Id": 304,
211 "position": [0, 0]
211 "position": [280, 50]
212 212 }, },
213 213 { {
214 214 "Id": 305, "Id": 305,
215 "position": [0, 0]
215 "position": [300, 50]
216 216 }, },
217 217 { {
218 218 "Id": 401, "Id": 401,
219 "position": [0, 0]
219 "position": [320, 50]
220 220 }, },
221 221 { {
222 222 "Id": 402, "Id": 402,
223 "position": [0, 0]
223 "position": [340, 50]
224 224 }, },
225 225 { {
226 226 "Id": 403, "Id": 403,
227 "position": [0, 0]
227 "position": [360, 50]
228 228 }, },
229 229 { {
230 230 "Id": 404, "Id": 404,
231 "position": [0, 0]
231 "position": [380, 50]
232 232 }, },
233 233 { {
234 234 "Id": 405, "Id": 405,
235 "position": [0, 0]
235 "position": [400, 50]
236 236 }, },
237 237 { {
238 238 "Id": 406, "Id": 406,
239 "position": [0, 0]
239 "position": [420, 50]
240 240 }, },
241 241 { {
242 242 "Id": 407, "Id": 407,
243 "position": [0, 0]
243 "position": [440, 50]
244 244 }, },
245 245 { {
246 246 "Id": 408, "Id": 408,
247 "position": [0, 0]
247 "position": [460, 50]
248 248 }, },
249 249 { {
250 250 "Id": 409, "Id": 409,
251 "position": [0, 0]
251 "position": [480, 50]
252 252 }, },
253 253 { {
254 254 "Id": 410, "Id": 410,
255 "position": [0, 0]
255 "position": [500, 50]
256 256 }, },
257 257 { {
258 258 "Id": 411, "Id": 411,
259 "position": [0, 0]
259 "position": [520, 50]
260 260 }, },
261 261 { {
262 262 "Id": 412, "Id": 412,
263 "position": [0, 0]
263 "position": [540, 50]
264 264 }, },
265 265 { {
266 266 "Id": 501, "Id": 501,
267 "position": [0, 0]
267 "position": [560, 50]
268 268 }, },
269 269 { {
270 270 "Id": 502, "Id": 502,
271 "position": [0, 0]
271 "position": [580, 50]
272 272 }, },
273 273 { {
274 274 "Id": 601, "Id": 601,
275 "position": [0, 0]
275 "position": [600, 50]
276 276 } }
277 277 ] ]
278 278
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-SoftDev

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-SoftDev

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-SoftDev

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main