-
Notifications
You must be signed in to change notification settings - Fork 84
Home
Naming principles:
All classes have constructors that accept a small number of different types, typically:
- no arguments, create a null value (eg. null rotation, null pose etc.)
- same type argument, clone the argument
- native value, eg. numpy array or list
- parametric representation, eg. x, y, θ
- lists of native values or parametric representations, initialise the internal list
To handle different parameteric representations we use class methods as alternative constructors, for example:
SO3.RPY(roll, pitch, yaw)
SO3.Eul(phi, theta, psi)
SO3.AngVec(angle, vector)
SO3.Exp(twist)
These are methods on the class and are capitalised or have an initial capital letter.
These are methods on an instance and convert to a different parameterisation, for example:
-
x.rpy()
convertSO3
orSE3
to roll-pitch-yaw angles -
x.eul()
convert to Euler angles
While they have similar names to the variant constructors:
- they perform an inverse function, the constructors are parameters → object, while the converters are object → parameters
- there can be no ambiguity since converters operators on instances whereas constructors operate on classes
Converters are always methods, since they may accept parameters.
A is for "array" and is the underlying NumPy representation of the type, a matrix for SO2
, SE2
, SO3
and SE3
, or a vector for Twist2
, Twist
, Plane
and Plucker
.
For most types the arithmetic operators *
, /
, +
, -
and **
are overloaded. Some general principles:
- Some inplace operations are supported, ie.
*=
and/=
using the dunder methods__iXXX___
- If operations is commutative the operator support this, eg.
a * b
orb * a
are equivalent - If the result of an operation is not in the group the result will be a numpy array
- The operation performed depends on the types of the left and right operands
- Each class supports its own operators
- For operations that involve different types, the support is implemented by the left-hand class
reverse
append
extend
insert
len
clear
pop
Other standard list operations are not supported since they make little sense in this context: count
, index
, sort
, remove