let car drive north: BEARING = 0;
evaluate self.nce before self.velocity;
This commit is contained in:
parent
6fcbb12693
commit
b8ca4e6bfa
@ -12,7 +12,7 @@ STARTING_POINT = geopy.Point(48.853, 2.349)
|
|||||||
# in km/h
|
# in km/h
|
||||||
STARTING_VELOCITY = 130
|
STARTING_VELOCITY = 130
|
||||||
# Driving direction in degrees: 0=N, 90=E, 180=S, 270=W
|
# Driving direction in degrees: 0=N, 90=E, 180=S, 270=W
|
||||||
BEARING = 90
|
BEARING = 0
|
||||||
# Scale speed of vehicles by factor x
|
# Scale speed of vehicles by factor x
|
||||||
SCALING = 1
|
SCALING = 1
|
||||||
# At x km the NCE shall happen
|
# At x km the NCE shall happen
|
||||||
@ -49,9 +49,9 @@ class Vehicle:
|
|||||||
def daf(self):
|
def daf(self):
|
||||||
return DAF(vehicle_identification_number=self.vin,
|
return DAF(vehicle_identification_number=self.vin,
|
||||||
gps_location=self.gps_location,
|
gps_location=self.gps_location,
|
||||||
velocity=self.velocity,
|
|
||||||
timestamp=self.timestamp,
|
timestamp=self.timestamp,
|
||||||
near_crash_event=self.nce
|
near_crash_event=self.nce,
|
||||||
|
velocity=self.velocity,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -79,7 +79,7 @@ class Vehicle:
|
|||||||
# Define a general distance object, initialized with a distance of 1 km.
|
# Define a general distance object, initialized with a distance of 1 km.
|
||||||
d = geopy.distance.distance(kilometers=kilometers)
|
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.
|
# in order to go from point `start` to kilometers km bearing.
|
||||||
self._gps_location = d.destination(point=start, bearing=BEARING)
|
self._gps_location = d.destination(point=start, bearing=BEARING)
|
||||||
|
|
||||||
@ -107,5 +107,5 @@ if __name__ == "__main__":
|
|||||||
v1 = Vehicle(vin='SB164ABN1PE082986')
|
v1 = Vehicle(vin='SB164ABN1PE082986')
|
||||||
v1.start_driving()
|
v1.start_driving()
|
||||||
while True:
|
while True:
|
||||||
print(v1.gps_location, v1.driven_kms, v1.nce)
|
print(v1.daf)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user