Skip to content

Commit 3c87247

Browse files
Merge branch 'master' into fix-sphinx-automation
2 parents 062468a + 550d6fb commit 3c87247

File tree

12 files changed

+68
-37
lines changed

12 files changed

+68
-37
lines changed

.github/CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ A number of people have contributed to this, and earlier, versions of this Toolb
33
* Jesse Haviland, 2020 (part of the ropy project)
44
* Luis Fernando Lara Tobar, 2008
55
* Josh Carrigg Hodson, Aditya Dua, Chee Ho Chan, 2017 (part of the robopy project)
6-
* Peter Corke
6+
* Peter Corke

.pre-commit-config.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ repos:
1818
rev: v4.5.0
1919
hooks:
2020
- id: end-of-file-fixer
21-
- id: debug-statements # Ensure we don't commit `import pdb; pdb.set_trace()`
2221
exclude: |
23-
(?x)^(
24-
docker/ros/web/static/.*|
25-
)$
22+
(?x)(
23+
^docs/
24+
)
25+
- id: debug-statements # Ensure we don't commit `import pdb; pdb.set_trace()`
2626
- id: trailing-whitespace
2727
exclude: |
28-
(?x)^(
29-
docker/ros/web/static/.*|
30-
(.*/).*\.patch|
31-
)$
28+
(?x)(
29+
^docs/
30+
)
3231
# - repo: https://github.com/pre-commit/mirrors-mypy
3332
# rev: v1.6.1
3433
# hooks:

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ clean: .FORCE
3939
(cd docs; make clean)
4040
-rm -r *.egg-info
4141
-rm -r dist build
42-

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "spatialmath-python"
3-
version = "1.1.13"
3+
version = "1.1.14"
44
authors = [
55
{ name="Peter Corke", email="[email protected]" },
66
]

spatialmath/base/README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import spatialmath as sm
2121
2222
R = sm.SO3.Rx(30, 'deg')
2323
print(R)
24-
1 0 0
25-
0 0.866025 -0.5
26-
0 0.5 0.866025
24+
1 0 0
25+
0 0.866025 -0.5
26+
0 0.5 0.866025
2727
```
2828
which constructs a rotation about the x-axis by 30 degrees.
2929

@@ -45,7 +45,7 @@ array([[ 1. , 0. , 0. ],
4545
[ 0. , 0.29552021, 0.95533649]])
4646
4747
>>> rotx(30, unit='deg')
48-
Out[438]:
48+
Out[438]:
4949
array([[ 1. , 0. , 0. ],
5050
[ 0. , 0.8660254, -0.5 ],
5151
[ 0. , 0.5 , 0.8660254]])
@@ -64,7 +64,7 @@ We also support multiple ways of passing vector information to functions that re
6464

6565
```
6666
transl2(1, 2)
67-
Out[442]:
67+
Out[442]:
6868
array([[1., 0., 1.],
6969
[0., 1., 2.],
7070
[0., 0., 1.]])
@@ -74,13 +74,13 @@ array([[1., 0., 1.],
7474

7575
```
7676
transl2( [1,2] )
77-
Out[443]:
77+
Out[443]:
7878
array([[1., 0., 1.],
7979
[0., 1., 2.],
8080
[0., 0., 1.]])
8181
8282
transl2( (1,2) )
83-
Out[444]:
83+
Out[444]:
8484
array([[1., 0., 1.],
8585
[0., 1., 2.],
8686
[0., 0., 1.]])
@@ -90,7 +90,7 @@ array([[1., 0., 1.],
9090

9191
```
9292
transl2( np.array([1,2]) )
93-
Out[445]:
93+
Out[445]:
9494
array([[1., 0., 1.],
9595
[0., 1., 2.],
9696
[0., 0., 1.]])
@@ -129,7 +129,7 @@ Using classes ensures type safety, for example it stops us mixing a 2D homogeneo
129129
These classes are all derived from two parent classes:
130130

131131
* `RTBPose` which provides common functionality for all
132-
* `UserList` which provdides the ability to act like a list
132+
* `UserList` which provdides the ability to act like a list
133133

134134
The latter is important because frequnetly in robotics we want a sequence, a trajectory, of rotation matrices or poses. However a list of these items has the type `list` and the elements are not enforced to be homogeneous, ie. a list could contain a mixture of classes.
135135

@@ -178,7 +178,7 @@ Out[259]: int
178178
179179
a = T[1,1]
180180
a
181-
Out[256]:
181+
Out[256]:
182182
cos(theta)
183183
type(a)
184184
Out[255]: cos
@@ -226,10 +226,3 @@ TypeError: can't convert expression to float
226226
| t2r | yes |
227227
| rotx | yes |
228228
| rotx | yes |
229-
230-
231-
232-
233-
234-
235-

spatialmath/base/argcheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""
77
Utility functions for testing and converting passed arguments. Used in all
8-
spatialmath functions and classes to provides for flexibility in argument types
8+
spatialmath functions and classes to provides for flexibility in argument types
99
that can be passed.
1010
"""
1111

spatialmath/base/symbolic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Symbolic arguments.
99
1010
If SymPy is not installed then only the standard numeric operations are
11-
supported.
11+
supported.
1212
"""
1313

1414
import math

spatialmath/base/transforms3d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
tr2rt,
4444
Ab2M,
4545
)
46-
from spatialmath.base.quaternions import r2q, q2r, qeye, qslerp
46+
from spatialmath.base.quaternions import r2q, q2r, qeye, qslerp, qunit
4747
from spatialmath.base.graphics import plotvol3, axes_logic
4848
from spatialmath.base.animate import Animate
4949
import spatialmath.base.symbolic as sym
@@ -1675,7 +1675,7 @@ def trinterp(start, end, s, shortest=True):
16751675
q1 = r2q(end)
16761676
qr = qslerp(q0, q1, s, shortest=shortest)
16771677

1678-
return q2r(qr)
1678+
return q2r(qunit(qr))
16791679

16801680
elif ismatrix(end, (4, 4)):
16811681
# SE(3) case
@@ -1697,7 +1697,7 @@ def trinterp(start, end, s, shortest=True):
16971697
qr = qslerp(q0, q1, s, shortest=shortest)
16981698
pr = p0 * (1 - s) + s * p1
16991699

1700-
return rt2tr(q2r(qr), pr)
1700+
return rt2tr(q2r(qunit(qr)), pr)
17011701
else:
17021702
return ValueError("Argument must be SO(3) or SE(3)")
17031703

spatialmath/base/transformsNd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def skew(v):
514514
if len(v) == 1:
515515
# fmt: off
516516
return np.array([
517-
[0.0, -v[0]],
517+
[0.0, -v[0]],
518518
[v[0], 0.0]
519519
]) # type: ignore
520520
# fmt: on

spatialmath/geom3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ def vec(self) -> R6:
507507
def skew(self) -> R4x4:
508508
r"""
509509
Line as a Plucker skew-symmetric matrix
510-
510+
511511
:return: Skew-symmetric matrix form of Plucker coordinates
512512
:rtype: ndarray(4,4)
513513
@@ -523,7 +523,7 @@ def skew(self) -> R4x4:
523523
-\omega_x & -\omega_y & -\omega_z & 0 \end{bmatrix}
524524
525525
.. note::
526-
526+
527527
- For two homogeneous points P and Q on the line, :math:`PQ^T-QP^T` is
528528
also skew symmetric.
529529
- The projection of Plucker line by a perspective camera is a

spatialmath/spatialvector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:top-classes: collections.UserList
1111
:parts: 1
1212
13-
.. note:: Compared to Featherstone's papers these spatial vectors have the
13+
.. note:: Compared to Featherstone's papers these spatial vectors have the
1414
translational components first, followed by rotational components.
1515
"""
1616

tests/test_pose3d.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,46 @@ def test_rtvec(self):
13891389
nt.assert_equal(rvec, [0, 1, 0])
13901390
nt.assert_equal(tvec, [2, 3, 4])
13911391

1392+
def test_interp(self):
1393+
# This data is taken from https://github.com/bdaiinstitute/spatialmath-python/issues/165
1394+
se3_1 = SE3()
1395+
se3_1.t = np.array(
1396+
[0.5705748101710814, 0.29623210833184527, 0.10764106509086407]
1397+
)
1398+
se3_1.R = np.array(
1399+
[
1400+
[0.2852875203191073, 0.9581330588259315, -0.024332536551692617],
1401+
[0.9582072394229962, -0.28568756930438033, -0.014882844564011068],
1402+
[-0.021211248608609852, -0.019069722856395098, -0.9995931315303468],
1403+
]
1404+
)
1405+
assert SE3.isvalid(se3_1.A)
1406+
1407+
se3_2 = SE3()
1408+
se3_2.t = np.array(
1409+
[0.5150284150005691, 0.25796537207802533, 0.1558725490743694]
1410+
)
1411+
se3_2.R = np.array(
1412+
[
1413+
[0.42058255728234184, 0.9064420651629983, -0.038380919906699236],
1414+
[0.9070822373513454, -0.4209501599465646, -0.0016665901233428627],
1415+
[-0.01766712176680449, -0.0341137119645545, -0.9992617912561634],
1416+
]
1417+
)
1418+
assert SE3.isvalid(se3_2.A)
1419+
1420+
path_se3 = se3_1.interp(end=se3_2, s=15, shortest=False)
1421+
1422+
angle = None
1423+
for i in range(len(path_se3) - 1):
1424+
assert SE3.isvalid(path_se3[i].A)
1425+
1426+
if angle is None:
1427+
angle = path_se3[i].angdist(path_se3[i + 1])
1428+
else:
1429+
test_angle = path_se3[i].angdist(path_se3[i + 1])
1430+
assert abs(test_angle - angle) < 1e-6
1431+
13921432

13931433
# ---------------------------------------------------------------------------------------#
13941434
if __name__ == "__main__":

0 commit comments

Comments
 (0)