-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain0_SensorModel.py
More file actions
31 lines (26 loc) · 936 Bytes
/
main0_SensorModel.py
File metadata and controls
31 lines (26 loc) · 936 Bytes
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
import env,sensors
import pygame
import math
environment = env.buildEnvironment((600, 1200))
#environment = env.buildEnvironment((600, 600))
environment.originalMap = environment.map.copy()
laser = sensors.LaserSensor(200, environment.originalMap, uncertainty= (0.05, 0.01))
environment.map.fill((0,0,0))
running = True
while running:
sensorON = False
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if pygame.mouse.get_focused():
sensorON = True
elif not pygame.mouse.get_focused():
sensorON = False
if sensorON:
position = pygame.mouse.get_pos()
laser.position = position
sensor_data = laser.sense_obstacles()
environment.dataStorage(sensor_data)
environment.show_sensorData()
environment.map.blit(environment.infomap, (0, 0))
pygame.display.update()