Skip to content

Commit 5bb2cc6

Browse files
committed
add box shape
1 parent e8b28b1 commit 5bb2cc6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

roboticstoolbox/mobile/Animations.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@Author: Peter Corke, original MATLAB code and Python version
33
@Author: Kristian Gibson, initial MATLAB port
44
"""
5+
56
from abc import ABC
67
from math import pi, atan2
78
import numpy as np
@@ -194,6 +195,7 @@ def __init__(self, shape="car", scale=1, **kwargs):
194195
``shape`` can be:
195196
196197
* ``"car"`` a rectangle with chamfered front corners
198+
* ``"box"`` a rectangle
197199
* ``"triangle"`` an isocles triangle pointing in the forward direction
198200
* an 2xN NumPy array of vertices, does not have to be closed.
199201
@@ -205,6 +207,7 @@ def __init__(self, shape="car", scale=1, **kwargs):
205207
super().__init__()
206208
if isinstance(shape, str):
207209

210+
# consider vehicle at origin, pointing along +ve x-axis
208211
h = 0.3
209212
t = 0.8 # start of head taper
210213
c = 0.5 # centre x coordinate
@@ -221,6 +224,15 @@ def __init__(self, shape="car", scale=1, **kwargs):
221224
[-c, -h],
222225
]
223226
).T
227+
elif shape == "box":
228+
self._coords = np.array(
229+
[
230+
[-c, h],
231+
[w - c, h],
232+
[w - c, -h],
233+
[-c, -h],
234+
]
235+
).T
224236
elif shape == "triangle":
225237
self._coords = np.array(
226238
[

0 commit comments

Comments
 (0)