User Tools

Site Tools


ece4560:maniplots

Plotting/Displaying Manipulators in Matlab

This site has links to display code for the different manipulators as well as implementation examples. You should be able to incorporate these display functions into your homework assignments. Some are rudimentary (simple lines and circles), some are more complex (3D models). The files are zip files for compatibility with this wiki.

Simple Planar Manipulators


The manipulators to appear in the homework range from a simple R2 manipulator up to an R4 manipulator. The code for each of the functions below is here. What is provided are Matlab pcode files (pre-compiled Matlab code) and empty m-files with help documentation.

  • planarR2_display: Planar R2 (default link lengths: 1, 1/2)
  • planarR3_display: Planar R3 (default link lengths: 1, 1/2, 1/4)
  • planarR4_display: Planar R4 (default link lengths: 1, 1, 1/2, 1/4)

Invocation is pretty straightforward. Almost always goes as follows:

planarRX_display(alphaJoints, linkLens, gripLen);

although the second and third arguments are optional. The revolute joint variables are given in radians. For each of them, it is possible to give X+1 joint coordinates; the additional joint value is a length that specifies the gripper opening width (it defaults to some half-open state if not passed). An example invocation for the ``planarR2_display`` function is

planarR2_display([pi/4; pi/8]);

Note that the argument is a vertical/column vector. It will not work otherwise. The optional arguments can be either row- or column- vectors:

planarR2_display([pi/4; pi/8], [3/4, 3/4]);

or

planarR2_display([pi/4; pi/8], [3/4; 3/4], 1/6);

Suppose that you had run ode45 or some other numerical integrator in Matlab and want to visualize the resulting simulation, then the following should work:

nframes = 100;
tvect = linspace(ti,tf,nframes);
for tT = tvect
  alphaT = transpose(interp1(tsol, alphasol, tT));
  planarRX_display(alphaT, ll, gl);
end

where it is assumed that tsol and alphasol were the ouputs of the numerical integrator. The reason for interpolating on linearly spaced out time points is that the numerical integration doesn't return evenly spaced time points. They are irregularly spaced and depend on the complexity of the velocity at that point in time (simpler velocities allow the numerical integrator to jump larger spans of time because the integration looks linear).

If you have issues, you can always type

help planarRX_display

with the proper X value and you will get some documentation (assuming that you kept the documentation m-files around).

Piktul


The simplest manipulator to be used in the lab portion of the course is called piktul as named by the student who helped me design it. It is a basic instantiation of a SCARA manipulator; one that we could create using laser cut parts and RC servo motors. Piktul is a planar R3 manipulator where the last joint angle has no length, however it can also actuate vertically meaning that it can pick up and place things in a roughly planar landscape (you can think of it as being able to manipulate things at different heights, but within a horizontal slice). More technically the workspace is SE(2) x |R. It is kinematically sufficient when considering manipulation tasks in SE(2).

The display function requires the SE3 class file to have been minimally coded in order to work. Minimal coding means the times, mtimes, leftact, and inv member functions. The easiest is to just invoke it with joint angles only and let the optional arguments assume the default values:

piktul_display(alphaJoints);

Functional code is:

piktul_display([1.25; 25; -35; 80; 0.75]);

which sets the height to 1.25, the revolute joints to (25, -35, 80), and the gripper to be 0.75 inches open. The piktul manipulator should be displayed with that joint configuration. The joint vector should be a column-vector and the revolute angles should be in degrees with translational/distance variables in inches.

Matlab code: display

Lynx6


The slightly more fully functional manipulator to be used in the course is called the Lynx 6 manipulator made by Lynxmotion.

lynx6_display([10;40;50;50;4]);

The joint vector should be a column-vector and the revolute angles should be in degrees. The first five joint coordinates are for revolute joints (degrees) and the sixth coordinate is the gripper opening (inches).

Matlab code: display

Elbow 6R


The 6R elbow manipulator (6R means 6 revolute joints) is a kinematically sufficient manipulator for SE(3). It is one of the most common designs found in industry (at least when working with kinematically sufficient manipulators).

elbow6R_display([10;40;50;50;-30;4]);

The joint vector should be a column-vector and the revolute angles should be in degrees. The first six joint coordinates are for revolute joints (degrees) and the sixth coordinate is the gripper opening (inches).

Matlab code: display


ECE4560 Main

ece4560/maniplots.txt · Last modified: 2023/03/06 10:31 by 127.0.0.1