basic_robotics.general.faser_transform module

Implement Transformations.

class basic_robotics.general.faser_transform.tm(initializer_array=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), rpy=False)[source]

Bases: object

Class to represent and manipulate 3d transformations easily.

Utilizes Euler Angles and 4x4 Transformation Matrices

__init__(initializer_array=array([[1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]), rpy=False)[source]

Initialize a new Transformation object.

If no initializer_array is supplied, an identity transform is returned. initializer_array can be of the following types, with different behaviors:

  1. tm: a copy of the tm object is returned

  2. len(3) list: a tm object representing an XYZ rotation is returned

  3. len(3) list with rpy True: a tm representing a ZYX(RPY) rotation is returned

  4. len(6) list: a tm object representing an XYZ translation and XYZ rotation is returned

  5. len(6) list with rpy True: a tm object representing an XYZ translation and ZYX(RPY) rotation is returned

  6. len(7) list: a tm object representing an XYZ translation and a quaternion is returned

  7. 4x4 transformation matrix: a tm object representing the given transform is returned

Parameters:

initializer_array – Optional - data to generate new transformation

from3DOF(initializer_array, rpy)[source]

Initialize from a 3DOF array.

Parameters:
  • initializer_array (type) – Description of parameter initializer_array.

  • rpy (type) – Description of parameter rpy.

Returns:

type – Description of returned object.

from6DOF(initializer_array, rpy)[source]

Short summary.

Parameters:
  • initializer_array (type) – Description of parameter initializer_array.

  • rpy (type) – Description of parameter rpy.

Returns:

type – Description of returned object.

from7DOF(initializer_array)[source]

Short summary.

Parameters:

initializer_array (type) – Description of parameter initializer_array.

Returns:

type – Description of returned object.

spawnNew(init)[source]

Spawns a new TM object. Useful when tm is not speifically imported.

Parameters:

init – initialization argument

Returns:

tm – tm object

transformSqueezedCopy(transform_matrix)[source]

In cases of dimension troubles, squeeze out the extra dimension.

Parameters:

TM – input 4x4 matrix

Returns:

TM – return 4x4 matrix

getQuat()[source]

Return quaternion.

Returns:

quaternion from euler

setQuat(quaternion)[source]

Set TAA from quaternion.

Parameters:

quat – input quaternion

angleMod()[source]

Truncate excessive rotation.

tripleUnit(lv=1)[source]

Return XYZ unit vectors based on current position.

Parameters:

lv – length to magnify by

Returns:

vec1 – vector X vec2: vector Y vec3: vector Z

TAAtoTM()[source]

Convert the TAA representation to TM representation to update the object.

TMtoTAA()[source]

Convert the TM representation to TAA representation and updates the object.

adjoint()[source]

Return the adjoint representation of the 4x4 transformation matrix.

Returns:

Adjoint

exp6()[source]

Return the matrix exponential of the TAA.

Returns:

Matrix exponential

gRot()[source]

Return the rotation matrix component of the 4x4 transformation matrix.

Returns:

3x3 rotation matrix

gTAA()[source]

Return the TAA representation of the tm object.

Returns:

TAA

gTM()[source]

Return the 4x4 transformation matrix representation of the tm object.

Returns:

4x4 tm

gPos()[source]

Return the len(3) XYZ position of the transforamtion.

Returns:

position

sTM(TM)[source]

Set the 4x4 transformation matrix and updates the object.

Parameters:

TM – 4x4 transformation matrix to be set

sTAA(TAA)[source]

Set the TAA version of the object and updates.

Parameters:

TAA – New TAA to be set

T()[source]

Return the transpose version of the tm.

Returns:

tm.T

cT()[source]

Return the conjugate transpose if transpose doesn’t work, use this.

Returns:

TM.conj().T

inv()[source]

Return the inverse of the transform.

Returns:

tm^-1

pinv()[source]

Return the pseudoinverse of the transform.

Returns:

psudo inverse

copy()[source]

Return a deep copy of the object.

Returns:

copy

set(ind, val)[source]

Set a specific index of the TAA to a value and then update.

Parameters:
  • ind – index to set

  • val – val to set

Returns:

new version of self reference

approx(nplaces=10)[source]

Round self to 10 decimal places.

Returns:

rounded TAA representation