diff --git a/.gitmodules b/.gitmodules index 1e4d54cf..b1850725 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule "PathPlanning/MixIntegerPathPlanning/matplotrecorder"] path = PathPlanning/MixIntegerPathPlanning/matplotrecorder url = https://github.com/AtsushiSakai/matplotrecorder -[submodule "PathPlanning/DynamicWindowApproach/matplotrecorder"] - path = PathPlanning/DynamicWindowApproach/matplotrecorder - url = https://github.com/AtsushiSakai/matplotrecorder [submodule "PathTracking/stanley_controller/pycubicspline"] path = PathTracking/stanley_controller/pycubicspline url = https://github.com/AtsushiSakai/pycubicspline diff --git a/.travis.yml b/.travis.yml index bfcfb013..c3ca49a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ before_install: - sudo apt-get -qq update - sudo apt-get install libboost-dev - sudo apt-get install libc++-dev - - git clone https://github.com/ghliu/pyReedsShepp - - cd pyReedsShepp install: - "pip install scipy" @@ -14,7 +12,7 @@ install: - "pip install matplotlib" - "pip install pandas" - "pip install Cython" - - "python setup.py install" + - "pip install git+https://github.com/ghliu/pyReedsShepp" script: - python --version diff --git a/PathPlanning/DynamicWindowApproach/dynamic_window_approach.py b/PathPlanning/DynamicWindowApproach/dynamic_window_approach.py index aa74a431..c1892aa2 100644 --- a/PathPlanning/DynamicWindowApproach/dynamic_window_approach.py +++ b/PathPlanning/DynamicWindowApproach/dynamic_window_approach.py @@ -9,8 +9,8 @@ author: Atsushi Sakai (@Atsushi_twi) import math import numpy as np import matplotlib.pyplot as plt -from matplotrecorder import matplotrecorder -matplotrecorder.donothing = True + +show_animation = True class Config(): @@ -187,21 +187,21 @@ def main(): traj = np.array(x) for i in range(1000): - plt.cla() u, ltraj = dwa_control(x, u, config, goal, ob) x = motion(x, u, config.dt) traj = np.vstack((traj, x)) # store state history - plt.plot(ltraj[:, 0], ltraj[:, 1], "-g") - plt.plot(x[0], x[1], "xr") - plt.plot(goal[0], goal[1], "xb") - plt.plot(ob[:, 0], ob[:, 1], "ok") - plot_arrow(x[0], x[1], x[2]) - plt.axis("equal") - plt.grid(True) - plt.pause(0.0001) - matplotrecorder.save_frame() + if show_animation: + plt.cla() + plt.plot(ltraj[:, 0], ltraj[:, 1], "-g") + plt.plot(x[0], x[1], "xr") + plt.plot(goal[0], goal[1], "xb") + plt.plot(ob[:, 0], ob[:, 1], "ok") + plot_arrow(x[0], x[1], x[2]) + plt.axis("equal") + plt.grid(True) + plt.pause(0.0001) # check goal if math.sqrt((x[0] - goal[0])**2 + (x[1] - goal[1])**2) <= config.robot_radius: @@ -209,10 +209,9 @@ def main(): break print("Done") - plt.plot(traj[:, 0], traj[:, 1], "-r") - matplotrecorder.save_frame() - matplotrecorder.save_movie("animation.gif", 0.1) - plt.show() + if show_animation: + plt.plot(traj[:, 0], traj[:, 1], "-r") + plt.show() if __name__ == '__main__': diff --git a/tests/test_dynamic_window_approach.py b/tests/test_dynamic_window_approach.py new file mode 100644 index 00000000..3abadbf5 --- /dev/null +++ b/tests/test_dynamic_window_approach.py @@ -0,0 +1,12 @@ +from unittest import TestCase + +from PathPlanning.DynamicWindowApproach import dynamic_window_approach as m + +print(__file__) + + +class Test(TestCase): + + def test1(self): + m.show_animation = False + m.main()