@@ -7,9 +7,9 @@ Introduction
77Spatial maths capability underpins all of robotics and robotic vision.
88It provides the means to describe the relative position and orientation of objects in 2D or 3D space.
99This package provides Python classes and functions to represent, print, plot, manipulate and covert between such representations.
10- This includes relevant mathematical objects such as rotation matrices :math: `R \in SO( 2 ), SO( 3 ) `,
11- homogeneous transformation matrices :math: `T \in SE( 2 ), SE( 3 ) `, unit quaternions :math: `q \in S ^3 `,
12- and twists :math: `t \in se( 2 ), se( 3 ) `.
10+ This includes relevant mathematical objects such as rotation matrices :math: `\mat {R} \in \SO { 2 }, \SO { 3 } `,
11+ homogeneous transformation matrices :math: `\mat {T} \in \SE { 2 }, \SE { 3 } `, unit quaternions :math: `\ q \in \mathrm {S} ^3 `,
12+ and twists :math: `S \in \se { 2 }, \se { 3 } `.
1313
1414For example, we can create a rigid-body transformation that is a rotation about the x-axis of 30 degrees:
1515
@@ -19,7 +19,8 @@ For example, we can create a rigid-body transformation that is a rotation about
1919 >>> rotx(30 , ' deg' )
2020
2121
22- which results in a NumPy :math: `4 \times 4 ` array that belongs to the group SE(3). We could also create a class instance:
22+ which results in a NumPy :math: `4 \times 4 ` array that belongs to the group
23+ :math: `\SE {3 }`. We could also create a class instance:
2324
2425.. runblock :: pycon
2526
@@ -44,14 +45,12 @@ Spatial math classes
4445The package provides classes to represent pose and orientation in 3D and 2D
4546space:
4647
47- ============ ================== =============
48- Represents in 3D in 2D
49- ============ ================== =============
50- pose ``SE3 ``, ``SE2 ``,
51- ``Twist3 `` ``Twist2 ``
52- orientation ``SO3 `` , ``SO2 ``
53- ``UnitQuaternion ``
54- ============ ================== =============
48+ ============ =========================== ===================
49+ Represents in 3D in 2D
50+ ============ =========================== ===================
51+ pose ``SE3 `` ``Twist3 `` ``SE2 `` ``Twist2 ``
52+ orientation ``SO3 `` ``UnitQuaternion `` ``SO2 ``
53+ ============ =========================== ===================
5554
5655Additional classes include:
5756
@@ -62,24 +61,24 @@ Additional classes include:
6261These classes abstract, and implement appropriate operations, for the following
6362groups:
6463
65- ====================== ============================ = ======================
66- Group Name Class
67- ====================== ============================ = ======================
68- :math: `\mbox {SE( 3 ) }` rigid-body translation in 3D ``SE3 ``
69- :math: `\mbox {se( 3 )}` twist in 3D ``Twist3 ``
70- :math: `\mbox {SO( 3 )}` orientation in 3D ``SO3 ``
71- :math: `S ^3 ` unit quaternion ``UnitQuaternion ``
72- :math: `\mbox {SE( 2 ) }` rigid-body translation in 2D ``SE2 ``
73- :math: `\mbox {se( 2 )}` twist in 2D ``Twist2 ``
74- :math: `\mbox {SO( 2 )}` orientation in 2D ``SO2 ``
75- :math: `\mathbb {H}` quaternion ``Quaternion ``
76- :math: `P^5 ` Plücker lines ``Plucker ``
77- :math: `M^6 ` spatial velocity ``SpatialVelocity ``
78- :math: `M^6 ` spatial acceleration ``SpatialAcceleration ``
79- :math: `F^6 ` spatial force ``SpatialForce ``
80- :math: `F^6 ` spatial momentum ``SpatialMomentum ``
81- | spatial inertia ``SpatialInertia ``
82- ====================== ============================ = ======================
64+ ================================ ============================== ======================
65+ Group Name Class
66+ ================================ ============================== ======================
67+ :math: `\SE { 3 }` rigid-body transformaton in 3D ``SE3 ``
68+ :math: `\se { 3 }` twist in 3D ``Twist3 ``
69+ :math: `\SO { 3 }` orientation in 3D ``SO3 ``
70+ :math: `\mathrm {S} ^3 ` unit quaternion ``UnitQuaternion ``
71+ :math: `\SE { 2 }` rigid-body transformaton in 2D ``SE2 ``
72+ :math: `\se { 2 }` twist in 2D ``Twist2 ``
73+ :math: `\SO { 2 }` orientation in 2D ``SO2 ``
74+ :math: `\mathbb {H}` quaternion ``Quaternion ``
75+ :math: `P^5 ` Plücker lines ``Plucker ``
76+ :math: `M^6 ` spatial velocity ``SpatialVelocity ``
77+ :math: `M^6 ` spatial acceleration ``SpatialAcceleration ``
78+ :math: `F^6 ` spatial force ``SpatialForce ``
79+ :math: `F^6 ` spatial momentum ``SpatialMomentum ``
80+ :math: ` \mathbb {R}^{ 6 \times 6 }` spatial inertia ``SpatialInertia ``
81+ ================================ ============================== ======================
8382
8483
8584In addition to the merits of classes outlined above, classes ensure that the numerical value is always valid because the
@@ -180,10 +179,22 @@ Vector transformation
180179The classes ``SE3 ``, ``SO3 ``, ``SE2 ``, ``SO2 `` and ``UnitQuaternion `` support vector transformation when
181180premultiplying a vector (or a set of vectors columnwise in a NumPy array) using the ``* `` operator.
182181This is either rotation about the origin (for ``SO3 ``, ``SO2 `` and ``UnitQuaternion ``) or rotation and translation (``SE3 ``, ``SE2 ``).
182+ The implementation depends on the class of the object involved:
183183
184- For ``UnitQuaternion `` this is performed directly using Hamilton products :math: `q \circ \mathring {v} \circ q^{-1 }`.
185- For ``SO3 `` and ``SO2 `` this is a matrix-vector product, for ``SE3 `` and ``SE2 `` this is a matrix-vector product with the vectors
186- being first converted to homogeneous form, and the result converted back to Euclidean form.
184+ - for ``UnitQuaternion `` this is performed directly using Hamilton products
185+ :math: `\q \circ \mathring {v} \circ \q ^{-1 }`.
186+ - for ``SO3 `` and ``SO2 `` this is a matrix-vector product
187+ - for ``SE3 `` and ``SE2 `` this is a matrix-vector product with the vectors
188+ being first converted to homogeneous form, and the result converted back to
189+ Euclidean form.
190+
191+ .. runblock :: pycon
192+
193+ >>> from spatialmath import *
194+ >>> v = [1 , 2 , 3 ]
195+ >>> SO3 .Rx(0.3 ) * v
196+ >>> SE3 .Rx(0.3 ) * v
197+ >>> UnitQuaternion.Rx(0.3 ) * v
187198
188199Non-group operations
189200^^^^^^^^^^^^^^^^^^^^
@@ -198,7 +209,7 @@ performed elementwise, for example:
198209 >>> T = SE3 .Rx(0.3 )
199210 >>> T - T
200211
201- or in the case of a scalar broadcast to each element:
212+ or, in the case of a scalar, broadcast to each element:
202213
203214.. runblock :: pycon
204215
@@ -266,11 +277,16 @@ _indexcolor (None, 'yellow_2') Foreground, background color of index tag
266277_format '{:< 12g}' Format string for each matrix element
267278_suppress_small True Suppress *small * values, set to zero
268279_suppress_tol 100 Threshold for *small * values in eps units
280+ _ansimatrix False Display as a matrix with brackets
269281=============== =================== ============================================
270282
271283For example::
272284
273- >>> SE3._rotcolor = 'green'
285+ >>> SE3._rotcolor = 'green' # rotation part in green
286+
287+ or to supress color, perhaps for inclusion in documentation::
288+
289+ >>> SE3._color = False
274290
275291
276292Graphics
@@ -375,7 +391,7 @@ a Python list
375391where each item is an object of the same class as that it was extracted from.
376392Slice notation is also available, eg. ``R[0:-1:3] `` is a new SO3 instance containing every third element of ``R ``.
377393
378- In particular it includes an iterator allowing comprehensions:
394+ In particular it supports iteration which allows looping and comprehensions:
379395
380396.. runblock :: pycon
381397
@@ -412,7 +428,8 @@ Vectorization
412428.. image :: ../figs/broadcasting.png
413429
414430For most methods, if applied to an object that contains N elements, the result
415- will be the appropriate return object type with N elements.
431+ will be the appropriate return object type with N elements. In MATLAB this is
432+ referred to as *vectorization * and in NumPy as *broadcasting *.
416433
417434Most binary operations are vectorized: ``* ``, ``*= ``, ``** ``, ``/ ``, ``/= ``, ``+ ``, ``+= ``, ``- ``, ``-= ``,
418435``== ``, ``!= ``. For the case::
0 commit comments