8000 fix planner imports · aforechi/robotics-toolbox-python@a614b0e · GitHub
[go: up one dir, main page]

Skip to content

Commit a614b0e

Browse files
committed
fix planner imports
1 parent bc1d40d commit a614b0e

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

roboticstoolbox/mobile/Bug2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# from spatialmath.pose2d import SE2
1010
from spatialmath import base
1111
from spatialmath.base.animate import *
12+
from spatialmath.base.vectors import *
1213
from scipy.ndimage import *
1314
# from matplotlib import cm
1415
import matplotlib.pyplot as plt
@@ -247,7 +248,7 @@ def next(self, position):
247248
self.message(f" {position}: crossed the M-line")
248249

249250
# are we closer than when we encountered the obstacle?
250-
if base.norm(position - self._goal) < base.norm(self.H[-1] - self._goal):
251+
if norm(position - self._goal) < norm(self.H[-1] - self._goal):
251252
self._step = 1 # transition to step 1
252253
self.message(f" {position}: change to step 1")
253254
return n
@@ -323,7 +324,7 @@ def edgelist(im, p, direction=1):
323324
IAPR Workshop on Machine Vision Applications Dec. 13-15, 1994, Kawasaki
324325
325326
"""
326-
p = base.getvector(p, 2, dtype=int)
327+
p = getvector(p, 2, dtype=int)
327328

328329
if direction > 0:
329330
neighbours = np.arange(start=0, stop=8, step=1)

roboticstoolbox/mobile/PlannerBase.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from roboticstoolbox.mobile.OccGrid import BaseOccupancyGrid, BinaryOccupancyGrid
2121
from roboticstoolbox.mobile.Animations import VehiclePolygon
2222
from colored import fg, attr
23+
from spatialmath.base.graphics import axes_logic
24+
from spatialmath.base.graphics import plotvol2
2325

2426
try:
2527
from progress.bar import FillingCirclesBar
@@ -155,7 +157,7 @@ def start(self, start):
155157
if start is not None:
156158
if self.isoccupied(start):
157159
raise ValueError("Start location inside obstacle")
158-
self._start = base.getvector(start)
160+
self._start = getvector(start)
159161

160162
@property
161163
def goal(self):
@@ -185,7 +187,7 @@ def goal(self, goal):
185187
if goal is not None:
186188
if self.isoccupied(goal):
187189
raise ValueError("Goal location inside obstacle")
188-
self._goal = base.getvector(goal)
190+
self._goal = getvector(goal)
189191

190192
@property
191193
def verbose(self):
@@ -323,7 +325,7 @@ def validate_endpoint(self, p, dtype=None):
323325
:seealso: :meth:`isoccupied` :meth:`occgrid`
324326
"""
325327
if p is not None:
326-
p = base.getvector(p, self._ndims, dtype=dtype)
328+
p = getvector(p, self._ndims, dtype=dtype)
327329
if self.isoccupied(p):
328330
raise ValueError("Point is inside obstacle")
329331
return p
@@ -635,7 +637,7 @@ def plot(
635637
if configspace and ndims < 3 and path is not None:
636638
raise ValueError(f"path should have {ndims} rows")
637639

638-
ax = base.axes_logic(ax, ndims)
640+
ax = axes_logic(ax, ndims)
639641

640642
# plot occupancy grid background
641643
if background:
@@ -734,7 +736,7 @@ def plot(
734736

735737
elif ndims == 2 and self._ndims == 3:
736738
# 2d projection of 3d plot, show start/goal configuration
737-
scale = base.axes_get_scale(ax) / 10
739+
scale = axes_get_scale(ax) / 10
738740

739741
if self.marker is None:
740742
self.marker = VehiclePolygon(shape="car", scale=scale)
@@ -827,9 +829,9 @@ def plot_bg(
827829
return
828830

829831
if isinstance(self._occgrid, BaseOccupancyGrid):
830-
ax = base.plotvol2(dim=self._oc 5F79 cgrid.workspace, ax=ax)
832+
ax = plotvol2(dim=self._occgrid.workspace, ax=ax)
831833
else:
832-
ax = base.axes_logic(ax, 2)
834+
ax = axes_logic(ax, 2)
833835

834836
# create color map for free space + obstacle:
835837
# free space, color index = 1, white, alpha=0 to allow background and grid lines to show

0 commit comments

Comments
 (0)
0