diff --git a/src/roboticstoolbox/mobile/Vehicle.py b/src/roboticstoolbox/mobile/Vehicle.py index 4626ba94a..b9a8ef3b8 100644 --- a/src/roboticstoolbox/mobile/Vehicle.py +++ b/src/roboticstoolbox/mobile/Vehicle.py @@ -371,7 +371,7 @@ def control(self): >>> from roboticstoolbox import Bicycle, RandomPath >>> bike = Bicycle() - >>> bike.control = RandomPath(10) + >>> bike.control = RandomPath(workspace=10) >>> print(bike) :seealso: :meth:`run` :meth:`eval_control` :obj:`scipy.interpolate.interp1d` :class:`~roboticstoolbox.mobile.drivers.VehicleDriverBase` diff --git a/src/roboticstoolbox/mobile/drivers.py b/src/roboticstoolbox/mobile/drivers.py index 706694e1c..c4251d612 100644 --- a/src/roboticstoolbox/mobile/drivers.py +++ b/src/roboticstoolbox/mobile/drivers.py @@ -58,7 +58,13 @@ def __init__( [A, B, C, D] A:B C:D ============== ======= ======= """ - if hasattr(workspace, "workspace"): + if workspace is None: + # spatialmath.base.expand_dims(None) raises TypeError despite + # None being its own advertised default (see tech-debt.md in + # the spatialmath-python repo) — treat "no workspace" as None + # rather than relying on that default. + self._workspace = None + elif hasattr(workspace, "workspace"): # workspace can be defined by an object with a workspace attribute self._workspace = base.expand_dims(workspace.workspace) else: