-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_localization.py
37 lines (31 loc) · 949 Bytes
/
test_localization.py
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
32
33
34
35
36
37
from localization import particle_filter
from navigation import keyboard_control
from navigation import parameters as nav_p
from sensors import setup
from sensors.parameters import *
import time
NUM_PARTICLES = 40
STD_V = 1.6
STD_Y = 0.3
STD_M = 0.2
X = 0.6827 + 0.1425
Y = 1.2269 + 0.09
O = 0.0
def test_data_capture():
sensor_setup = setup.SensorSetup()
keyboard_controller = keyboard_control.KeyboardController()
pf = particle_filter.ParticleFilter(NUM_PARTICLES, X, Y, O)
try:
while True:
now = round(time.time() * 1000)
# Apply steering
key = keyboard_controller.keyboard_event()
# Get sensor data
sensor_data = sensor_setup.run(now)
pf.run(
key, sensor_data, sensor_poses, nav_p.VELOCITY, nav_p.TURN_RATE
)
except KeyboardInterrupt:
steering.stop(1)
if __name__ == "__main__":
test_data_capture()