コード例 #1
0
 def show(self):
     self.get_outline()
     draw_point(self._pos, self._l / 2.0)
     plt.plot(self._outline_x, self._outline_y, color='black')
コード例 #2
0
        self._outline_x = [tail_l_x, tail_r_x, head_r_x, head_l_x, tail_l_x]
        self._outline_y = [tail_l_y, tail_r_y, head_r_y, head_l_y, tail_l_y]
        return self._outline_x, self._outline_y

    def show(self):
        self.get_outline()
        draw_point(self._pos, self._l / 2.0)
        plt.plot(self._outline_x, self._outline_y, color='black')


if __name__ == "__main__":
    car = Car(2.0, 1.0)
    plt.figure()
    start = [1, 1, math.pi / 3]
    end = [5, 10, -math.pi / 2]
    r = 5.0
    rspath = ReedsSheppPath(start, end, r)
    rspath.calc_paths()
    path, _ = rspath.get_shortest_path()
    print path
    xs, ys, yaws = ReedsSheppPath.gen_path(start, path, r, section=False)
    for i in range(len(xs)):
        plt.clf()
        draw_point(start)
        draw_point(end)
        plt.axis("equal")
        plt.plot(xs, ys)
        car.set_position([xs[i], ys[i], yaws[i]])
        car.show()
        plt.pause(0.1)
    plt.show()