Add configurable NCE
This commit is contained in:
parent
779f74e825
commit
322d22ea6c
@ -25,6 +25,8 @@ SCALING = int(os.environ.get('DSE2021_SCALING', 1))
|
|||||||
STARTING_VELOCITY = 130 * SCALING
|
STARTING_VELOCITY = 130 * SCALING
|
||||||
# Interval between status updates in seconds (is not scaled)
|
# Interval between status updates in seconds (is not scaled)
|
||||||
UPDATE_INTERVAL = 1
|
UPDATE_INTERVAL = 1
|
||||||
|
# Specify if NCE should happen
|
||||||
|
NCE = int(os.environ.get('DSE2021_NCE', 1))
|
||||||
# At x km the NCE shall happen
|
# At x km the NCE shall happen
|
||||||
NCE_KM = 2.4
|
NCE_KM = 2.4
|
||||||
# Time in seconds to recover from NCE (will be scaled)
|
# Time in seconds to recover from NCE (will be scaled)
|
||||||
@ -109,7 +111,7 @@ class Vehicle:
|
|||||||
tl2_loc = geopy.Point(47.90937, 16.20814)
|
tl2_loc = geopy.Point(47.90937, 16.20814)
|
||||||
# Calculate point 400m south of traffic light 2
|
# Calculate point 400m south of traffic light 2
|
||||||
nce_point = d.destination(point=tl2_loc, bearing=182)
|
nce_point = d.destination(point=tl2_loc, bearing=182)
|
||||||
if self._nce_possible and not self._nce_happened:
|
if NCE == 1 and self._nce_possible and not self._nce_happened:
|
||||||
if self._gps_location.latitude >= nce_point.latitude:
|
if self._gps_location.latitude >= nce_point.latitude:
|
||||||
self._nce_happened = True
|
self._nce_happened = True
|
||||||
self._last_velocity = self.velocity
|
self._last_velocity = self.velocity
|
||||||
|
|||||||
@ -4,6 +4,7 @@ metadata:
|
|||||||
name: simulation-parameters-configmap
|
name: simulation-parameters-configmap
|
||||||
data:
|
data:
|
||||||
DSE2021_SCALING: "2"
|
DSE2021_SCALING: "2"
|
||||||
|
DSE2021_NCE: "1"
|
||||||
DSE2021_CAR1_SV: "130"
|
DSE2021_CAR1_SV: "130"
|
||||||
DSE2021_CAR2_SV: "130"
|
DSE2021_CAR2_SV: "130"
|
||||||
DSE2021_CAR3_SV: "130"
|
DSE2021_CAR3_SV: "130"
|
||||||
|
|||||||
@ -26,6 +26,11 @@ spec:
|
|||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
name: simulation-parameters-configmap
|
name: simulation-parameters-configmap
|
||||||
key: DSE2021_SCALING
|
key: DSE2021_SCALING
|
||||||
|
- name: DSE2021_NCE
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: simulation-parameters-configmap
|
||||||
|
key: DSE2021_NCE
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
serviceAccountName: ""
|
serviceAccountName: ""
|
||||||
volumes: null
|
volumes: null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user