Skip to content

Commit 10aa1c0

Browse files
committed
make symbolic friendly
1 parent 6964886 commit 10aa1c0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎spatialmath/spatialvector.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ def __init__(self, m=None, r=None, I=None):
500500
501501
- ``SpatialInertia(I)`` is a spatial inertia object with a value equal
502502
to ``I`` (6x6).
503+
504+
:SymPy: supported
503505
"""
504506
super().__init__()
505507

@@ -515,9 +517,10 @@ def __init__(self, m=None, r=None, I=None):
515517
else:
516518
I = base.getmatrix(I, (3,3))
517519
C = base.skew(r)
520+
M = np.diag((m,) * 3) # sym friendly
518521
I = np.block([
519-
[m * np.eye(3), m * C.T],
520-
[m * C, I + m * C @ C.T]
522+
[M, m * C.T],
523+
[m * C, I + m * C @ C.T]
521524
])
522525
else:
523526
raise ValueError('bad values')

0 commit comments

Comments
 (0)