Skip to content

Commit 976998b

Browse files
committed
Fix doc string, add unit test.
1 parent db0848b commit 976998b

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

spatialmath/pose2d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def x(self):
541541
``v.x`` is the first element of the translational vector component. If ``len(x)`` is:
542542
543543
- 1, return an float
544-
- N>1, return an ndarray with shape=(N,1)
544+
- N>1, return an ndarray with shape=(N,)
545545
"""
546546
if len(self) == 1:
547547
return self.A[0, 2]
@@ -561,7 +561,7 @@ def y(self):
561561
``v.y`` is the second element of the translational vector component. If ``len(x)`` is:
562562
563563
- 1, return an float
564-
- N>1, return an ndarray with shape=(N,1)
564+
- N>1, return an ndarray with shape=(N,)
565565
"""
566566
if len(self) == 1:
567567
return self.A[1, 2]

spatialmath/pose3d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ def x(self) -> float:
10441044
:return: first element of translational component of SE(3)
10451045
:rtype: float
10461046
1047-
If ``len(v) > 1``, return an array with shape=(N,1).
1047+
If ``len(v) > 1``, return an array with shape=(N,).
10481048
10491049
Example:
10501050
@@ -1077,7 +1077,7 @@ def y(self) -> float:
10771077
:return: second element of translational component of SE(3)
10781078
:rtype: float
10791079
1080-
If ``len(v) > 1``, return an array with shape=(N,1).
1080+
If ``len(v) > 1``, return an array with shape=(N,).
10811081
10821082
Example:
10831083
@@ -1110,7 +1110,7 @@ def z(self) -> float:
11101110
:return: third element of translational component of SE(3)
11111111
:rtype: float
11121112
1113-
If ``len(v) > 1``, return an array with shape=(N,1).
1113+
If ``len(v) > 1``, return an array with shape=(N,).
11141114
11151115
Example:
11161116

tests/test_pose3d.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,16 @@ def test_constructor(self):
793793
nt.assert_equal(T.y, t[1])
794794
nt.assert_equal(T.z, t[2])
795795

796+
TT = SE3([T, T, T])
797+
desired_shape = (3,)
798+
nt.assert_equal(TT.x.shape, desired_shape)
799+
nt.assert_equal(TT.y.shape, desired_shape)
800+
nt.assert_equal(TT.z.shape, desired_shape)
801+
802+
ones = np.ones(desired_shape)
803+
nt.assert_equal(TT.x, ones*t[0])
804+
nt.assert_equal(TT.y, ones*t[1])
805+
nt.assert_equal(TT.z, ones*t[2])
796806

797807
# copy constructor
798808
R = SE3.Rx(pi / 2)

0 commit comments

Comments
 (0)