|
5 | 5 | from abc import ABC
|
6 | 6 | from math import pi, atan2
|
7 | 7 | import numpy as np
|
| 8 | + |
8 | 9 | # from scipy import integrate, linalg, interpolate
|
9 | 10 | from pathlib import Path
|
10 | 11 | import matplotlib.pyplot as plt
|
|
14 | 15 | from spatialmath import SE2, base
|
15 | 16 | from roboticstoolbox import rtb_load_data
|
16 | 17 |
|
| 18 | + |
17 | 19 | class VehicleAnimationBase(ABC):
|
18 | 20 | """
|
19 | 21 | Abstract base class to support animation of a vehicle on Matplotlib plot
|
@@ -114,6 +116,7 @@ def __del__(self):
|
114 | 116 | if self._object is not None:
|
115 | 117 | self._object.remove()
|
116 | 118 |
|
| 119 | + |
117 | 120 | # ========================================================================= #
|
118 | 121 | class VehicleMarker(VehicleAnimationBase):
|
119 | 122 | def __init__(self, **kwargs):
|
@@ -161,6 +164,7 @@ def _add(self, x=None, **kwargs):
|
161 | 164 |
|
162 | 165 | # ========================================================================= #
|
163 | 166 |
|
| 167 | + |
164 | 168 | class VehiclePolygon(VehicleAnimationBase):
|
165 | 169 | def __init__(self, shape="car", scale=1, **kwargs):
|
166 | 170 | """
|
@@ -272,7 +276,7 @@ def __init__(self, filename, origin=None, scale=1, rotation=0):
|
272 | 276 |
|
273 | 277 | Creates an object that can be passed to a ``Vehicle`` subclass to
|
274 | 278 | 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. |
276 | 280 |
|
277 | 281 | The car is scaled to an image with a horizontal length (width) of
|
278 | 282 | ``scale`` in the units of the plot. By default the image is assumed to
|
@@ -416,7 +420,7 @@ def _update(self, x):
|
416 | 420 |
|
417 | 421 | V = np.diag(np.r_[0.02, 0.5 * pi / 180] ** 2)
|
418 | 422 |
|
419 |
| - v = VehiclePolygon(facecolor='None', edgecolor='k') |
| 423 | + v = VehiclePolygon(facecolor="None", edgecolor="k") |
420 | 424 | # v = VehicleIcon('greycar2', scale=2, rotation=90)
|
421 | 425 |
|
422 | 426 | veh = Bicycle(covar=V, animation=v, control=RandomPath(10), verbose=False)
|
|
0 commit comments