MAGIKS  1.1
Manipulator General Inverse Kinematic Solver
 All Classes Namespaces Files Functions Variables Pages
Functions | Variables
math_tools.algebra.vectors_and_matrices Namespace Reference

Functions

def colmax
 
def colmin
 
def plot_matrix
 
def rep
 
def as_matrix
 
def value_to_str
 
def values_to_str
 
def vector_to_str
 
def matrix_to_str
 
def which
 
def remove
 
def matrix_column_multiply
 
def normalize
 
def linear_map
 
def inner_product
 
def as_vector
 
def vectors_angle
 
def linear_map_inv
 
def diag_old
 
def vector_element_multiply_old
 
def cut_vector_old
 
def extend_vector
 
def equal
 
def uvect
 
def extract_rotation_matrix
 
def cross_old
 
def extended_matrix
 
def right_pseudo_inverse
 
def left_pseudo_inverse
 
def right_dls_inverse
 
def left_dls_inverse
 
def weighted_pseudo_inverse
 
def weighted_dls_inverse
 
def clamp
 
def positive
 Use this function to check if all elements of a given vector are positive. More...
 
def feasible_stepsize
 
def va_mean
 
def va_shiftappend
 

Variables

int err_code = 0
 

Function Documentation

def math_tools.algebra.vectors_and_matrices.as_matrix (   v)
gets vector v with n^2 elements and returns n*n matrix

Definition at line 98 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.as_vector (   v)
Returns a numpy array equal to v. Input argument v must be a normal array of numbers

Definition at line 242 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.clamp (   v,
  max_norm 
)
if the magnitude(norm) of the given vector is smaller than max_norm, the given vctor is returned
otherwise a vector parallel to v with norm max_norm is returned

Definition at line 407 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.colmax (   M)
returns the maximums of each column in a vector

Definition at line 23 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.colmin (   M)
returns the minimums of each column in a vector

Definition at line 36 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.cross_old (   u,
  v 
)
Return the cross product of two vectors u and v. u and v are (3 element) vectors

Definition at line 332 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.cut_vector_old (   v4)
returns a three element vector containing the first three elements of v4

Definition at line 294 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.diag_old (   v)
return an square diagonal matrix whose diagonal elements are elements of vector v

Definition at line 277 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.equal (   v1,
  v2,
  epsilon = gen.epsilon 
)
Returns 1 if two vectors or matrices are equal otherwise returns 0

Definition at line 310 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.extend_vector (   v3)
get a three element vector and add one element to its end. Return a four element vector

Definition at line 300 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.extended_matrix (   R,
  p 
)
Convert a (3 X 3) rotation matrix into a (4 X 4) transformation matrix. The added elements will be zero

Definition at line 338 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.extract_rotation_matrix (   TRM)
Returns the rotation matrix (3 X 3) extracted from transformation matrix TRM. TRM is a 4*4 matrix

Definition at line 326 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.feasible_stepsize (   direction,
  x,
  x_min,
  x_max 
)
when the correction of vector x is restricted by limits
If you want to change vector x in a desired direction, and there are lower and upper bounds for x, 
how much are you allowed to change? 
This function returns a feasible stepsize for the given direction. 
The direction of change must be multiplied by a scalar value lower or equal to this feasible stepsize 
so that the applied changes are feasible.

Definition at line 428 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.inner_product (   v1,
  v2 
)
returns the inner product of the two vectors v1 and v2

Definition at line 236 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.left_dls_inverse (   M,
  k 
)
returns the left side damped least square inverse of matrix M. k is the damping factor:

[M^T*M + (k^2)*I]^(-1) * M^T

--> take a look at ! np.linalg.pinv(a, rcond=1.0000000000000001e-15) !

Definition at line 382 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.left_pseudo_inverse (   J)
Return the left pseudo-inverse of matrix J
(J^T*J)^(-1)*J^T

Definition at line 360 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.linear_map (   q,
  f,
  g 
)
return the linear mapping of vector q by coefficients f and g
    
    u = (q - g) / f

This code should be implemented before:

    for i in range(0,len(f[i])):
        if abs(f[i]) < mgvlib.epsilon:
            print 'Error 01: Division by zero occured'
            print 'Something is wrong with the joint limits or the joint limit multipliers'
            print 'Make sure that the joint limits are well defined, and method "initialize" of the manipulator configuration has been implemented'
            assert False

Definition at line 217 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.linear_map_inv (   u,
  f,
  g 
)
return the inverse linear mapping of vector u by coefficients f and g

    q = f * u + g 

Definition at line 268 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.matrix_column_multiply (   A,
  v 
)
equivalent to np.dot( A, np.diag(v) ) 

multiplies each column of matrix A by the corresponding element in vector v. 
This is equivalent to A*diag(v) but requires less calculations

return np.dot( A, np.diag(v) ) 

Definition at line 189 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.matrix_to_str (   matrix,
  format = "%.3f" 
)
parametrized usage of sprintf

Definition at line 141 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.normalize (   v)
Returns the unit vector parallel to the given vector.

Definition at line 207 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.plot_matrix (   M,
  xlabel = None,
  ylabels = None,
  annotate = False,
  legend = True,
  annx = None,
  anny = None 
)

Definition at line 49 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.positive (   v,
  non_zero = False 
)

Use this function to check if all elements of a given vector are positive.

Definition at line 419 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.remove (   v,
  positions 
)
Removes the items from v whose positions are specified in given array "positions" and returns the filtered vector

Definition at line 179 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.rep (   a,
  n 
)
returns a numpy vector of length n containing a (all elements of the vector will be a)

Definition at line 89 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.right_dls_inverse (   M,
  k 
)
returns the right side damped least square inverse of matrix M. k is the damping factor:

M^T * [M*M^T + (k^2)*I]^(-1)

Definition at line 369 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.right_pseudo_inverse (   J)
Return the right pseudo-inverse of matrix J
J^T*(J*J^T)^(-1)
--> take a look at ! np.linalg.pinv(a) !

Definition at line 350 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.uvect (   TRM,
  m 
)
uvect is a shorted phrase of "unit vector"

Returns a vector (3 X 1) containing the first three elements of the m-th column of transformation matrix TRM. 
(TRM is the 4*4 transformation matrix or a 3X3 rotation matrix) 
If m is in [0,1,2] the m-th unit vector is returned. If m is 3, then the function returns the position vector

Definition at line 316 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.va_mean (   vectarray)

Definition at line 469 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.va_shiftappend (   vectarray,
  v_new 
)

Definition at line 476 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.value_to_str (   value,
  format = "%.3f" 
)

Definition at line 114 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.values_to_str (   list_of_vals,
  format = "%.3f" 
)
parametrized usage of sprintf

Definition at line 120 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.vector_element_multiply_old (   v1,
  v2 
)
elementwise multiplication of two vectors. 

!!! http://www.scipy.org/NumPy_for_Matlab_Users !!!     

Definition at line 285 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.vector_to_str (   vector,
  format = "%.3f" 
)
previous name: format_vector
parametrized usage of sprintf

Definition at line 129 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.vectors_angle (   v1,
  v2,
  in_degrees = False,
  positive_direction = np.zeros(3) 
)
Returns the angle between two vectors. The positive direction, specifies which halfspace is used as positive vectors for the cross product of u and v
if not specified, the returned angle will be always positive. 
If specified, then if the sign of the returned angle is the same as the inner product of positive_direction and crossproduct(v1,v2)

Definition at line 248 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.weighted_dls_inverse (   M,
  W = None,
  k = 0.0 
)

Definition at line 399 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.weighted_pseudo_inverse (   M,
  W 
)

Definition at line 396 of file vectors_and_matrices.py.

def math_tools.algebra.vectors_and_matrices.which (   v,
  condition,
  value 
)
Returns the positions of those elements of vector v which satisfy the given condition with the given value
condition is a string and must be in: '>', '>=', '<', '=='

Definition at line 154 of file vectors_and_matrices.py.

Variable Documentation

int err_code = 0

Definition at line 87 of file vectors_and_matrices.py.