Example: Three link manipulator

Published 2006-11-12 | Author: Kjell Magne Fauske

One of the nicest things about programming illustrations, is that it's easy to change parameters. In this example I've parameterized a three link manipulator using a macro. I can then draw the manipulator in different positions with just one line of code.

Download as: [PDF] [TEX]

Three link manipulator

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.



% Note. This illustration was originally made with PSTricks. Conversion to
% PGF/TikZ was straightforward. However, I could probably have made it more
% elegant.

% Define a variable as a length

% Define a few constants for drawing
% Define commands for links, joints and such
\def\link{\draw [double distance=1.5mm, very thick] (0,0)--}
    \filldraw [fill=white] (0,0) circle (5pt);
    \fill[black] circle (2pt);
    \draw[ultra thick](0cm,\dg)--(0cm,-\dg);
    \fill (0cm, 0.5\dg)+(0cm,1.5pt) -- +(0.6\dg,0cm) -- +(0pt,-1.5pt);
    \fill (0cm, -0.5\dg)+(0cm,1.5pt) -- +(0.6\dg,0cm) -- +(0pt,-1.5pt);

    \draw[rounded corners=8pt] (-\dw,-\dh)-- (-\dw, 0) --
    \draw (-0.5,-\dh)-- (0.5,-\dh);
    \fill[pattern=north east lines] (-0.5,-1) rectangle (0.5,-\dh);

% This macro draws a three link manipulator.
% Input parameters:
%   #1 theta_1
%   #2 L_1
%   #3 theta_2
%   #4 L_2
%   #5 theta_3
%   #6 L_3
% Example:
%   \threelink{60}{2}{-70}{2}{30}{1}
    \begin{scope}[shift=(#1:#2), rotate=#1]
        \begin{scope}[shift=(#3:#4), rotate=#3]
            \begin{scope}[shift=(#5:#6), rotate=#5]

    \begin{scope}[shift={(2cm, -3.2cm)}]
        % Illustration of two different solutions to the inverse kinematic
        % problem.



Adding comments is currently not enabled.