Small corrections on planner
This commit is contained in:
parent
67289ac7ee
commit
9d61a2e8d5
|
@ -285,8 +285,8 @@ class Benchmark(object):
|
|||
else:
|
||||
# Ask question, to avoid mistaken override situations
|
||||
answer = input("The experiment was already found in the files"
|
||||
+ ",Do you want to continue (y/n) ? \n"
|
||||
+ " If not the experiment will be overwritten")
|
||||
+ ", Do you want to continue (y/n) ? \n"
|
||||
)
|
||||
if answer == 'Yes' or answer == 'y':
|
||||
line_on_file = self._get_last_position()
|
||||
else:
|
||||
|
@ -331,7 +331,7 @@ class Benchmark(object):
|
|||
Must be redefined in an inherited class.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_all_statistics(self):
|
||||
"""
|
||||
|
@ -344,7 +344,7 @@ class Benchmark(object):
|
|||
"""
|
||||
Parse the experiment depending on number of poses and tasks
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@abc.abstractmethod
|
||||
def plot_summary_train(self):
|
||||
|
|
|
@ -37,28 +37,32 @@ class CityTrack(object):
|
|||
node_orientation = np.array([node_orientation[0],
|
||||
node_orientation[1]])
|
||||
|
||||
|
||||
node = tuple([ int(x) for x in node ])
|
||||
node = tuple([ int(x) for x in node ])
|
||||
|
||||
# Set to zero if it is less than zero.
|
||||
|
||||
|
||||
node =(max(0,node[0]),max(0,node[1]))
|
||||
node =(min(self._map.get_graph_resolution()[0]-1,node[0]),
|
||||
min(self._map.get_graph_resolution()[1]-1,node[1]))
|
||||
# is it x or y ? Check to avoid special corner cases
|
||||
|
||||
|
||||
if math.fabs(node_orientation[0]) > math.fabs(node_orientation[1]):
|
||||
node_orientation = (node_orientation[0], 0.0, 0.0)
|
||||
else:
|
||||
node_orientation = (0.0, node_orientation[1], 0.0)
|
||||
#if math.fabs(node_orientation[0]) > math.fabs(node_orientation[1]):
|
||||
# node_orientation = (node_orientation[0], 0.0, 0.0)
|
||||
#else:
|
||||
# node_orientation = (0.0, node_orientation[1], 0.0)
|
||||
|
||||
node = self._map._grid.search_on_grid(node[0],node[1])
|
||||
node = self._map._grid.search_on_grid(node[0], node[1])
|
||||
|
||||
|
||||
return node
|
||||
|
||||
|
||||
def get_pixel_density(self):
|
||||
return self._pixel_density
|
||||
def get_node_density(self):
|
||||
return self._node_density
|
||||
|
||||
def is_at_goal(self,source,target):
|
||||
return source == target
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Graph(object):
|
|||
A simple directed, weighted graph
|
||||
"""
|
||||
|
||||
def __init__(self, graph_file=None,node_density=50):
|
||||
def __init__(self, graph_file=None, node_density=50):
|
||||
|
||||
self._nodes = set()
|
||||
self._angles = {}
|
||||
|
|
|
@ -40,10 +40,10 @@ class CarlaMap(object):
|
|||
|
||||
# The built graph. This is the exact same graph that unreal builds. This
|
||||
# is a generic structure used for many cases
|
||||
self._graph = Graph(city_file)
|
||||
self._graph = Graph(city_file, node_density)
|
||||
|
||||
self._pixel_density = pixel_density
|
||||
self._grid = Grid(self._graph, node_density)
|
||||
self._grid = Grid(self._graph)
|
||||
# The number of game units per pixel. For now this is fixed.
|
||||
|
||||
self._converter = Converter(city_file, pixel_density, node_density)
|
||||
|
|
|
@ -117,7 +117,7 @@ class Planner(object):
|
|||
current_pos = node_iter
|
||||
|
||||
# We multiply by these values to convert distance to world coordinates
|
||||
return distance * self._city_track._map.get_pixel_density() \
|
||||
return distance * self._city_track.get_pixel_density() \
|
||||
* self._city_track.get_node_density()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue