Skip to content

Commit

Permalink
Merge pull request #54 from andycui97/master
Browse files Browse the repository at this point in the history
Test cleanup and trajectory time.
  • Loading branch information
andycui97 committed Apr 25, 2018
2 parents bbb9076 + c098153 commit 3fcf9bb
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 369 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ install:
script:
- python tests/test_velocity_action.py # or py.test for Python versions 3.5 and below
- python tests/test_simulator_step.py # or py.test for Python versions 3.5 and below
- python tests/test_simulator_multiple_steps.py # or py.test for Python versions 3.5 and below
- python tests/test_json_agents_init.py # or py.test for Python versions 3.5 and below
- python tests/test_render.py #or py.test for Python versions 3.5 and below
- python tests/test_supervisor.py #or py.test for Python version 3.5 and below
Expand Down
32 changes: 0 additions & 32 deletions gym_urbandriving/agents/traffic_light_agent.py

This file was deleted.

64 changes: 0 additions & 64 deletions gym_urbandriving/utils/data_logger.py

This file was deleted.

81 changes: 0 additions & 81 deletions gym_urbandriving/utils/plotter.py

This file was deleted.

22 changes: 21 additions & 1 deletion gym_urbandriving/utils/trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,27 @@ def add_point(self, p):
expanded_p = [p[self.dimensions_used.index(i)] if (i in self.dimensions_used) else np.nan for i in range(7)]
self._trajectory = np.append(self._trajectory, [expanded_p], axis=0)

def get_point(self, index):
def get_next_point(self, t):
"""
Returns next point taking into account time.
Specifically, returns the first point with time equal to or greater than specified time, or None if no points are left.
Returns
----------
point : np array
"""
assert ('t' in self.mode)
t_index = self.mode.index('t')
res = self.first()
while (res[t_index] < t and not self.is_empty()):
self.pop()
res = self.first()

if self.is_empty():
return None
return res

def get_point(self, index, t = None):
return self._trajectory[index][self.dimensions_used]

def get_renderable_points(self):
Expand Down
Binary file removed tests/rollout_0.npy
Binary file not shown.
37 changes: 0 additions & 37 deletions tests/test1.py

This file was deleted.

51 changes: 0 additions & 51 deletions tests/test4.py

This file was deleted.

0 comments on commit 3fcf9bb

Please sign in to comment.