|
@@ -49,7 +49,6 @@ class AcusticSensor:
|
|
|
elif action == "stop":
|
|
|
print("exit Sensor")
|
|
|
self.dummyActive = False
|
|
|
- dummyThread.join()
|
|
|
break
|
|
|
conn.close()
|
|
|
|
|
@@ -58,7 +57,7 @@ class AcusticSensor:
|
|
|
value = (900+random.randint(0,300),900+random.randint(0,300))
|
|
|
value = ((math.sin(self.n)+1)*400+900, (math.cos(self.n)+1)*400+900)
|
|
|
self.n += 0.02
|
|
|
-
|
|
|
+
|
|
|
if self.calibration_state.get_state() == self.calibration_state.ACCUMULATING_1:
|
|
|
value = (1541+random.randint(-50,50),2076+random.randint(-50,50))
|
|
|
|
|
@@ -71,7 +70,6 @@ class AcusticSensor:
|
|
|
|
|
|
def _readCb(self, raw):
|
|
|
value = conn.getAcusticRTTs()
|
|
|
- print("acc: ", value)
|
|
|
|
|
|
if self.dummyActive:
|
|
|
self.dummyActive = False
|
|
@@ -115,12 +113,14 @@ class AcusticSensor:
|
|
|
distancedif = distance_2 - distance_1
|
|
|
sonicspeed_2 = distancedif / timedif
|
|
|
overhead_2 = statistics.mean((self.cal_values["right"][0] - distance_1/sonicspeed_2, self.cal_values["right"][1] - distance_2/sonicspeed_2))
|
|
|
- print(distance_1,sonicspeed_1,distance_2,sonicspeed_2)
|
|
|
|
|
|
self.sonic_speed = statistics.mean((sonicspeed_1,sonicspeed_2))
|
|
|
self.overhead_left = overhead_1
|
|
|
self.overhead_right = overhead_2
|
|
|
- print("calibration result", self.sonic_speed, self.overhead_left, self.overhead_right)
|
|
|
+ print("calibration results:")
|
|
|
+ print(" sonicspeed: {:8.6f} mm/us".format(self.sonic_speed))
|
|
|
+ print(" overhead_left: {:8.3f} us".format(self.overhead_left))
|
|
|
+ print(" overhead_right: {:8.3f} us".format(self.overhead_right))
|
|
|
self.calibration_state.next_state()
|
|
|
|
|
|
def read(self):
|