Skip to content

Commit 48fe1d5

Browse files
hcarlssopetercorke
andauthored
Fix Reeds-Shepp planner (#358)
* Fix Reeds-Shepp planner * Fix import * Fix indentation --------- Co-authored-by: Peter Corke <peter.i.corke@gmail.com>
1 parent 87e396e commit 48fe1d5

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

roboticstoolbox/mobile/PlannerBase.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from roboticstoolbox.mobile.Animations import VehiclePolygon
2424
from colored import fg, attr
2525

26+
from spatialmath.base.graphics import axes_logic
27+
2628
try:
2729
from progress.bar import FillingCirclesBar
2830

roboticstoolbox/mobile/ReedsSheppPlanner.py

-16
Original file line numberDiff line numberDiff line change
@@ -539,21 +539,5 @@ def query(self, start, goal, **kwargs):
539539
path, status = reedsshepp.query(start, goal)
540540
print(status)
541541

542-
# px, py, pyaw, mode, clen = reeds_shepp_path_planning(
543-
# start_x, start_y, start_yaw, end_x, end_y, end_yaw, curvature, step_size)
544-
545-
# if show_animation: # pragma: no cover
546-
# plt.cla()
547-
# plt.plot(px, py, label="final course " + str(mode))
548-
549-
# # plotting
550-
# plot_arrow(start_x, start_y, start_yaw)
551-
# plot_arrow(end_x, end_y, end_yaw)
552-
553-
# plt.legend()
554-
# plt.grid(True)
555-
# plt.axis("equal")
556-
# plt.show(block=True)
557-
558542
reedsshepp.plot(path=path, direction=status.direction, configspace=True)
559543
plt.show(block=True)

tests/test_mobile.py

+19
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,30 @@
1616
from roboticstoolbox.mobile.drivers import *
1717
from roboticstoolbox.mobile.sensors import *
1818
from roboticstoolbox.mobile.Vehicle import *
19+
from roboticstoolbox.mobile.ReedsSheppPlanner import ReedsSheppPlanner
1920

2021
# from roboticstoolbox.mobile import Planner
2122

2223
# ======================================================================== #
2324

25+
class TestReedsSheppPlanner(unittest.TestCase):
26+
def test_turn_around(self):
27+
start = (0, 0, 0)
28+
goal = (0, 0, pi)
29+
30+
reedsshepp = ReedsSheppPlanner(curvature=1.0, stepsize=0.1)
31+
path, status = reedsshepp.query(start, goal)
32+
33+
# Turns
34+
self.assertEqual(status[0], ['L', 'R', 'L'])
35+
# Total length
36+
nt.assert_almost_equal(status[1], pi)
37+
# Segment lengths
38+
nt.assert_array_almost_equal(status[2],[pi/3, -pi/3, pi/3])
39+
40+
41+
# ======================================================================== #
42+
2443

2544
class TestNavigation(unittest.TestCase):
2645
def test_edgelist(self):

0 commit comments

Comments
 (0)