Skip to content

Fix trailing whitespace and end of file lines. #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
* Peter Corke
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ clean: .FORCE
(cd docs; make clean)
-rm -r *.egg-info
-rm -r dist build

50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
Expand Down Expand Up @@ -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.]])
Expand All @@ -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.]])
Expand Down Expand Up @@ -436,7 +436,7 @@ Out[259]: int

a = T[1,1]
a
Out[256]:
Out[256]:
cos(theta)
type(a)
Out[255]: cos
Expand Down
27 changes: 10 additions & 17 deletions spatialmath/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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]])
Expand All @@ -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.]])
Expand All @@ -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.]])
Expand All @@ -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.]])
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -178,7 +178,7 @@ Out[259]: int

a = T[1,1]
a
Out[256]:
Out[256]:
cos(theta)
type(a)
Out[255]: cos
Expand Down Expand Up @@ -226,10 +226,3 @@ TypeError: can't convert expression to float
| t2r | yes |
| rotx | yes |
| rotx | yes |







2 changes: 1 addition & 1 deletion spatialmath/base/argcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
2 changes: 1 addition & 1 deletion spatialmath/base/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Symbolic arguments.

If SymPy is not installed then only the standard numeric operations are
supported.
supported.
"""

import math
Expand Down
2 changes: 1 addition & 1 deletion spatialmath/base/transformsNd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spatialmath/geom3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spatialmath/spatialvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
Loading