From 66ec0406721cf7d7444e02e3a524483098130c10 Mon Sep 17 00:00:00 2001 From: Tobias Eidelpes Date: Thu, 17 Jun 2021 22:26:34 +0200 Subject: [PATCH] Initialize NCE 400m before TL 2 --- components/i_feed/devices/vehicle.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/i_feed/devices/vehicle.py b/components/i_feed/devices/vehicle.py index 41d3bc1..45aa7cf 100644 --- a/components/i_feed/devices/vehicle.py +++ b/components/i_feed/devices/vehicle.py @@ -104,8 +104,12 @@ class Vehicle: :return: True if NCE invoked, otherwise False """ + d = geopy.distance.distance(kilometers=0.4) + tl2_loc = geopy.Point(47.90937, 16.20814) + # Calculate point 400m south of traffic light 2 + nce_point = d.destination(point=tl2_loc, bearing=182) if self._nce_possible and not self._nce_happened: - if self._driven_kms >= NCE_KM: + if self._gps_location.latitude >= nce_point.latitude: self._nce_happened = True self._last_velocity = self.velocity self.velocity = 0