acrod package
acrod.jacobian module
- class acrod.jacobian.Jacobian(M, robot_type='spatial')[source]
Bases:
objectJacobian class takes the robot-topology matrix as the input. additionally, it takes the robot_type argument (optional) as either ‘spatial’ or ‘planar’. by default, it is ‘spatial’.
Both the attributes and the parameters are shown under the heading of Parameters below.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
type (str) – robot_type (either ‘planar’ or ‘spatial’).
P (list) – list of all paths. (Initially initialised with None value)
P_tilde (list) – list of independent paths for linear velocities. (Initially initialised with None value)
P_tilde_omega (list) – list of independent paths for angular velocitites. (Initially initialised with None value)
is_serial (bool) – boolean, mentioning whether the manipulator is a serial manipulator or not a serial manipulator. it is initialised with None before determining whether the manipulator is serial or not. (Initially initialised with None value)
Ja (sympy.Matrix) – \(J_a\) in symbolic form. (Initially initialised with None value)
Jp (sympy.Matrix) – \(J_p\) in symbolic form. (Initially initialised with None value)
Aa (sympy.Matrix) – \(A_a\) in symbolic form. (Initially initialised with None value)
Ap (sympy.Matrix) – \(A_p\) in symbolic form. (Initially initialised with None value)
Ja_func (callable) – \(J_a\) in Python function form. (Initially initialised with None value)
Jp_func (callable) – \(J_p\) in Python function form. (Initially initialised with None value)
Aa_func (callable) – \(A_a\) in Python function form. (Initially initialised with None value)
Ap_func (callable) – \(A_p\) in Python function form. (Initially initialised with None value)
active_joint_velocities (list) – list of active joint velocities, each in string format. (Initially initialised with None value)
passive_joint_velocities (list) – list of passive joint velocities, each in string format. (Initially initialised with None value)
parameters (list) – list of parameters (other than end-effector parameters), each in string format. (Initially initialised with None value)
active_joint_velocities_symbolic (sympy.Matrix) – active joint velocities in symbolic form. (Initially initialised with None value)
passive_joint_velocities_symbolic (sympy.Matrix) – passive joint velocities in symbolic form. (Initially initialised with None value)
parameters_symbolic (sympy.Matrix) – list of parameters (other than end-effector parameters) in string format. (Initially initialised with None value)
endeffector_variables_symbolic (sympy.Matrix) – end-effector parameters in symbolic form. (Initially initialised with None value)
superfluous_dof_information (list) – list containing information of superfluous DOF existing in the robot. (Initially initialised with None value)
- execute_equations()[source]
execute_equations is a method that takes no input arguments but takes the attributes M, P, type, indices_P_tilde and indices_P_tilde_omega of the class, and updates the attributes superfluous_dof_information, Ja, Jp, Aa, Ap, parameters, parameters_symbolic, endeffector_variables_symbolic, Ja_func, Jp_func, Aa_func, Ap_func, active_joint_velocities, active_joint_velocities_symbolic, passive_joint_velocities and passive_joint_velocities_symbolic. For serial manipulator, passive joints do not come into picture, and hence the attributes Jp, Aa, Ap, Jp_func, Aa_func, Ap_func, passive_joint_velocities and passive_joint_velocities_symbolic would remain with None value. Likewise, for manipulators without superfluous DOF, the attribute superfluous_dof_information would remain with None value. Additionally, it returns the \(J_a\) function Ja_func, the \(J_p\) function Jp_func, the \(A_a\) function Aa_func, the \(A_p\) function Ap_func, the list of active joint velocities (not symbolic) active_jointvelocities, the list of passive joint velocities (not symbolic) passive_jointvelocities, and the list of decision variables (not symbolic) decision_variables_str.
- Returns
The \(J_a\) function Ja_func, the \(J_p\) function Jp_func, the \(A_a\) function Aa_func, the \(A_p\) function Ap_func, the list of active joint velocities (not symbolic) active_jointvelocities, the list of passive joint velocities (not symbolic) passive_jointvelocities, and the list of decision variables (not symbolic) decision_variables_str.
- Return type
tuple
- get_all_paths()[source]
get_all_paths is a method that takes no input arguments but takes the graph adjacency matrix from the M attribute of the class and updates the P attribute of the class with all paths from base link to end-effector link, in list format. Additionally, based on the number of paths, it updates the is_serial attribute of the class with appropriate boolean value.
- get_independent_paths()[source]
get_independent_paths is a method that takes no input arguments but takes the graph adjacency matrix from the M attribute of the class and the paths from the P attribute of the class, and updates the attributes P_tilde, P_tilde_omega, indices_P_tilde and indices_P_tilde_omega.
- get_jacobian_function(MoorePenrose=False)[source]
get_jacobian_function is a method that takes no necessary input arguments (although takes optional parameter MoorePenrose as a boolean value) and executes process_functions method and collects the functions (as needed) from attributes Ja_func, Ja_func, Ja_func and Ja_func, and returns a function for the final Jacobian matrix.
- Parameters
MoorePenrose (bool) – This is an optional parameter, which if true performs a Moore-Penrose inverse of \(A_P\) instead of normal inverse, while preparing the final Jacobian matrix function.
- Returns
A callable function that accepts a list of end-effector point and a list of dimensional parameters as input arguments, and returns the final Jacobian matrix in numpy.array format.
- Return type
Callable
- acrod.jacobian.all_joints_connected_to_the_link(M, linknumber)[source]
all_joints_connected_to_the_link function gives a list of all the joints connected to a given link for a given robot-topology matrix.
This function takes the robot-topology matrix and the link number as input arguments.
- Parameters
M (numpy.ndarray) – robot-topology matrix (of size nxn, to be given in numpy.array format).
linknumber (int) – link number (it is to be indexed from 0, not from 1).
- Returns
a list of size n-1 items specifying the type of joint with which the given link is connected to every other joint. The order of joints corresponds to the ascending order of the link numbers.
- Return type
list
- acrod.jacobian.all_links_connected_to_the_link(M, linknumber)[source]
all_links_connected_to_the_link function gives a list of all the links connected to a given link for a given robot-topology matrix.
This function takes the robot-topology matrix and the link number as input arguments.
- Parameters
M (numpy.ndarray) – robot-topology matrix (of size nxn, to be given in numpy.array format).
linknumber (int) – link number (it is to be indexed from 0, not from 1).
- Returns
a list of items specifying the indices of links with which the given link is connected, in ascending order of the link numbers.
- Return type
list
- acrod.jacobian.all_paths(M)[source]
all_paths function gives a list of all paths connecting the base link and the end-effector link for a given robot-topology matrix.
This function takes the robot-topology matrix as input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix (of size nxn, to be given in numpy.array format).
- Returns
a list of lists of items each corresponding to a path and specifying the sequence of links in that path that are connected from the base link to the end-effector link (the link numbers are indexed from 0, not from 1).
- Return type
list
- acrod.jacobian.check_robot_topology_matrix(M)[source]
check_robot_topology_matrix function performs several checks on the logical consistency of Robot-Topology matrix.
This function takes the robot-topology matrix as the input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix (of size nxn, to be given in numpy.array format).
- Raises
ValueError – If the Robot-Topology matrix is not a 2D array.
ValueError – If the Robot-Topology matrix is not a square matrix.
ValueError – If any of the diagonal elements of the Robot-Topology matrix is not 9.
ValueError – If the upper off-diagonal elements of the Robot-Topology matrix are other than the integers between 0 and 7.
ValueError – If the lower off-diagonal elements of the Robot-Topology matrix are other than the integers 0 and 1.
ValueError – If the Robot-Topology matrix has its lower off-diagonal element 1 but the corresponding upper off-diagonal element is 0.
ValueError – If the Robot-Topology matrix has its lower off-diagonal element 1 but the corresponding upper off-diagonal element other than the integers 1 and 2.
- acrod.jacobian.from_P_to_P_tilde(P, M)[source]
from_P_to_P_tilde function gives P_tilde and P_tilde_omega from P, by using robot-topology matrix. it also gives the corresponding indices of P for each of the elements of P_tilde and P_tilde_omega.
This function takes the list P and the robot-topology matrix as the input arguments.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
P (list) – list of all paths, denoted by P.
- Returns
P_tilde in list format, P_tilde_omega in list format, independent_path_indices in list format and independent_omega_path_indices in list format.
- Return type
tuple
- acrod.jacobian.get_all_combinations_of_two_parts_of_manipulator(M_size)[source]
get_all_combinations_of_two_parts_of_manipulator function gives all possible combinations of splitting the given set of links into two parts.
This function takes the number of links (which is the same as the size of the robot-topology matrix) as input argument.
- Parameters
M_size (int) – The number of links of the robot.
- Returns
the entire possible list of items each containing the entire links grouped into two parts.
- Return type
list
- acrod.jacobian.get_jointvelocities_list(M)[source]
get_jointvelocities_list function gets the expressions for active and passive joint velocities (in string form, to be executed), from the corresponding robot-topology matrix.
This function takes robot-topology matrix as the input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
- Returns
a list of active joint velocities (each in string format) and a list of passive joint velocities (each in string format).
- Return type
list
- acrod.jacobian.get_variables_list(M)[source]
get_variables_list function gives the expressions for parameters (representing locations and orientations of joints, in string form), from the corresponding robot-topology matrix. this is for spatial manipulators.
This function takes robot-topology matrix as the input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
- Returns
a dict of keys representing the indices of joints and the corresponding values being lists of parameters (each parameter in string format).
- Return type
dict
- acrod.jacobian.get_variables_list_planar(M)[source]
get_variables_list_planar function gives the expressions for parameters (representing locations and orientations of joints, in string form), from the corresponding robot-topology matrix. this is for planar manipulators.
This function takes robot-topology matrix as the input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
- Returns
a dict of keys representing the indices of joints and the corresponding values being lists of parameters (each parameter in string format).
- Return type
dict
- acrod.jacobian.graph_adjacency_matrix_from_robot_topology_matrix(M)[source]
graph_adjacency_matrix_from_robot_topology_matrix function converts a robot-topology matrix to its graph adjacency matrix. by doing so, it would no longer have the information to identify the actuating joints.
This function takes robot-topology matrix as input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
- Returns
the corresponding graph adjacency matrix.
- Return type
numpy.ndarray
- acrod.jacobian.superfluous(M)[source]
superfluous function gives the information related to superfluous DOF if there are any, from the robot-topology matrix.
This function takes robot-topology matrix as input argument.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
- Returns
a list of pieces of information regarding superfluous DOF. each piece of superfluous DOF would be of the format of [c_be, [(i,j),(k,l)]], where c_be is the part of links that has both base and the end-effector links, and [(i,j),(k,l)] are the points indices of two spherical joints corresponding to the superfluous DOF, in which the links j, k lie on the other part than c_be. if there are no superfluous DOF then it returns an empty list.
- Return type
list
- acrod.jacobian.vel_path(M, path, available_variables)[source]
vel_path function processes the strings to be executed for symbolic variabes and velocity expressions of a given path by using the robot-topology matrix, and it also updates the available_variables (so that only those variables that are unavailable are added, thereby avoiding redundancy). this is for spatial manipulators.
This function takes robot-topology matrix, the path and the available variables list (string format) as input arguments.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
path (list) – a given path (containing link numbers in order) in list format.
available_variables (list) – a list of available variables (each of them being in string format).
- Returns
the expression for linear velocity (in string format, to be executed), the expression for angular velocity (in string format, to be executed), a list of expressions for symbolic variables (in string format, to be executed), and the updated available_variables.
- Return type
tuple
- acrod.jacobian.vel_path_planar(M, path, available_variables)[source]
vel_path_planar function processes the strings to be executed for symbolic variabes and velocity expressions of a given path by using the robot-topology matrix, and it also updates the available_variables (so that only those variables that are unavailable are added, thereby avoiding redundancy). this is for planar manipulators.
This function takes robot-topology matrix, the path and the available variables list (string format) as input arguments.
- Parameters
M (numpy.ndarray) – robot-topology matrix.
path (list) – a given path (containing link numbers in order) in list format.
available_variables (list) – a list of available variables (each of them being in string format).
- Returns
the expression for linear velocity (in string format, to be executed), the expression for angular velocity (in string format, to be executed), a list of expressions for symbolic variables (in string format, to be executed), and the updated available_variables.
- Return type
tuple
acrod.urdf_to_robottopologymatrix module
- acrod.urdf_to_robottopologymatrix.from_urdf_to_matrix(path_to_urdf_file)[source]
from_urdf_to_matrix function takes the URDF file path as the input argument and produces the robot-topology matrix.
The URDF file is expected to have only one base link and only one end-effector link.
- Parameters
path_to_urdf_file – A valid path for the URDF file.
- Returns
A corresponding robot-topology matrix in numpy array format.
- Return type
numpy.ndarray
- acrod.urdf_to_robottopologymatrix.get_joints_from_urdf(root)[source]
get_joints_from_urdf function extracts a dictionary having information of all the joints in the XML object of the URDF file.
This function takes the XML object as input argument.
- Parameters
root – XML object of the URDF file (to be given in ElementTree.Element format).
- Returns
a list of all joint names (from the XML object) as keys, eaching having a tuple of its corresponding type of the joint, parent link name and child link name as values.
- Return type
dict
- acrod.urdf_to_robottopologymatrix.get_links_from_urdf(root)[source]
get_links_from_urdf function extracts a list having information of names of all the link in the XML object of the URDF file and outputs the list in numpy.array format.
This function takes the XML object as input argument.
- Parameters
root – XML object of the URDF file (to be given in ElementTree.Element format).
- Returns
a numpy array containing all the link names (from the XML object).
- Return type
numpy.ndarray
- acrod.urdf_to_robottopologymatrix.reduce_robottopologymatrix(M)[source]
reduce_robottopologymatrix function reduces the robot topology matrix that has unconnected link(s) by removing those link(s).
This function takes the robot-topology matrix as the input argument (in numpy array format).
- Parameters
M (numpy.ndarray) – The robot-topology matrix from which the unconnected links are to be removed off.
- Returns
A reduced robot-topology matrix by removing the unconnected links.
- Return type
numpy.ndarray