Skip to content

Commit

Permalink
test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsushiSakai committed Jul 15, 2018
1 parent 1c10aaa commit a14d2fc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
40 changes: 24 additions & 16 deletions PathPlanning/Eta3SplinePath/eta3_spline_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

# NOTE: *_pose is a 3-array: 0 - x coord, 1 - y coord, 2 - orientation angle \theta

show_animation = True


class eta3_path(object):
"""
Expand Down Expand Up @@ -184,11 +186,13 @@ def test1():
for i, u in enumerate(ui):
pos[:, i] = path.calc_path_point(u)

# plot the path
plt.plot(pos[0, :], pos[1, :])
plt.pause(1.0)
if show_animation:
# plot the path
plt.plot(pos[0, :], pos[1, :])
plt.pause(1.0)

plt.close("all")
if show_animation:
plt.close("all")


def test2():
Expand All @@ -212,11 +216,13 @@ def test2():
for i, u in enumerate(ui):
pos[:, i] = path.calc_path_point(u)

# plot the path
plt.plot(pos[0, :], pos[1, :])
plt.pause(1.0)
if show_animation:
# plot the path
plt.plot(pos[0, :], pos[1, :])
plt.pause(1.0)

plt.close("all")
if show_animation:
plt.close("all")


def test3():
Expand Down Expand Up @@ -273,14 +279,16 @@ def test3():
pos[:, i] = path.calc_path_point(u)

# plot the path
plt.figure('Path from Reference')
plt.plot(pos[0, :], pos[1, :])
plt.xlabel('x')
plt.ylabel('y')
plt.title('Path')
plt.pause(1.0)

plt.show()

if show_animation:
plt.figure('Path from Reference')
plt.plot(pos[0, :], pos[1, :])
plt.xlabel('x')
plt.ylabel('y')
plt.title('Path')
plt.pause(1.0)

plt.show()


def main():
Expand Down
10 changes: 10 additions & 0 deletions tests/test_eta3_spline_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

from unittest import TestCase
from PathPlanning.Eta3SplinePath import eta3_spline_path as m


class Test(TestCase):

def test1(self):
m.show_animation = False
m.main()

0 comments on commit a14d2fc

Please sign in to comment.