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
+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:
@@ -110,7 +110,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))