Skip to content

Commit 19eeed1

Browse files
committed
Merge branch 'future' of github.com:petercorke/robotics-toolbox-python into future
2 parents 9c98231 + 020a003 commit 19eeed1

29 files changed

+1137
-870
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
pip install .[dev,collision]
3030
pip install pytest-timeout
31-
pytest --timeout=50 --timeout_method thread -s
31+
pytest --ignore=roboticstoolbox/blocks --timeout=50 --timeout_method thread -s
3232
codecov:
3333
# If all tests pass:
3434
# Run coverage and upload to codecov
@@ -46,7 +46,7 @@ jobs:
4646
- name: Run coverage
4747
run: |
4848
pip install -e .[dev,collision,vpython]
49-
pytest --cov=roboticstoolbox --cov-report xml:coverage.xml
49+
pytest --ignore=roboticstoolbox/blocks --cov=roboticstoolbox --cov-report xml:coverage.xml
5050
coverage report
5151
- name: upload coverage to Codecov
5252
uses: codecov/codecov-action@v3

.github/workflows/test_future.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ jobs:
6969
pip install pytest-timeout
7070
python -c "import spatialgeometry"
7171
python -c "import roboticstoolbox"
72-
pytest --timeout=50 --timeout_method thread -s
72+
pytest --ignore=roboticstoolbox/blocks --timeout=50 --timeout_method thread -s

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313

1414
dependencies = [
1515
"numpy>=1.17.4",
16-
"spatialmath-python~=1.0.0",
16+
"spatialmath-python>=1.1.5",
1717
"spatialgeometry~=1.0.0",
1818
"pgraph-python",
1919
"scipy",

roboticstoolbox/blocks/mobile.py

-6
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,3 @@ def step(self, state=None, **kwargs):
451451
self.ax.relim()
452452
self.ax.autoscale_view()
453453
super().step(state=state)
454-
455-
def done(self, block=False, **kwargs):
456-
if self.bd.runtime.options.graphics:
457-
plt.show(block=block)
458-
459-
super().done()

roboticstoolbox/blocks/uav.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def plot3(h, x, y, z):
863863

864864
# plot the vehicle's centroid on the ground plane
865865
plot3(self.shadow, [z[0], 0], [-z[1], 0], [0, 0])
866-
plot3(self.groundmark, z[0], -z[1], 0)
866+
plot3(self.groundmark, [z[0]], [-z[1]], [0])
867867

868868
textstr = f"t={state.t: .2f}\nh={z[2]: .2f}\nγ={n[0]: .2f}"
869869
self.panel.set_text(textstr)

roboticstoolbox/mobile/Animations.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from abc import ABC
66
from math import pi, atan2
77
import numpy as np
8+
89
# from scipy import integrate, linalg, interpolate
910
from pathlib import Path
1011
import matplotlib.pyplot as plt
@@ -14,6 +15,7 @@
1415
from spatialmath import SE2, base
1516
from roboticstoolbox import rtb_load_data
1617

18+
1719
class VehicleAnimationBase(ABC):
1820
"""
1921
Abstract base class to support animation of a vehicle on Matplotlib plot
@@ -114,6 +116,7 @@ def __del__(self):
114116
if self._object is not None:
115117
self._object.remove()
116118

119+
117120
# ========================================================================= #
118121
class VehicleMarker(VehicleAnimationBase):
119122
def __init__(self, **kwargs):
@@ -161,6 +164,7 @@ def _add(self, x=None, **kwargs):
161164

162165
# ========================================================================= #
163166

167+
164168
class VehiclePolygon(VehicleAnimationBase):
165169
def __init__(self, shape="car", scale=1, **kwargs):
166170
"""
@@ -272,7 +276,7 @@ def __init__(self, filename, origin=None, scale=1, rotation=0):
272276
273277
Creates an object that can be passed to a ``Vehicle`` subclass to
274278
depict the moving robot as an image icon during simulation. The image
275-
is translated and rotated to represent the vehicle configuration.
279+
is translated and rotated to represent the vehicle configuration.
276280
277281
The car is scaled to an image with a horizontal length (width) of
278282
``scale`` in the units of the plot. By default the image is assumed to
@@ -416,7 +420,7 @@ def _update(self, x):
416420

417421
V = np.diag(np.r_[0.02, 0.5 * pi / 180] ** 2)
418422

419-
v = VehiclePolygon(facecolor='None', edgecolor='k')
423+
v = VehiclePolygon(facecolor="None", edgecolor="k")
420424
# v = VehicleIcon('greycar2', scale=2, rotation=90)
421425

422426
veh = Bicycle(covar=V, animation=v, control=RandomPath(10), verbose=False)

roboticstoolbox/mobile/DistanceTransformPlanner.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DistanceTransformPlanner(PlannerBase):
4040
4141
The map is described by a 2D occupancy ``occgrid`` whose elements are zero
4242
if traversable of nonzero if untraversable, ie. an obstacle.
43-
43+
4444
The cells are assumed to be unit squares. Crossing the cell horizontally or
4545
vertically is a travel distance of 1, and for the Euclidean distance
4646
measure, the crossing the cell diagonally is a distance of :math:`\sqrt{2}`.
@@ -106,7 +106,7 @@ def __str__(self):
106106

107107
return s
108108

109-
def plan(self, goal=None, animate=False, verbose=False):
109+
def plan(self, goal=None, animate=False, summary=False):
110110
r"""
111111
Plan path using distance transform
112112
@@ -135,7 +135,8 @@ def plan(self, goal=None, animate=False, verbose=False):
135135
self.occgrid.grid,
136136
goal=self._goal,
137137
metric=self._metric,
138-
animate=animate
138+
animate=animate,
139+
summary=summary,
139140
)
140141

141142
def next(self, position):
@@ -147,7 +148,7 @@ def next(self, position):
147148
:raises RuntimeError: no plan has been computed
148149
:return: next robot position
149150
:rtype: ndarray(2)
150-
151+
151152
Return the robot position that is one step closer to the goal. Called
152153
by :meth:`query` to find a path from start to goal.
153154
@@ -215,7 +216,7 @@ def plot_3d(self, path=None, ls=None):
215216
line/surface handling.
216217
"""
217218
fig = plt.figure()
218-
ax = fig.gca(projection="3d")
219+
ax = fig.add_subplot(111, projection="3d")
219220

220221
distance = self._distancemap
221222
X, Y = np.meshgrid(np.arange(distance.shape[1]), np.arange(distance.shape[0]))
@@ -273,7 +274,7 @@ def distancexform(occgrid, goal, metric="cityblock", animate=False, summary=Fals
273274
# - other cells are inf
274275
# - goal is zero
275276

276-
goal = base.getvector(goal, 2, dtype=np.int)
277+
goal = base.getvector(goal, 2, dtype=int)
277278

278279
distance = occgrid.astype(np.float32)
279280
distance[occgrid > 0] = np.nan # assign nan to obstacle cells

0 commit comments

Comments
 (0)