subDesTagesMitExtraKaese 3 gadi atpakaļ
vecāks
revīzija
1240930bfa
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      raspberry-pi/sensors/opticalSensor.py

+ 1 - 1
raspberry-pi/sensors/opticalSensor.py

@@ -142,7 +142,7 @@ class OpticalSensor():
     centerX_perc, distance_perc = values
 
     visible_width_at_y = self.target_distance / distance_perc
-    x = self.x_offset - self.field_width/2 + visible_width_at_y * centerX_perc
+    x = self.x_offset + visible_width_at_y * (centerX_perc-0.5)
     alpha = (self.fov/2) / 180 * math.pi
     beta = (90 - self.fov/2) / 180 * math.pi
     y = visible_width_at_y/2 / math.sin(alpha) * math.sin(beta)