let car drive north: BEARING = 0;

evaluate self.nce before self.velocity;
This commit is contained in:
Marco Zeisler 2021-05-15 16:45:35 +02:00
parent 6fcbb12693
commit b8ca4e6bfa

View File

@ -12,7 +12,7 @@ STARTING_POINT = geopy.Point(48.853, 2.349)
# in km/h
STARTING_VELOCITY = 130
# Driving direction in degrees: 0=N, 90=E, 180=S, 270=W
BEARING = 90
BEARING = 0
# Scale speed of vehicles by factor x
SCALING = 1
# At x km the NCE shall happen
@ -49,9 +49,9 @@ class Vehicle:
def daf(self):
return DAF(vehicle_identification_number=self.vin,
gps_location=self.gps_location,
velocity=self.velocity,
timestamp=self.timestamp,
near_crash_event=self.nce
near_crash_event=self.nce,
velocity=self.velocity,
)
@property
@ -79,7 +79,7 @@ class Vehicle:
# Define a general distance object, initialized with a distance of 1 km.
d = geopy.distance.distance(kilometers=kilometers)
# Use the `destination` method with a bearing of bearing degrees (90 is east)
# Use the `destination` method with a bearing of bearing degrees
# in order to go from point `start` to kilometers km bearing.
self._gps_location = d.destination(point=start, bearing=BEARING)
@ -107,5 +107,5 @@ if __name__ == "__main__":
v1 = Vehicle(vin='SB164ABN1PE082986')
v1.start_driving()
while True:
print(v1.gps_location, v1.driven_kms, v1.nce)
print(v1.daf)
time.sleep(1)