subDesTagesMitExtraKaese 3 jaren geleden
bovenliggende
commit
1240930bfa
1 gewijzigde bestanden met toevoegingen van 1 en 1 verwijderingen
  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)