Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Add lights and fully working train. | ee0e851a1b482f162918f8723fc0c62d257aff83 | Jan Allersma | 2017-12-18 16:59:33 |
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 |
File | Lines added | Lines deleted |
---|---|---|
simulatie/Light.png | 0 | 0 |
simulatie/Trein.png | 0 | 0 |
simulatie/Trein.xcf | 0 | 0 |
simulatie/connection.py | 5 | 5 |
simulatie/model.py | 2 | 2 |
simulatie/pyg.py | 13 | 10 |
simulatie/trafficModel.py | 31 | 31 |
simulatie/trein.png | 0 | 0 |
simulatie/trein.xcf | 0 | 0 |
File simulatie/Light.png added (mode: 100644) (index 0000000..6fc16e3) |
File simulatie/Trein.png changed (mode: 100644) (index c7254fe..a144cc7) |
File simulatie/Trein.xcf changed (mode: 100644) (index 77f24a0..38b0825) |
File simulatie/connection.py changed (mode: 100644) (index fd3f1a3..e28c850) | |||
... | ... | def purelySendMsg(msg): | |
68 | 68 | body=msg | body=msg |
69 | 69 | ) | ) |
70 | 70 | ||
71 | print('Msg sent.') | ||
71 | print('Msg sent. (' + msg + ')') | ||
72 | 72 | ||
73 | 73 | def sendMsg(msg, index, amount, dirRequests): | def sendMsg(msg, index, amount, dirRequests): |
74 | 74 | channel.basic_publish ( | channel.basic_publish ( |
... | ... | def sendMsg(msg, index, amount, dirRequests): | |
77 | 77 | body=msg | body=msg |
78 | 78 | ) | ) |
79 | 79 | ||
80 | print('Msg sent.') | ||
80 | print('Msg sent. (' + msg + ')') | ||
81 | 81 | ||
82 | 82 | for i in range(0, amount): | for i in range(0, amount): |
83 | 83 | pyg.spawnVehicle(index, dirRequests) | pyg.spawnVehicle(index, dirRequests) |
... | ... | def update(index, addCars, dirRequests): | |
109 | 109 | "Count": lights[index][1], | "Count": lights[index][1], |
110 | 110 | "DirectionRequests": dirRequests | "DirectionRequests": dirRequests |
111 | 111 | } | } |
112 | }, sort_keys=True, indent=4, separators=(',',': ')) | ||
112 | }, sort_keys=False, indent=4, separators=(',',': ')) | ||
113 | 113 | ||
114 | 114 | sendMsg(msg, index, addCars, dirRequests) # Geeft deze functie de bug bij een transform? | sendMsg(msg, index, addCars, dirRequests) # Geeft deze functie de bug bij een transform? |
115 | 115 | ||
... | ... | def transform(index, original): | |
124 | 124 | "Count": 0,#lights[index][1], | "Count": 0,#lights[index][1], |
125 | 125 | "DirectionRequests": None | "DirectionRequests": None |
126 | 126 | } | } |
127 | }, sort_keys=True, indent=4, separators=(',',': ')) | ||
127 | }, sort_keys=False, indent=4, separators=(',',': ')) | ||
128 | 128 | ||
129 | 129 | purelySendMsg(msg) | purelySendMsg(msg) |
130 | 130 | ||
... | ... | def transform(index, original): | |
134 | 134 | "Count": 1,#lights[index][1], | "Count": 1,#lights[index][1], |
135 | 135 | "DirectionRequests": None | "DirectionRequests": None |
136 | 136 | } | } |
137 | }, sort_keys=True, indent=4, separators=(',',': ')) | ||
137 | }, sort_keys=False, indent=4, separators=(',',': ')) | ||
138 | 138 | ||
139 | 139 | purelySendMsg(msg) | purelySendMsg(msg) |
140 | 140 |
File simulatie/model.py changed (mode: 100644) (index dc24b85..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 = '/9' | ||
5 | host = '141.252.237.86' | ||
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 8e2eb29..03206e6) | |||
... | ... | bg = pygame.transform.scale(pygame.image.load("./PlattegrondV5.png"), (800,800)) | |
19 | 19 | ||
20 | 20 | class Light(object): | class Light(object): |
21 | 21 | def __init__(self, lightIndex): | def __init__(self, lightIndex): |
22 | self.lamp = pygame.image.load("light_color.png") | ||
22 | self.lamp = pygame.image.load("Light.png") | ||
23 | 23 | #self.lamp_tint = self.lamp() | #self.lamp_tint = self.lamp() |
24 | 24 | self.rect = self.lamp.get_rect() | self.rect = self.lamp.get_rect() |
25 | 25 | ||
... | ... | 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 | self.lamp_tint.fill((40, 190, 40), None, pygame.BLEND_RGB_MULT) | ||
34 | if tm.lights[self.lightIndex]['Status'] == 0: # ROOD | ||
35 | self.lamp_tint.fill((250, 0, 0), None, pygame.BLEND_RGB_MULT) | ||
36 | elif tm.lights[self.lightIndex]['Status'] == 1: # ORANJE | ||
37 | self.lamp_tint.fill((250, 100, 0), None, pygame.BLEND_RGB_MULT) | ||
38 | elif tm.lights[self.lightIndex]['Status'] == 2: # GROEN | ||
39 | self.lamp_tint.fill((0, 250, 0), None, pygame.BLEND_RGB_MULT) | ||
40 | else: | ||
41 | print("Light color undefined: ") | ||
42 | print(tm.lights[self.lightIndex]['Status']) | ||
40 | 43 | ||
41 | 44 | screen.blit(self.lamp_tint, self.rect) | screen.blit(self.lamp_tint, self.rect) |
42 | 45 | ||
... | ... | class Vehicle(object): | |
55 | 58 | elif trafficType < 500: # Is een voetganger | elif trafficType < 500: # Is een voetganger |
56 | 59 | self.auto = pygame.transform.scale(pygame.image.load("Voetganger.png"), (64,64)) | self.auto = pygame.transform.scale(pygame.image.load("Voetganger.png"), (64,64)) |
57 | 60 | elif trafficType < 600: # Is een trein | elif trafficType < 600: # Is een trein |
58 | self.auto = pygame.transform.scale(pygame.image.load("Trein.png"), (64,64)) | ||
61 | self.auto = pygame.transform.scale(pygame.image.load("trein.png"), (64,64)) | ||
59 | 62 | else: # zijn slagbomen | else: # zijn slagbomen |
60 | 63 | pass | pass |
61 | 64 | ||
... | ... | def gameloop(): | |
195 | 198 | screen.blit(bg, bg.get_rect()) | screen.blit(bg, bg.get_rect()) |
196 | 199 | for vehicle in vehicles: | for vehicle in vehicles: |
197 | 200 | vehicle.trafficCheck() | vehicle.trafficCheck() |
198 | #for light in lights: | ||
199 | # light.lightCheck() | ||
201 | for light in lights: | ||
202 | light.lightCheck() | ||
200 | 203 | #car.trafficCheck() | #car.trafficCheck() |
201 | 204 | pygame.display.flip() | pygame.display.flip() |
202 | 205 |
File simulatie/trafficModel.py changed (mode: 100644) (index d671846..6670c62) | |||
... | ... | lights = [ | |
152 | 152 | lightsPos = [ | lightsPos = [ |
153 | 153 | { | { |
154 | 154 | "Id": 101, | "Id": 101, |
155 | "position": [0, 50], | ||
155 | "position": [275, 140], | ||
156 | 156 | }, | }, |
157 | 157 | { | { |
158 | 158 | "Id": 102, | "Id": 102, |
159 | "position": [20, 50] | ||
159 | "position": [315, 140] | ||
160 | 160 | }, | }, |
161 | 161 | { | { |
162 | 162 | "Id": 103, | "Id": 103, |
163 | "position": [40, 50] | ||
163 | "position": [375, 140] | ||
164 | 164 | }, | }, |
165 | 165 | { | { |
166 | 166 | "Id": 104, | "Id": 104, |
167 | "position": [60, 50] | ||
167 | "position": [590, 340] | ||
168 | 168 | }, | }, |
169 | 169 | { | { |
170 | 170 | "Id": 105, | "Id": 105, |
171 | "position": [80, 50] | ||
171 | "position": [590, 390] | ||
172 | 172 | }, | }, |
173 | 173 | { | { |
174 | 174 | "Id": 106, | "Id": 106, |
175 | "position": [100, 50] | ||
175 | "position": [445, 660] | ||
176 | 176 | }, | }, |
177 | 177 | { | { |
178 | 178 | "Id": 107, | "Id": 107, |
179 | "position": [120, 50] | ||
179 | "position": [390, 660] | ||
180 | 180 | }, | }, |
181 | 181 | { | { |
182 | 182 | "Id": 108, | "Id": 108, |
183 | "position": [140, 50] | ||
183 | "position": [140, 430] | ||
184 | 184 | }, | }, |
185 | 185 | { | { |
186 | 186 | "Id": 109, | "Id": 109, |
187 | "position": [160, 50] | ||
187 | "position": [140, 390] | ||
188 | 188 | }, | }, |
189 | 189 | { | { |
190 | 190 | "Id": 110, | "Id": 110, |
191 | "position": [180, 50] | ||
191 | "position": [140, 350] | ||
192 | 192 | }, | }, |
193 | 193 | { | { |
194 | 194 | "Id": 201, | "Id": 201, |
195 | "position": [200, 50] | ||
195 | "position": [590, 290] | ||
196 | 196 | }, | }, |
197 | 197 | { | { |
198 | 198 | "Id": 301, | "Id": 301, |
199 | "position": [220, 50] | ||
199 | "position": [230, 240] | ||
200 | 200 | }, | }, |
201 | 201 | { | { |
202 | 202 | "Id": 302, | "Id": 302, |
203 | "position": [240, 50] | ||
203 | "position": [270, 230] | ||
204 | 204 | }, | }, |
205 | 205 | { | { |
206 | 206 | "Id": 303, | "Id": 303, |
207 | "position": [260, 50] | ||
207 | "position": [500, 230] | ||
208 | 208 | }, | }, |
209 | 209 | { | { |
210 | 210 | "Id": 304, | "Id": 304, |
211 | "position": [280, 50] | ||
211 | "position": [500, 590] | ||
212 | 212 | }, | }, |
213 | 213 | { | { |
214 | 214 | "Id": 305, | "Id": 305, |
215 | "position": [300, 50] | ||
215 | "position": [230, 500] | ||
216 | 216 | }, | }, |
217 | 217 | { | { |
218 | 218 | "Id": 401, | "Id": 401, |
219 | "position": [320, 50] | ||
219 | "position": [190, 240] | ||
220 | 220 | }, | }, |
221 | 221 | { | { |
222 | 222 | "Id": 402, | "Id": 402, |
223 | "position": [340, 50] | ||
223 | "position": [230, 190] | ||
224 | 224 | }, | }, |
225 | 225 | { | { |
226 | 226 | "Id": 403, | "Id": 403, |
227 | "position": [360, 50] | ||
227 | "position": [510, 190] | ||
228 | 228 | }, | }, |
229 | 229 | { | { |
230 | 230 | "Id": 404, | "Id": 404, |
231 | "position": [380, 50] | ||
231 | "position": [550, 240] | ||
232 | 232 | }, | }, |
233 | 233 | { | { |
234 | 234 | "Id": 405, | "Id": 405, |
235 | "position": [400, 50] | ||
235 | "position": [550, 590] | ||
236 | 236 | }, | }, |
237 | 237 | { | { |
238 | 238 | "Id": 406, | "Id": 406, |
239 | "position": [420, 50] | ||
239 | "position": [190, 500] | ||
240 | 240 | }, | }, |
241 | 241 | { | { |
242 | 242 | "Id": 407, | "Id": 407, |
243 | "position": [440, 50] | ||
243 | "position": [410, 190] | ||
244 | 244 | }, | }, |
245 | 245 | { | { |
246 | 246 | "Id": 408, | "Id": 408, |
247 | "position": [460, 50] | ||
247 | "position": [460, 190] | ||
248 | 248 | }, | }, |
249 | 249 | { | { |
250 | 250 | "Id": 409, | "Id": 409, |
251 | "position": [480, 50] | ||
251 | "position": [550, 390] | ||
252 | 252 | }, | }, |
253 | 253 | { | { |
254 | 254 | "Id": 410, | "Id": 410, |
255 | "position": [500, 50] | ||
255 | "position": [550, 430] | ||
256 | 256 | }, | }, |
257 | 257 | { | { |
258 | 258 | "Id": 411, | "Id": 411, |
259 | "position": [520, 50] | ||
259 | "position": [190, 340] | ||
260 | 260 | }, | }, |
261 | 261 | { | { |
262 | 262 | "Id": 412, | "Id": 412, |
263 | "position": [540, 50] | ||
263 | "position": [190, 300] | ||
264 | 264 | }, | }, |
265 | 265 | { | { |
266 | 266 | "Id": 501, | "Id": 501, |
267 | "position": [560, 50] | ||
267 | "position": [60, 650] | ||
268 | 268 | }, | }, |
269 | 269 | { | { |
270 | 270 | "Id": 502, | "Id": 502, |
271 | "position": [580, 50] | ||
271 | "position": [900, 900] # Is alleen een sensor. Wordt daarom buiten de plattegrond gerendered. | ||
272 | 272 | }, | }, |
273 | 273 | { | { |
274 | 274 | "Id": 601, | "Id": 601, |
275 | "position": [600, 50] | ||
275 | "position": [380, 600] | ||
276 | 276 | } | } |
277 | 277 | ] | ] |
278 | 278 |
File simulatie/trein.png added (mode: 100644) (index 0000000..25f2b6a) |
File simulatie/trein.xcf added (mode: 100644) (index 0000000..f5978db) |