added newlines for better readability
This commit is contained in:
parent
b068c9144a
commit
6c6701e156
@ -101,6 +101,7 @@ class Orchestrator:
|
|||||||
traffic_lights_geo = response.json()
|
traffic_lights_geo = response.json()
|
||||||
current_vel = received_daf_object.velocity
|
current_vel = received_daf_object.velocity
|
||||||
target_vel = 130 * SCALING
|
target_vel = 130 * SCALING
|
||||||
|
|
||||||
print('Nearest traffic lights: {}'.format(traffic_lights_geo['cursor']))
|
print('Nearest traffic lights: {}'.format(traffic_lights_geo['cursor']))
|
||||||
for traffic_light in traffic_lights_geo['cursor']:
|
for traffic_light in traffic_lights_geo['cursor']:
|
||||||
# Should only ever contain one traffic light (the next in line)
|
# 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()
|
time_until_switch = (next_switch_time - datetime.now()).total_seconds()
|
||||||
print('Distance to TL: {}'.format(distance))
|
print('Distance to TL: {}'.format(distance))
|
||||||
print('Time until switch in seconds: {}'.format(time_until_switch))
|
print('Time until switch in seconds: {}'.format(time_until_switch))
|
||||||
|
|
||||||
if self.tls[tl_id]['color'] is TrafficLightColor.RED:
|
if self.tls[tl_id]['color'] is TrafficLightColor.RED:
|
||||||
speed_needed_max = (distance / float(time_until_switch)) * 3.6
|
speed_needed_max = (distance / float(time_until_switch)) * 3.6
|
||||||
if speed_needed_max < 130 * SCALING:
|
if speed_needed_max < 130 * SCALING:
|
||||||
@ -119,6 +121,7 @@ class Orchestrator:
|
|||||||
target_vel = current_vel
|
target_vel = current_vel
|
||||||
else:
|
else:
|
||||||
target_vel = floor(speed_needed_max)
|
target_vel = floor(speed_needed_max)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Cannot make it on next green
|
# Cannot make it on next green
|
||||||
i = 2
|
i = 2
|
||||||
@ -127,6 +130,7 @@ class Orchestrator:
|
|||||||
speed_needed_max = (distance / float(next_green_phase_start)) * 3.6
|
speed_needed_max = (distance / float(next_green_phase_start)) * 3.6
|
||||||
i = i + 2
|
i = i + 2
|
||||||
target_vel = floor(speed_needed_max)
|
target_vel = floor(speed_needed_max)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Check if we can reach TL in time
|
# Check if we can reach TL in time
|
||||||
speed_needed_min = (distance / float(time_until_switch)) * 3.6
|
speed_needed_min = (distance / float(time_until_switch)) * 3.6
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user