maddux.robots package


maddux.robots.arm module

A robot arm defined by a sequence of DH links

class maddux.robots.arm.Arm(links, q0, name, active_links=None, base=None, tool=None)[source]

Return end effector position

Parameters:q (numpy.ndarray or None) – Config to compute the end effector position for a given 1xN q vector
Returns:Position (x, y, z) of end effector
Return type:numpy.ndarray

Calculate the end effector velocity of the arm given its current angular velocities.

Returns:Returns linear and angular velocity in each dimension (vx, vy, vz, wx, wy, wz).
Return type:np.ndarray
fkine(q=None, links=None)[source]

Computes the forward kinematics of the arm using the current joint configuration or a given joint configuration

  • q (numpy.ndarray or None) – (Optional) 1xN vector of joint configuration to compute the FK on
  • links (int or None) – (Optional) Specify which links to run fkine on. for example: links=[1,2,3].

Homogenous coordinates of point at the end of either the specified list of links, or the end effector

Return type:

4x4 numpy.array


Gets the current joint configuration from the links

Returns:1xN vector of current joint config
Return type:numpy.ndarray

Hold a specific object

Parameters:obj (maddux.objects.DynamicObject) – Object to be held
Return type:None
ikine(p, num_iterations=1000, alpha=0.1)[source]

Computes the inverse kinematics to find the correct joint configuration to reach a given point

  • p (numpy.ndarray) – The point (x, y, z) to solve the inverse kinematics for
  • num_iterations (int) – The number of iterations to try before giving up
  • alpha (int) – The stepsize for the ikine solver (0.0 - 1.0)

1xN vector of the joint configuration for given point p.

Return type:



Checks if the arm is in collision with a given object

Parameters:env_object (maddux.Objects.StaticObject) – The object to check for collisions with
Returns:Whether you hit the env_object
Return type:bool

Calculates the jacobian in the world frame by finding it in the tool frame and then converting to the world frame.

Parameters:q (numpy.ndarray) – (Optional) 1xN joint configuration to compute the jacobian on
Returns:6xN Jacobian in the world frame
Return type:numpy.matrix

Calculates the jacobian in the tool frame

Parameters:q (1xN numpy.ndarray) – (Optional) 1xN joint configuration to compute the jacobian on
Returns:6xN Jacobian in the tool frame
Return type:numpy.matrix

Plot our robot into given axes

Parameters:ax (matplotlib.axes) – axes of plot
Return type:None

Release one or all currently held objects

Parameters:object_idx – (Optional) index of object to release

:type object_idx = int or None

Return type:None

Resets the arm back to its resting state, i.e. q0

Return type:None

Save the current path to a file :param filename: Filename to save joint config path :type filename: str

update_angles(new_angles, save=False)[source]

Updates all the link’s angles

  • new_angles (numpy.ndarray) – 1xN vector of new link angles
  • save – Flag that determines if the update is cached
  • save – bool
Return type:


Updates the given link’s angle with the given angle

  • link (int) – The link you want to update
  • new_angle (int) – The link’s new angle
  • save (bool) – Flag that determines if the update is cached
Return type:


Walk through all the links and update their positions.

Return type:None

Updates the given link’s velocity with the given acceleration over the given time

  • link (int) – The link you want to update
  • accel (int) – The acceleration (Radians per second^2)
  • time (int) – The time (Seconds)
Return type:


maddux.robots.predefined_robots module

maddux.robots.predefined_robots.noodle_arm(seg_lens, q0, base=None)[source]

Creates a complex arm with 10 segments

  • seg_lens (numpy.ndarray) – 1x10 vector of lengths of each sement
  • q0 (numpy.ndarray) – 1xN vector of the starting joint configuration
  • base (numpy.ndarray or None) – (Optional) optional (x, y, z) base location of arm

“Noodle” arm

Return type:


maddux.robots.predefined_robots.simple_human_arm(seg1_len, seg2_len, q0, base=None)[source]

Creates a simple human-like robotic arm with 7 links and 2 segments with the desired lengths and starting joint configuration

  • seg1_len (int) – The length of the first segment of the arm
  • seg2_len (int) – The length of the second segment of the arm
  • q0 (numpy.ndarray) – 1xN vector of the starting joint configuration
  • base (numpy.ndarray or None) – (Optional) (x, y, z) location of arm base

7 link, 2 segment “human” arm.

Return type:


maddux.robots.utils module

Random collection of utilities for the robots to use


Create a homogeneous transform to move to a given point

Parameters:p (numpy.ndarray) – The (x, y, z) point we want our homogeneous tranform to move to
Returns:4x4 Homogeneous Transform of a point
Return type:numpy.matrix

Create a point from a homogeneous transform

Parameters:T (numpy matrix) – The 4x4 homogeneous transform
Returns:The (x, y, z) coordinates of a point from a transform
Return type:np.ndarray

Extract the rotation section of the homogeneous transformation

Parameters:transform (numpy.ndarray) – The 4x4 homogeneous transform to extract the rotation matrix from.
Returns:3x3 Rotation Matrix
Return type:numpy.matrix

Module contents