diff --git a/.github/CONTRIBUTORS.md b/.github/CONTRIBUTORS.md index 30162fb8..80467523 100644 --- a/.github/CONTRIBUTORS.md +++ b/.github/CONTRIBUTORS.md @@ -3,4 +3,4 @@ A number of people have contributed to this, and earlier, versions of this Toolb * Jesse Haviland, 2020 (part of the ropy project) * Luis Fernando Lara Tobar, 2008 * Josh Carrigg Hodson, Aditya Dua, Chee Ho Chan, 2017 (part of the robopy project) -* Peter Corke \ No newline at end of file +* Peter Corke diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36085fe2..4dc48cd6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,17 +18,16 @@ repos: rev: v4.5.0 hooks: - id: end-of-file-fixer - - id: debug-statements # Ensure we don't commit `import pdb; pdb.set_trace()` exclude: | - (?x)^( - docker/ros/web/static/.*| - )$ + (?x)( + ^docs/ + ) + - id: debug-statements # Ensure we don't commit `import pdb; pdb.set_trace()` - id: trailing-whitespace exclude: | - (?x)^( - docker/ros/web/static/.*| - (.*/).*\.patch| - )$ + (?x)( + ^docs/ + ) # - repo: https://github.com/pre-commit/mirrors-mypy # rev: v1.6.1 # hooks: diff --git a/Makefile b/Makefile index c129744d..ad24ab91 100644 --- a/Makefile +++ b/Makefile @@ -39,4 +39,3 @@ clean: .FORCE (cd docs; make clean) -rm -r *.egg-info -rm -r dist build - diff --git a/README.md b/README.md index a2db78e4..738395e7 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ space: | ------------ | ---------------- | -------- | | pose | ``SE3`` ``Twist3`` ``UnitDualQuaternion`` | ``SE2`` ``Twist2`` | | orientation | ``SO3`` ``UnitQuaternion`` | ``SO2`` | - - + + More specifically: * `SE3` matrices belonging to the group $\mathbf{SE}(3)$ for position and orientation (pose) in 3-dimensions @@ -160,26 +160,26 @@ For example, to create an object representing a rotation of 0.3 radians about th >>> from spatialmath import SO3, SE3 >>> R1 = SO3.Rx(0.3) >>> R1 - 1 0 0 - 0 0.955336 -0.29552 - 0 0.29552 0.955336 + 1 0 0 + 0 0.955336 -0.29552 + 0 0.29552 0.955336 ``` while a rotation of 30 deg about the z-axis is ```python >>> R2 = SO3.Rz(30, 'deg') >>> R2 - 0.866025 -0.5 0 - 0.5 0.866025 0 - 0 0 1 + 0.866025 -0.5 0 + 0.5 0.866025 0 + 0 0 1 ``` -and the composition of these two rotations is +and the composition of these two rotations is ```python >>> R = R1 * R2 - 0.866025 -0.5 0 - 0.433013 0.75 -0.5 - 0.25 0.433013 0.866025 + 0.866025 -0.5 0 + 0.433013 0.75 -0.5 + 0.25 0.433013 0.866025 ``` We can find the corresponding Euler angles (in radians) @@ -198,16 +198,16 @@ Frequently in robotics we want a sequence, a trajectory, of rotation matrices or >>> len(R) 3 >>> R[1] - 1 0 0 - 0 0.955336 -0.29552 - 0 0.29552 0.955336 + 1 0 0 + 0 0.955336 -0.29552 + 0 0.29552 0.955336 ``` and this can be used in `for` loops and list comprehensions. An alternative way of constructing this would be (`R1`, `R2` defined above) ```python ->>> R = SO3( [ SO3(), R1, R2 ] ) +>>> R = SO3( [ SO3(), R1, R2 ] ) >>> len(R) 3 ``` @@ -233,7 +233,7 @@ will produce a result where each element is the product of each element of the l Similarly ```python ->>> A = SO3.Ry(0.5) * R +>>> A = SO3.Ry(0.5) * R >>> len(R) 32 ``` @@ -242,7 +242,7 @@ will produce a result where each element is the product of the left-hand side wi Finally ```python ->>> A = R * R +>>> A = R * R >>> len(R) 32 ``` @@ -267,10 +267,10 @@ We can print and plot these objects as well ``` >>> T = SE3(1,2,3) * SE3.Rx(30, 'deg') >>> T.print() - 1 0 0 1 - 0 0.866025 -0.5 2 - 0 0.5 0.866025 3 - 0 0 0 1 + 1 0 0 1 + 0 0.866025 -0.5 2 + 0 0.5 0.866025 3 + 0 0 0 1 >>> T.printline() t = 1, 2, 3; rpy/zyx = 30, 0, 0 deg @@ -339,7 +339,7 @@ array([[1., 0., 1.], [0., 0., 1.]]) transl2( (1,2) ) -Out[444]: +Out[444]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) @@ -349,7 +349,7 @@ array([[1., 0., 1.], ``` transl2( np.array([1,2]) ) -Out[445]: +Out[445]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) @@ -436,7 +436,7 @@ Out[259]: int a = T[1,1] a -Out[256]: +Out[256]: cos(theta) type(a) Out[255]: cos diff --git a/spatialmath/base/README.md b/spatialmath/base/README.md index a4003ffc..baa3595a 100644 --- a/spatialmath/base/README.md +++ b/spatialmath/base/README.md @@ -21,9 +21,9 @@ import spatialmath as sm R = sm.SO3.Rx(30, 'deg') print(R) - 1 0 0 - 0 0.866025 -0.5 - 0 0.5 0.866025 + 1 0 0 + 0 0.866025 -0.5 + 0 0.5 0.866025 ``` which constructs a rotation about the x-axis by 30 degrees. @@ -45,7 +45,7 @@ array([[ 1. , 0. , 0. ], [ 0. , 0.29552021, 0.95533649]]) >>> rotx(30, unit='deg') -Out[438]: +Out[438]: array([[ 1. , 0. , 0. ], [ 0. , 0.8660254, -0.5 ], [ 0. , 0.5 , 0.8660254]]) @@ -64,7 +64,7 @@ We also support multiple ways of passing vector information to functions that re ``` transl2(1, 2) -Out[442]: +Out[442]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) @@ -74,13 +74,13 @@ array([[1., 0., 1.], ``` transl2( [1,2] ) -Out[443]: +Out[443]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) transl2( (1,2) ) -Out[444]: +Out[444]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) @@ -90,7 +90,7 @@ array([[1., 0., 1.], ``` transl2( np.array([1,2]) ) -Out[445]: +Out[445]: array([[1., 0., 1.], [0., 1., 2.], [0., 0., 1.]]) @@ -129,7 +129,7 @@ Using classes ensures type safety, for example it stops us mixing a 2D homogeneo These classes are all derived from two parent classes: * `RTBPose` which provides common functionality for all -* `UserList` which provdides the ability to act like a list +* `UserList` which provdides the ability to act like a list 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. @@ -178,7 +178,7 @@ Out[259]: int a = T[1,1] a -Out[256]: +Out[256]: cos(theta) type(a) Out[255]: cos @@ -226,10 +226,3 @@ TypeError: can't convert expression to float | t2r | yes | | rotx | yes | | rotx | yes | - - - - - - - diff --git a/spatialmath/base/argcheck.py b/spatialmath/base/argcheck.py index 38b5eb1a..9db91817 100644 --- a/spatialmath/base/argcheck.py +++ b/spatialmath/base/argcheck.py @@ -5,7 +5,7 @@ """ Utility functions for testing and converting passed arguments. Used in all -spatialmath functions and classes to provides for flexibility in argument types +spatialmath functions and classes to provides for flexibility in argument types that can be passed. """ diff --git a/spatialmath/base/symbolic.py b/spatialmath/base/symbolic.py index 2d92f4d4..a95aec4a 100644 --- a/spatialmath/base/symbolic.py +++ b/spatialmath/base/symbolic.py @@ -8,7 +8,7 @@ Symbolic arguments. If SymPy is not installed then only the standard numeric operations are -supported. +supported. """ import math diff --git a/spatialmath/base/transformsNd.py b/spatialmath/base/transformsNd.py index c04e5d8b..611c89a3 100644 --- a/spatialmath/base/transformsNd.py +++ b/spatialmath/base/transformsNd.py @@ -514,7 +514,7 @@ def skew(v): if len(v) == 1: # fmt: off return np.array([ - [0.0, -v[0]], + [0.0, -v[0]], [v[0], 0.0] ]) # type: ignore # fmt: on diff --git a/spatialmath/geom3d.py b/spatialmath/geom3d.py index 8b191ebd..896192dc 100755 --- a/spatialmath/geom3d.py +++ b/spatialmath/geom3d.py @@ -507,7 +507,7 @@ def vec(self) -> R6: def skew(self) -> R4x4: r""" Line as a Plucker skew-symmetric matrix - + :return: Skew-symmetric matrix form of Plucker coordinates :rtype: ndarray(4,4) @@ -523,7 +523,7 @@ def skew(self) -> R4x4: -\omega_x & -\omega_y & -\omega_z & 0 \end{bmatrix} .. note:: - + - For two homogeneous points P and Q on the line, :math:`PQ^T-QP^T` is also skew symmetric. - The projection of Plucker line by a perspective camera is a diff --git a/spatialmath/spatialvector.py b/spatialmath/spatialvector.py index f839e359..0f996bee 100644 --- a/spatialmath/spatialvector.py +++ b/spatialmath/spatialvector.py @@ -10,7 +10,7 @@ :top-classes: collections.UserList :parts: 1 -.. note:: Compared to Featherstone's papers these spatial vectors have the +.. note:: Compared to Featherstone's papers these spatial vectors have the translational components first, followed by rotational components. """