|
@@ -11,7 +11,7 @@ import logHandler
|
|
conn = globalArduinoSlave()
|
|
conn = globalArduinoSlave()
|
|
|
|
|
|
|
|
|
|
-class AcusticSensor:
|
|
|
|
|
|
+class AcousticSensor:
|
|
def __init__(self, conf, ac_queue, calibration_state):
|
|
def __init__(self, conf, ac_queue, calibration_state):
|
|
self.conf = conf
|
|
self.conf = conf
|
|
self.ac_queue = ac_queue
|
|
self.ac_queue = ac_queue
|
|
@@ -30,7 +30,7 @@ class AcusticSensor:
|
|
self.overhead_right = float(conf["ac_sensor"]["overhead_right"])
|
|
self.overhead_right = float(conf["ac_sensor"]["overhead_right"])
|
|
|
|
|
|
self.log_handler = logHandler.get_log_handler()
|
|
self.log_handler = logHandler.get_log_handler()
|
|
- self.log_handler.log_and_print("start acustic sensor")
|
|
|
|
|
|
+ self.log_handler.log_and_print("start acoustic sensor")
|
|
|
|
|
|
# temporary calibration variables
|
|
# temporary calibration variables
|
|
self.time_vals = [[],[]]
|
|
self.time_vals = [[],[]]
|
|
@@ -55,12 +55,12 @@ class AcusticSensor:
|
|
self.calibration_state.next_state()
|
|
self.calibration_state.next_state()
|
|
|
|
|
|
def stop(self):
|
|
def stop(self):
|
|
- self.log_handler.log_and_print("stop acustic sensor")
|
|
|
|
|
|
+ self.log_handler.log_and_print("stop acoustic sensor")
|
|
self.dummyActive = False
|
|
self.dummyActive = False
|
|
conn.close()
|
|
conn.close()
|
|
|
|
|
|
def _readCb_dummy(self):
|
|
def _readCb_dummy(self):
|
|
- self.log_handler.log_and_print("acustic sensor: generating test values")
|
|
|
|
|
|
+ self.log_handler.log_and_print("acoustic sensor: generating test values")
|
|
while self.dummyActive:
|
|
while self.dummyActive:
|
|
if self.n % 4 < 1:
|
|
if self.n % 4 < 1:
|
|
dummyPosition = (0, self.n%1 * self.field_height)
|
|
dummyPosition = (0, self.n%1 * self.field_height)
|
|
@@ -87,12 +87,12 @@ class AcusticSensor:
|
|
if position != None:
|
|
if position != None:
|
|
self.pass_to_gui(position + dummyValue)
|
|
self.pass_to_gui(position + dummyValue)
|
|
time.sleep(0.012)
|
|
time.sleep(0.012)
|
|
- self.log_handler.log_and_print("acustic sensor: disabled test mode")
|
|
|
|
|
|
+ self.log_handler.log_and_print("acoustic sensor: disabled test mode")
|
|
|
|
|
|
def _readCb(self, raw):
|
|
def _readCb(self, raw):
|
|
if self.dummyActive == True:
|
|
if self.dummyActive == True:
|
|
self.dummyActive = False
|
|
self.dummyActive = False
|
|
- value = conn.getAcusticRTTs()
|
|
|
|
|
|
+ value = conn.getAcousticRTTs()
|
|
# partially missing values will be ignored
|
|
# partially missing values will be ignored
|
|
if value[0] >= 0 and value[1] >= 0:
|
|
if value[0] >= 0 and value[1] >= 0:
|
|
self.calibrate(value)
|
|
self.calibrate(value)
|
|
@@ -159,7 +159,7 @@ class AcusticSensor:
|
|
self.calibration_state.next_state()
|
|
self.calibration_state.next_state()
|
|
|
|
|
|
def read(self):
|
|
def read(self):
|
|
- value = conn.getAcusticRTTs()
|
|
|
|
|
|
+ value = conn.getAcousticRTTs()
|
|
return value
|
|
return value
|
|
|
|
|
|
def calculate_position(self, values):
|
|
def calculate_position(self, values):
|