Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
AboudyKreidieh committed May 8, 2020
1 parent 8d1ab52 commit c5dc19d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 6 additions & 3 deletions flow/core/kernel/simulation/traci.py
Expand Up @@ -46,9 +46,12 @@ def pass_api(self, kernel_api):
# subscribe some simulation parameters needed to check for entering,
# exiting, and colliding vehicles
self.kernel_api.simulation.subscribe([
tc.VAR_DEPARTED_VEHICLES_IDS, tc.VAR_ARRIVED_VEHICLES_IDS,
tc.VAR_TELEPORT_STARTING_VEHICLES_IDS, tc.VAR_TIME_STEP,
tc.VAR_DELTA_T, tc.VAR_LOADED_VEHICLES_NUMBER,
tc.VAR_DEPARTED_VEHICLES_IDS,
tc.VAR_ARRIVED_VEHICLES_IDS,
tc.VAR_TELEPORT_STARTING_VEHICLES_IDS,
tc.VAR_TIME_STEP,
tc.VAR_DELTA_T,
tc.VAR_LOADED_VEHICLES_NUMBER,
tc.VAR_DEPARTED_VEHICLES_NUMBER
])

Expand Down
12 changes: 8 additions & 4 deletions flow/core/kernel/vehicle/traci.py
Expand Up @@ -330,8 +330,12 @@ def _add_departed(self, veh_id, veh_type):

# subscribe the new vehicle
self.kernel_api.vehicle.subscribe(veh_id, [
tc.VAR_LANE_INDEX, tc.VAR_LANEPOSITION, tc.VAR_ROAD_ID,
tc.VAR_SPEED, tc.VAR_EDGES, tc.VAR_POSITION, tc.VAR_ANGLE,
tc.VAR_LANE_INDEX, tc.VAR_LANEPOSITION,
tc.VAR_ROAD_ID,
tc.VAR_SPEED,
tc.VAR_EDGES,
tc.VAR_POSITION,
tc.VAR_ANGLE,
tc.VAR_SPEED_WITHOUT_TRACI
])
self.kernel_api.vehicle.subscribeLeader(veh_id, 2000)
Expand Down Expand Up @@ -885,7 +889,7 @@ def _next_edge_leaders(self, veh_id, edge_dict, lane, num_edges):
if len(edge_dict[edge][lane]) > 0:
leader = edge_dict[edge][lane][0][0]
headway = edge_dict[edge][lane][0][1] - pos + add_length \
- self.get_length(leader)
- self.get_length(leader)
except KeyError:
# current edge has no vehicles, so move on
# print(traceback.format_exc())
Expand Down Expand Up @@ -1110,4 +1114,4 @@ def get_max_speed(self, veh_id, error=-1001):

def set_max_speed(self, veh_id, max_speed):
"""See parent class."""
self.kernel_api.vehicle.setMaxSpeed(veh_id, max_speed)
self.kernel_api.vehicle.setMaxSpeed(veh_id, max_speed)

0 comments on commit c5dc19d

Please sign in to comment.