Merge remote-tracking branch 'origin/master'

This commit is contained in:
Marco Zeisler
2021-06-17 21:21:12 +02:00
7 changed files with 58 additions and 46 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ from pika.exceptions import AMQPConnectionError
SWITCHING_TIME = 15
# Scale speed of switching by factor x
SCALING = 1
SCALING = 6
class TrafficLight:
+3 -2
View File
@@ -19,7 +19,7 @@ STARTING_POINT = geopy.Point(47.89053, 16.20703)
# Driving direction in degrees: 0=N, 90=E, 180=S, 270=W
BEARING = 2
# Scale speed of vehicles by factor x
SCALING = 1
SCALING = 6
# in km/h
STARTING_VELOCITY = 130 * SCALING
# Interval between status updates in seconds (is not scaled)
@@ -170,7 +170,7 @@ class Vehicle:
driving_time = (updated_timestamp - old_timestamp).total_seconds()
# reached distance in kilometers: convert km/h to km/s and multiply by driving time
kilometers = self.velocity / 3600 * driving_time * SCALING
kilometers = self.velocity / 3600 * driving_time
# Define a general distance object, initialized with a distance of k km.
d = geopy.distance.distance(kilometers=kilometers)
@@ -231,6 +231,7 @@ class Vehicle:
self._driven_kms = 0
self.last_update = datetime.now()
self.nce = False
self.velocity = STARTING_VELOCITY
@circuit(failure_threshold=10, expected_exception=AMQPConnectionError)
def send_status_update(self):