List of commits:
Subject Hash Author Date (UTC)
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
test case 2 fix(?) dd86d637d166707a31b644dad711c7a9e39dbc8d Jan Allersma 2017-11-04 10:55:03
Commit 09f121a8de8ef6f49abbf0a52b0e9d9c033ade58 - Some more fixes :D
Author: Jan Allersma
Author date (UTC): 2017-12-09 15:09
Committer name: Jan Allersma
Committer date (UTC): 2017-12-09 15:09
Parent(s): 1567c42fbaa689848d2ca2620e37bb83bb30eaf4
Signing key:
Tree: 4a8abb97a0027cf87dafaef29d58f7a14e01de81
File Lines added Lines deleted
TestResultsSimulator.txt 3 3
simulatie/connection.py 32 26
simulatie/model.py 2 2
simulatie/pyg.py 19 27
simulatie/trafficModel.py 7 0
File TestResultsSimulator.txt changed (mode: 100644) (index bd0fc12..27de9bb)
1 Voetgangers extra out of the blue. als ze op een vluchtheuvel moeten w8en.
1 Voetgangers extra out of the blue. als ze op een vluchtheuvel moeten w8en.. Maybe DONE?
2 2 Alle voetgangers freezen als eentje staat te w8en. Alle voetgangers freezen als eentje staat te w8en.
3 3 201 nog implemtenteren.. DONE! 201 nog implemtenteren.. DONE!
4 treinen nog implementeren
5 De simulator queue'd zelf.
4 treinen nog implementeren.. Maybe DONE?
5 De simulator queue'd zelf.. Is dat zo?
6 6 Als alles klaar is, stuur ie nul ipv count - 1.. DONE! Als alles klaar is, stuur ie nul ipv count - 1.. DONE!
File simulatie/connection.py changed (mode: 100644) (index 94ff54b..fc6cd90)
... ... RecieveConnection = pika.BlockingConnection(pika.ConnectionParameters(host=model
49 49 channel = SendConnection.channel() channel = SendConnection.channel()
50 50 recieve = RecieveConnection.channel() recieve = RecieveConnection.channel()
51 51
52 inputEnabled = True
53
52 54 recieve.queue_declare( recieve.queue_declare(
53 55 queue=model.recieveQueue, queue=model.recieveQueue,
54 56 arguments={'x-message-ttl' : 10000}, arguments={'x-message-ttl' : 10000},
 
... ... def sendMsg(msg, index, amount):
73 75 time.sleep(2) time.sleep(2)
74 76
75 77 def update(index, addCars, dirRequests): def update(index, addCars, dirRequests):
76 lights[index][1] += addCars
77 lights[index][2] = dirRequests
78 waitingVehicles = None
79 vehicleMutation = 0
80
81 if addCars < 0:
82 vehicleMutation *= -1
83
84 for i in range(0, vehicleMutation):
85 if addCars > 0:
86 lights[index][2].append(dirRequests[i])
87 else:
88 lights[index][2].pop()
89
90 if len(lights[index][2]) > 0:
91 waitingVehicles = lights[index][2]
92
93 msg = json.dumps({
94 "TrafficUpdate": {
95 "LightId": lights[index][0],
96 "Count": lights[index][1],
97 "DirectionRequests": waitingVehicles
98 }
99 }, sort_keys=True, indent=4, separators=(',',': '))
100
101 sendMsg(msg, index, amountOfCars) # Geeft deze functie de bug bij een transform?
78 if inputEnabled:
79 lights[index][1] += addCars
80 lights[index][2] = dirRequests
81 waitingVehicles = None
82 vehicleMutation = 0
83
84 if addCars < 0:
85 vehicleMutation *= -1
86
87 for i in range(0, vehicleMutation):
88 if addCars > 0:
89 lights[index][2].append(dirRequests[i])
90 else:
91 lights[index][2].pop()
92
93 if len(lights[index][2]) > 0:
94 waitingVehicles = lights[index][2]
95
96 msg = json.dumps({
97 "TrafficUpdate": {
98 "LightId": lights[index][0],
99 "Count": lights[index][1],
100 "DirectionRequests": waitingVehicles
101 }
102 }, sort_keys=True, indent=4, separators=(',',': '))
103
104 sendMsg(msg, index, amountOfCars) # Geeft deze functie de bug bij een transform?
105
106 else:
107 print("INPUT IS DISABLED!")
102 108
103 109 def listen(): def listen():
104 110 print('Waiting for a sign..') print('Waiting for a sign..')
File simulatie/model.py changed (mode: 100644) (index 33f1d9c..58417b9)
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 = '/8'
5 host = '141.252.237.60'
4 vhost = '/11'
5 host = '127.0.0.1'
6 6
7 7 recieveQueue = 'simulator' recieveQueue = 'simulator'
8 8 sendQueue = 'controller' sendQueue = 'controller'
File simulatie/pyg.py changed (mode: 100644) (index 93ca924..1ff7bbf)
1 1 #!/bin/env python #!/bin/env python
2 2
3 3 import sys, pygame import sys, pygame
4 import thread
4 import threading
5 5 import time import time
6 6 import json import json
7 7
8 8 import trafficModel as tm import trafficModel as tm
9 #import connection
9 import connection
10 10
11 11 vehicles = list() vehicles = list()
12 12 lights = list() lights = list()
 
... ... class Vehicle(object):
120 120 self.wp += 1 self.wp += 1
121 121 print("W: " + str(self.wp) + " / " + str(len(tm.queues[self.trafficId]))) print("W: " + str(self.wp) + " / " + str(len(tm.queues[self.trafficId])))
122 122
123 elif self.waiting: # Debug
124 time.sleep(1)
125 tm.lights[self.trafficId]["Status"] = 1 # Debug
123 #elif self.waiting: # Debug
124 #time.sleep(1)
125 # tm.lights[self.trafficId]["Status"] = 1 # Debug
126 126
127 127 elif not self.waiting and self.wp < len(tm.waypoints[self.trafficId][self.direction]): elif not self.waiting and self.wp < len(tm.waypoints[self.trafficId][self.direction]):
128 128 self.goto(tm.waypoints[self.trafficId][self.direction][self.wp][0], tm.waypoints[self.trafficId][self.direction][self.wp][1]) self.goto(tm.waypoints[self.trafficId][self.direction][self.wp][0], tm.waypoints[self.trafficId][self.direction][self.wp][1])
 
... ... class Vehicle(object):
136 136 self.waiting = True self.waiting = True
137 137
138 138 self.transform = self.checkForTransform() self.transform = self.checkForTransform()
139 # connection.update(self.trafficId, 1, self.direction)
139 connection.update(self.trafficId, 1, self.direction)
140 140 else: else:
141 141 pass # Destructor here? pass # Destructor here?
142 142
 
... ... class Vehicle(object):
144 144
145 145 def trafficCheck(self): def trafficCheck(self):
146 146 if tm.lights[self.trafficId]["Status"] != 0 and self.waiting and self.wp <= len(tm.queues[self.trafficId]): if tm.lights[self.trafficId]["Status"] != 0 and self.waiting and self.wp <= len(tm.queues[self.trafficId]):
147 # If trafficlight 601 is red and vehicle also needs to wait for 601...
148 if tm.lights[len(tm.lights) - 1]["Status"] == 0 and self.trafficId == 102 or 106 <= self.trafficId <= 108:
149 return
147 150 self.waiting = False self.waiting = False
148 151 self.wp = 0 self.wp = 0
149 #connection.update(self.trafficId, -1, self.direction)
152 connection.update(self.trafficId, -1, self.direction)
150 153 self.update() self.update()
151 154
152 155 clock = pygame.time.Clock() clock = pygame.time.Clock()
 
... ... def spawnTrein(naarGroningen):
163 166 else: else:
164 167 train = Vehicle(tm.queues[28][0][0], tm.queues[28][0][1],28)#9) train = Vehicle(tm.queues[28][0][0], tm.queues[28][0][1],28)#9)
165 168
166 def slagbomenDalen():
167 print("Lichten knipperen & bellen luiden")
168 time.sleep(5)
169 print("Slagbomen dalen..")
170 time.sleep(12)
171 print("Slagbomen zijn dicht.")
172
173 def slagbomenOpenen():
174 print("Slagbomen gaan open..")
175 time.sleep(12)
176 print("Slagbomen zijn open.")
177
178 def spawnVehicle(index):
179 vehicles.append(Vehicle(tm.queues[index][0][0], tm.queues[index][0][1], index))
169 def spawnVehicle(index, dirRequest):
170 vehicles.append(Vehicle(tm.queues[index][0][0], tm.queues[index][0][1], index, dirRequest))
180 171
181 172 # Mainloop # Mainloop
182 173 def gameloop(): def gameloop():
183 id = 5
184 car = Vehicle(tm.queues[id][0][0],tm.queues[id][0][1],id,4)
174 #id = 12
175 #car = Vehicle(tm.queues[id][0][0],tm.queues[id][0][1],id,None)
185 176
186 for i in range(0, len(tm.lights)):
187 lights.append(Light(i))
177 #for i in range(0, len(tm.lights)):
178 # lights.append(Light(i))
188 179
189 180 while True: while True:
190 181 clock.tick(60) clock.tick(60)
 
... ... def gameloop():
197 188 vehicle.trafficCheck() vehicle.trafficCheck()
198 189 #for light in lights: #for light in lights:
199 190 # light.lightCheck() # light.lightCheck()
200 car.trafficCheck()
191 #car.trafficCheck()
201 192 pygame.display.flip() pygame.display.flip()
202 193
203 gameloop()
194 # All below is debug stuff
195 #gameloop()
File simulatie/trafficModel.py changed (mode: 100644) (index 57a56ca..df788e2)
... ... queues = [
366 366 [ # 501 [ # 501
367 367 [-50, 650], [-50, 650],
368 368 [100, 650] [100, 650]
369 ],
370 [ # 502
371 [850, 650],
372 [750, 650]
369 373 ] ]
370 374 ] ]
371 375
 
... ... waypoints = [
458 462 ], ],
459 463 [ # 501 [ # 501
460 464 [[850, 650]] [[850, 650]]
465 ],
466 [ # 502
467 [[200, 650], [170, 700], [-50, 700]]
461 468 ] ]
462 469 ] ]
463 470
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