added newlines for better readability

This commit is contained in:
Marco Zeisler 2021-06-17 21:20:50 +02:00
parent b068c9144a
commit 6c6701e156

View File

@ -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