From 6c6701e156a3ef5fce26edb704a5f2f11c853ced Mon Sep 17 00:00:00 2001 From: Marco Zeisler Date: Thu, 17 Jun 2021 21:20:50 +0200 Subject: [PATCH] added newlines for better readability --- components/orchestration/orchestrator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/orchestration/orchestrator.py b/components/orchestration/orchestrator.py index 5277a01..3b11fd7 100644 --- a/components/orchestration/orchestrator.py +++ b/components/orchestration/orchestrator.py @@ -101,6 +101,7 @@ class Orchestrator: traffic_lights_geo = response.json() current_vel = received_daf_object.velocity target_vel = 130 * SCALING + print('Nearest traffic lights: {}'.format(traffic_lights_geo['cursor'])) for traffic_light in traffic_lights_geo['cursor']: # Should only ever contain one traffic light (the next in line) @@ -112,6 +113,7 @@ class Orchestrator: time_until_switch = (next_switch_time - datetime.now()).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: speed_needed_max = (distance / float(time_until_switch)) * 3.6 if speed_needed_max < 130 * SCALING: @@ -119,6 +121,7 @@ class Orchestrator: target_vel = current_vel else: target_vel = floor(speed_needed_max) + else: # Cannot make it on next green i = 2 @@ -127,6 +130,7 @@ class Orchestrator: speed_needed_max = (distance / float(next_green_phase_start)) * 3.6 i = i + 2 target_vel = floor(speed_needed_max) + else: # Check if we can reach TL in time speed_needed_min = (distance / float(time_until_switch)) * 3.6