Subject | Hash | Author | Date (UTC) |
---|---|---|---|
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 |
Test case 2 | 9ea6eadbd85dde0e9522068718092b1f0e9b49f0 | Jan Allersma | 2017-10-29 22:37:57 |
Added threading. | 4540fe1669c9e145e613edf2459031e7bec500ea | Jan Allersma | 2017-10-29 20:47:49 |
Code for testing 16/10/17. Use simulatie/rabbit/combination.py mainly. | c5e87d7fe5abbcd3316b1538a0d647fd23faa59f | Jan Allersma | 2017-10-15 19:13:23 |
Added more paths. Some of them are WIP. | 03ad1039e22bd1ebd301bda99e78f38239a15077 | Jan Allersma | 2017-09-21 14:40:44 |
Added paths... | 5561d21918f048a40ca9686112638a48805917e3 | Jan Allersma | 2017-09-21 13:06:43 |
Added first paths of crossroad. Also added reference of crossroad. | 43a5ddf291e38b47bad02a92af58839d86f9d449 | Jan Allersma | 2017-09-21 12:21:53 |
Added first paths of crossroad. Also added reference of crossroad. | bb687a8152231d0c89fed827baefcfbf067be90c | Jan Allersma | 2017-09-21 12:21:11 |
Fixed typo. | db82c84f8d834e62cb37333ff973ddc54af5372f | Jan Allersma | 2017-09-20 20:51:15 |
RabbitMQ test.First attempt. | 876d29c668f5e027a820f3ff48a6ca080fc530c2 | Jan Allersma | 2017-09-19 13:47:31 |
Initial commit | 6a565c61a3337232d0e7a136ffb2f49b431c2a40 | Jan Allersma | 2017-09-11 06:52:38 |
File | Lines added | Lines deleted |
---|---|---|
genummerdKruispunt.png | 0 | 0 |
kruispunt.png | 0 | 0 |
simulatie/auto.png | 0 | 0 |
simulatie/ball.png | 0 | 0 |
simulatie/connection.py | 2 | 1 |
simulatie/kruispunt.xcf | 0 | 0 |
simulatie/kruispunt_doodle.xcf | 0 | 0 |
simulatie/model.py | 0 | 0 |
simulatie/paths.py | 0 | 14 |
simulatie/pyg.py | 61 | 0 |
simulatie/rabbit.py | 0 | 22 |
simulatie/reciever.py | 0 | 0 |
simulatie/sender.py | 0 | 0 |
simulatie/sim.py | 0 | 79 |
simulatie/test/connection.py | 2 | 1 |
simulatie/test/model.py | 0 | 0 |
simulatie/test/traffic.py | 0 | 0 |
simulatie/traffic.py | 3 | 2 |
File genummerdKruispunt.png deleted (index ece85d8..0000000) |
File kruispunt.png deleted (index 07406ce..0000000) |
File simulatie/auto.png added (mode: 100644) (index 0000000..15cfc2e) |
File simulatie/ball.png deleted (index 3998465..0000000) |
File simulatie/connection.py renamed from simulatie/rabbit/connection.py (similarity 95%) (mode: 100644) (index edaf55a..3bca4ad) | |||
... | ... | recieve = connection.channel() | |
9 | 9 | ||
10 | 10 | channel.exchange_declare( | channel.exchange_declare( |
11 | 11 | exchange='1234', | exchange='1234', |
12 | exchange_type='direct' | ||
12 | exchange_type='direct', | ||
13 | auto_delete=True | ||
13 | 14 | ) | ) |
14 | 15 | ||
15 | 16 | def callback(ch, method, prop, body): | def callback(ch, method, prop, body): |
File simulatie/kruispunt.xcf renamed from kruispunt.xcf (similarity 100%) |
File simulatie/kruispunt_doodle.xcf added (mode: 100644) (index 0000000..b16f0d8) |
File simulatie/model.py renamed from simulatie/rabbit/model.py (similarity 100%) |
File simulatie/paths.py deleted (index eea4fc9..0000000) | |||
1 | #!/bin/env python | ||
2 | |||
3 | n7 = [(30*17.5,1)] # WIP | ||
4 | |||
5 | n8 = [(30*18,1),(30*17.5,165)] | ||
6 | n8_1 = [(30*9+20,160),(30*12,160),(30*15,165),(30*16+10,165),(30*17.5,165)] | ||
7 | |||
8 | e1_1 = [(30*17.5,165),] # WIP | ||
9 | |||
10 | s1 = [(30*16,599),(30*15.8,500),(30*14,450),(30*11,390),(30*9,360)] | ||
11 | s1_1 = [(30*9,360),(30*9+10,310),(30*9+20,210),(30*9+20,150)] | ||
12 | |||
13 | w1 = [(1,255),(60,240),(30*6.5,150),(30*9+20,150)] | ||
14 | w7 = [(1,360),(30*6,340),(30*9,360)] |
File simulatie/pyg.py added (mode: 100644) (index 0000000..d490572) | |||
1 | #!/bin/env python | ||
2 | |||
3 | import sys, pygame | ||
4 | import thread | ||
5 | |||
6 | pygame.init() | ||
7 | |||
8 | screen = pygame.display.set_mode((800,600)) | ||
9 | screen.fill((255,255,255)) | ||
10 | speed= [1,1] | ||
11 | |||
12 | class Auto(object): | ||
13 | def __init__(self, x, y): | ||
14 | self.auto = pygame.image.load("auto.png") | ||
15 | self.auto = pygame.transform.scale(self.auto, (64,64)) | ||
16 | self.rect = self.auto.get_rect() | ||
17 | self.x = x | ||
18 | self.y = y | ||
19 | self.dest = [x,y] | ||
20 | |||
21 | def _move_callb(self): | ||
22 | origin = [self.x, self.y] | ||
23 | print(str(origin) + " -> " + str(self.dest) + "\n") | ||
24 | if origin[0] > self.dest[0]: | ||
25 | self.rect.move([-1,0]) | ||
26 | elif origin[0] < self.dest[0]: | ||
27 | self.rect.move([1,0]) | ||
28 | #screen.blit(self.auto, self.rect) | ||
29 | print("origin(" + str(origin) + ") > dest(" + str(self.dest) + ")\n") | ||
30 | if origin[1] > self.dest[1]: | ||
31 | self.rect.move([0,-1]) | ||
32 | elif origin[1] < self.dest[1]: | ||
33 | self.rect.move([0,1]) | ||
34 | #screen.blit(self.auto, self.rect) | ||
35 | print("origin(" + str(origin) + ") < dest(" + str(self.dest) + ")\n") | ||
36 | #screen.blit(self.auto, self.rect) | ||
37 | |||
38 | def goto(self, x, y): | ||
39 | self.dest = [x,y] | ||
40 | |||
41 | |||
42 | car = Auto(50,50) | ||
43 | #car.goto(1000, 1500) | ||
44 | clock = pygame.time.Clock() | ||
45 | |||
46 | # Mainloop | ||
47 | while True: | ||
48 | clock.tick(60) | ||
49 | for event in pygame.event.get(): | ||
50 | if event.type == pygame.QUIT: sys.exit() | ||
51 | |||
52 | car.rect = car.rect.move(speed) | ||
53 | if car.rect.left < 0 or car.rect.right > 800: | ||
54 | speed[0] = -speed[0] | ||
55 | if car.rect.top < 0 or car.rect.bottom > 600: | ||
56 | speed[1] = -speed[1] | ||
57 | |||
58 | # car._move_callb() | ||
59 | screen.fill((255,255,255)) | ||
60 | screen.blit(car.auto, car.rect) | ||
61 | pygame.display.flip() |
File simulatie/rabbit.py deleted (index c9e7c8a..0000000) | |||
1 | #!/bin/env python | ||
2 | |||
3 | import pika | ||
4 | |||
5 | def connect(): | ||
6 | while True: | ||
7 | connection = pika.BlockingConnection(pika.ConnectionParameters(host='127.0.0.1')) | ||
8 | channel = connection.channel() | ||
9 | |||
10 | channel.queue_declare(queue='h') | ||
11 | |||
12 | def callback(ch, method, prop, body): | ||
13 | print('%r ontvangen' % body) | ||
14 | |||
15 | channel.basic_consume ( | ||
16 | callback, | ||
17 | queue='h', | ||
18 | no_ack=True | ||
19 | ) | ||
20 | |||
21 | print('Waiting for a sign..') | ||
22 | channel.start_consuming() |
File simulatie/reciever.py renamed from simulatie/rabbit/reciever.py (similarity 100%) |
File simulatie/sender.py renamed from simulatie/rabbit/sender.py (similarity 100%) |
File simulatie/sim.py deleted (index 0b8f687..0000000) | |||
1 | #!/bin/env python | ||
2 | |||
3 | import sys, pygame | ||
4 | import rabbit | ||
5 | import thread | ||
6 | |||
7 | pygame.init() | ||
8 | |||
9 | speed = [2,2] | ||
10 | |||
11 | screen = pygame.display.set_mode((800, 600)) | ||
12 | |||
13 | ball = pygame.image.load("ball.png") | ||
14 | ballrect = ball.get_rect() | ||
15 | |||
16 | #thread.start_new_thread(rabbit.connect, ()) | ||
17 | |||
18 | def drawMap(): | ||
19 | kruispunt = pygame.image.load("../kruispunt.png") | ||
20 | screen.fill((255,255,255)) | ||
21 | screen.blit(kruispunt,kruispunt.get_rect()) | ||
22 | # drawSpoorlijn() | ||
23 | drawStrook35() | ||
24 | # drawStrook25() | ||
25 | # drawStrook16() | ||
26 | # drawStrook15() | ||
27 | # drawStrook14() | ||
28 | # drawStrook18() | ||
29 | # drawStrook22() | ||
30 | |||
31 | def drawSpoorlijn(): | ||
32 | pygame.draw.lines(screen, (100,100,100), False, [(799,450),(1,550)], 3) | ||
33 | pygame.draw.lines(screen, (100,100,100), False, [(799,460),(1,560)], 3) | ||
34 | for i in range(0, 27): | ||
35 | pygame.draw.lines(screen, (139,62,17), False, [(30*i,545-3.7*i),(30*i,565-3.7*i)], 2) | ||
36 | |||
37 | def drawStrook35(): | ||
38 | pygame.draw.rect(screen, (120,15,62), (30*18,1,5,5),10) | ||
39 | pygame.draw.rect(screen, (120,120,120), (30*12,160,5,5),10) | ||
40 | pygame.draw.rect(screen, (120,120,120), (30*15,165,5,5),10) | ||
41 | pygame.draw.rect(screen, (120,120,120), (30*16+10,165,5,5),10) | ||
42 | pygame.draw.rect(screen, (120,120,120), (30*18-15,165,5,5),10) | ||
43 | # pygame.draw.rect(screen, (120,120,120), (30*6,340,5,5),10) | ||
44 | # pygame.draw.rect(screen, (120,120,120), (1,360,5,5),10) | ||
45 | |||
46 | def drawStrook25(): | ||
47 | pygame.draw.lines(screen, (166,46,46), False, [(30*16+10,599),(30*15.8+10,500),(30*14,385),(30*11,355),(30*8,327),(30*6+10,320),(1,340)], 10) | ||
48 | |||
49 | def drawStrook16(): | ||
50 | pygame.draw.lines(screen, (90,90,90), False, [(30*18,599),(30*15,355),(30*12,320),(30*8,295),(30*4,295),(1,320)], 20) | ||
51 | |||
52 | def drawStrook15(): | ||
53 | pygame.draw.lines(screen, (90,90,90), False, [(30*19,599),(30*15,275),(30*12,240),(30*8,225),(30*4,245),(1,290)], 20) | ||
54 | |||
55 | def drawStrook14(): | ||
56 | pygame.draw.lines(screen, (90,90,90), False, [(30*20,599),(30*16,290),(30*15.5, 150),(30*16, 1)], 20) | ||
57 | |||
58 | def drawStrook18(): | ||
59 | pygame.draw.lines(screen, (90,90,90), False, [(1,320),(30*4,295),(30*8,275), (30*12,290),(30*16,345),(30*19,380),(30*22,390),(799,380)], 20) | ||
60 | |||
61 | def drawStrook22(): | ||
62 | pygame.draw.lines(screen, (166,46,46), False, [(30*16+10,599),(30*15.8+10,500),(30*14,385),(30*10,330),(30*11.5,1)], 10) | ||
63 | |||
64 | drawMap() | ||
65 | # Mainloop | ||
66 | while True: | ||
67 | for event in pygame.event.get(): | ||
68 | if event.type == pygame.QUIT: sys.exit() | ||
69 | |||
70 | # ballrect = ballrect.move(speed) | ||
71 | # if ballrect.left < 0 or ballrect.right > width: | ||
72 | # speed[0] *= -1; | ||
73 | # if ballrect.top < 0 or ballrect.bottom > height: | ||
74 | # speed[1] *= -1; | ||
75 | |||
76 | # screen.fill(0,0,0) # Black background | ||
77 | # screen.blit(ball, ballrect) | ||
78 | # drawMap() | ||
79 | pygame.display.flip() |
File simulatie/test/connection.py renamed from simulatie/rabbit/test/connection.py (similarity 96%) (mode: 100644) (index 72c16dd..06c8ed6) | |||
... | ... | recieve = connection.channel() | |
9 | 9 | ||
10 | 10 | channel.exchange_declare( | channel.exchange_declare( |
11 | 11 | exchange='1234', | exchange='1234', |
12 | exchange_type='direct' | ||
12 | exchange_type='direct', | ||
13 | auto_delete=True | ||
13 | 14 | ) | ) |
14 | 15 | ||
15 | 16 | def callback(ch, method, prop, body): | def callback(ch, method, prop, body): |
File simulatie/test/model.py renamed from simulatie/rabbit/test/model.py (similarity 100%) |
File simulatie/test/traffic.py renamed from simulatie/rabbit/test/traffic.py (similarity 100%) |
File simulatie/traffic.py renamed from simulatie/rabbit/traffic.py (similarity 90%) (mode: 100644) (index 2fabb42..d38dd2e) | |||
... | ... | import connection | |
6 | 6 | ||
7 | 7 | # lights = [[id, amountOfCars, DirRequests]] | # lights = [[id, amountOfCars, DirRequests]] |
8 | 8 | lights = [ | lights = [ |
9 | [101, 0, None] | ||
9 | [101, 0, None], | ||
10 | [102, 0, None] | ||
10 | 11 | ] | ] |
11 | 12 | ||
12 | 13 | msg = '' | msg = '' |
... | ... | def update(index, amountOfCars, dirRequests): | |
27 | 28 | ||
28 | 29 | update(0, 1, None) | update(0, 1, None) |
29 | 30 | time.sleep(5) | time.sleep(5) |
30 | update(0, 0, None) | ||
31 | update(1, 2, None) | ||
31 | 32 | ||
32 | 33 | raw_input() | raw_input() |
33 | 34 | sys.exit() | sys.exit() |