Removing travis warnings

This commit is contained in:
felipecode 2018-01-12 16:31:39 -02:00
parent 676656d20b
commit 6195653942
6 changed files with 49 additions and 8 deletions

View File

@ -16,7 +16,7 @@ from carla.planner.planner import Planner
class Agent(object):
def __init__(self, city_name):
__metaclass__ = abc.ABCMeta # Try to remove
self.__metaclass__ = abc.ABCMeta
self._planner = Planner(city_name)
def get_distance(self, start_point, end_point):

View File

@ -40,7 +40,7 @@ class Benchmark(object):
continue_experiment=False,
save_images=False):
__metaclass__ = abc.ABCMeta
self.__metaclass__ = abc.ABCMeta
self._city_name = city_name

View File

@ -128,7 +128,7 @@ class AStar(object):
heapq.heappush(self.opened, (self.start.f, self.start))
while len(self.opened):
# pop cell from heap queue
f, cell = heapq.heappop(self.opened)
_, cell = heapq.heappop(self.opened)
# add cell to closed list so we don't process it twice
self.closed.add(cell)
# if ending cell, return found path

View File

@ -84,7 +84,7 @@ class CityTrack(object):
route = a_star.solve()
# JuSt a Corner Case
# TODO: Clean this to avoid having to use this function
# Clean this to avoid having to use this function
if route is None:
a_star = AStar()
a_star.init_grid(self._map.get_graph_resolution()[0],

View File

@ -35,9 +35,9 @@ class Graph(object):
self._node_density = node_density
if graph_file is not None:
with open(graph_file, 'r') as file:
with open(graph_file, 'r') as f:
# Skipe the first four lines that
lines_after_4 = file.readlines()[4:]
lines_after_4 = f.readlines()[4:]
# the graph resolution.
linegraphres = lines_after_4[0]
@ -72,7 +72,7 @@ class Graph(object):
sorted(distance_dic.items()))
self._angles[node] = heading
for k, v in distance_dic.items():
for _, v in distance_dic.items():
start_to_goal = np.array([node[0] - v[0], node[1] - v[1]])
print(start_to_goal)
@ -116,7 +116,7 @@ class Graph(object):
lines = [[(p[0], p[1]), (p[0] + line_len * self._angles[p][0],
p[1] + line_len * self._angles[p][1])] for p in self._nodes]
lc = mc.LineCollection(lines, linewidth=2, color='green')
fig, ax = plt.subplots()
_, ax = plt.subplots()
ax.add_collection(lc)
ax.autoscale()

View File

@ -0,0 +1,41 @@
from carla import sensor
from carla.sensor import Camera
from carla.settings import CarlaSettings
from carla.tcp import TCPConnectionError
from carla.util import print_over_same_line
from carla.planner.planner import Planner
from carla.carla_server_pb2 import Control
planner= Planner('Town01')
resolution = planner._city_track._map.get_graph_resolution()
for i in range(resolution[0]):
for j in range(resolution[1]):
world_source = planner._city_track._map.convert_to_world((i,j))
source_ori = planner._city_track._map.get_lane_orientation(world_source)
print (' Making Route from (',i, ',',j,') o (',source_ori[0],',',source_ori[1],')')
for k in range(resolution[0]):
for l in range(resolution[1]):
world_target = planner._city_track._map.convert_to_world((k,l))
target_ori = planner._city_track._map.get_lane_orientation(world_target)
print (' To (',k, ',',l,') o (',target_ori[0],',',target_ori[1],')')
path_distance=planner.get_shortest_path_distance(
world_source,source_ori,world_target,target_ori)
#print ('Distance is ',path_distance)
command=planner.get_next_command(
world_source,source_ori,world_target,target_ori)
#print ('Command is ',command)
#print ('Latest Route ',planner._city_track._route)