Skip to content

Commit

Permalink
Fix Reeds-Shepp planner (#358)
Browse files Browse the repository at this point in the history
* Fix Reeds-Shepp planner

* Fix import

* Fix indentation

---------

Co-authored-by: Peter Corke <[email protected]>
  • Loading branch information
hcarlsso and petercorke authored Aug 10, 2024
1 parent 87e396e commit 48fe1d5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions roboticstoolbox/mobile/PlannerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from roboticstoolbox.mobile.Animations import VehiclePolygon
from colored import fg, attr

from spatialmath.base.graphics import axes_logic

try:
from progress.bar import FillingCirclesBar

Expand Down
16 changes: 0 additions & 16 deletions roboticstoolbox/mobile/ReedsSheppPlanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,21 +539,5 @@ def query(self, start, goal, **kwargs):
path, status = reedsshepp.query(start, goal)
print(status)

# px, py, pyaw, mode, clen = reeds_shepp_path_planning(
# start_x, start_y, start_yaw, end_x, end_y, end_yaw, curvature, step_size)

# if show_animation: # pragma: no cover
# plt.cla()
# plt.plot(px, py, label="final course " + str(mode))

# # plotting
# plot_arrow(start_x, start_y, start_yaw)
# plot_arrow(end_x, end_y, end_yaw)

# plt.legend()
# plt.grid(True)
# plt.axis("equal")
# plt.show(block=True)

reedsshepp.plot(path=path, direction=status.direction, configspace=True)
plt.show(block=True)
19 changes: 19 additions & 0 deletions tests/test_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,30 @@
from roboticstoolbox.mobile.drivers import *
from roboticstoolbox.mobile.sensors import *
from roboticstoolbox.mobile.Vehicle import *
from roboticstoolbox.mobile.ReedsSheppPlanner import ReedsSheppPlanner

# from roboticstoolbox.mobile import Planner

# ======================================================================== #

class TestReedsSheppPlanner(unittest.TestCase):
def test_turn_around(self):
start = (0, 0, 0)
goal = (0, 0, pi)

reedsshepp = ReedsSheppPlanner(curvature=1.0, stepsize=0.1)
path, status = reedsshepp.query(start, goal)

# Turns
self.assertEqual(status[0], ['L', 'R', 'L'])
# Total length
nt.assert_almost_equal(status[1], pi)
# Segment lengths
nt.assert_array_almost_equal(status[2],[pi/3, -pi/3, pi/3])


# ======================================================================== #


class TestNavigation(unittest.TestCase):
def test_edgelist(self):
Expand Down

0 comments on commit 48fe1d5

Please sign in to comment.