Implement correct scaling

This commit is contained in:
2021-06-17 19:52:52 +02:00
parent 5c492460b9
commit 81a41226a0
4 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import pickle
import sys
from typing import List, Dict
from datetime import datetime, timedelta
from math import floor, ceil
from math import floor
import requests
from dse_shared_libs import daf, traffic_light_state, traffic_light_color, target_velocity
@@ -22,7 +22,7 @@ sys.modules['target_velocity'] = target_velocity
ENTITY_IDENT_URL = 'http://entityident:5002/api/v1/resources/'
SCALING = 1
SCALING = 6
class Orchestrator:
@@ -109,7 +109,7 @@ class Orchestrator:
switching_time = self.tls[tl_id]['switching_time'] / float(SCALING)
# Time until next switch must be scaled accordingly
next_switch_time = self.tls[tl_id]['last_switch'] + timedelta(seconds=switching_time)
time_until_switch = (next_switch_time - datetime.now()).total_seconds()
time_until_switch = (next_switch_time - datetime.utcnow()).total_seconds()
print('Distance to TL: {}'.format(distance))
print('Time until switch in seconds: {}'.format(time_until_switch))
if self.tls[tl_id]['color'] is TrafficLightColor.RED: