Example: Annotated manipulator

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

This example shows how you can annotate a technical drawing. The three link manipulator is the same as another example in the gallery. I've used macros extensively to avoid duplicating code.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Annotated 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
% Input:
%   #1 Variable name
%   #2 Value
% Example:
%   \nvar{\varx}{2cm}

% 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);

% Draw an angle annotation
% Input:
%   #1 Angle
%   #2 Label
% Example:
%   \angann{30}{$\theta_1$}
    \draw [dashed, red] (0,0) -- (1.2\ddx,0pt);
    \draw [->, shorten >=3.5pt] (\ddx,0pt) arc (0:#1:\ddx);
    % Unfortunately automatic node placement on an arc is not supported yet.
    % We therefore have to compute an appropriate coordinate ourselves.
    \node at (#1/2-2:\ddx+8pt) {#2};

% Draw line annotation
% Input:
%   #1 Line offset (optional)
%   #2 Line angle
%   #3 Line length
%   #5 Line label
% Example:
%   \lineann[1]{30}{2}{$L_1$}
    \begin{scope}[rotate=#2, blue,inner sep=2pt]
        \draw[dashed, blue!40] (0,0) -- +(0,#1)
            node [coordinate, near end] (a) {};
        \draw[dashed, blue!40] (#3,0) -- +(0,#1)
            node [coordinate, near end] (b) {};
        \draw[|<->|] (a) -- node[fill=white] {#4} (b);

% Define the kinematic parameters of the three link manipulator.

    \begin{scope}[shift=(\thetaone:\Lone), rotate=\thetaone]
        \begin{scope}[shift=(\thetatwo:\Ltwo), rotate=\thetatwo]
            \draw [dashed, red,rotate=\thetathree] (0,0) -- (1.2\ddx,0pt);
            \begin{scope}[shift=(\thetathree:\Lthree), rotate=\thetathree]



  • #1 Lukas Doktor, April 28, 2009 at 10:19 p.m.

    Hi, is it possible to define other angles then only X-axe? I have a robot which have 4 X-axe angles and 2 Z-axe angles.

    Some examples how it should look like are here:


  • #2 Kjell Magne Fauske, April 29, 2009 at 8:07 a.m.

    @Lukas: You want to draw a three-dimensional manipulator? TikZ is not well suited for this task. An alternative could be to use Sketch. Sketch is a simple system for producing line drawings of two- or three-dimensional solid objects and scenes. I once wrote a short introduction to Sketch. At the end of the article you will find a couple of examples related to robotics.

  • #3 Lukas Doktor, April 29, 2009 at 9:39 a.m.

    Hmm, I'll take a look on that. But I don't need to draw 3d manipulator, only it's scheme. Something like this:


    (for 3d I use povray)

  • #4 Kjell Magne Fauske, April 29, 2009 at 10:38 a.m.

    I see. You want to draw a 2D-version of a 3D-manipulator like in this example


    TikZ's 3D-support is very limited. If you want to do something like that I'm afraid that you have to do most of the math and transformations yourself. You can find some 3D-examples in the gallery that may be of some help.

    Sketch is also useful for drawing non-solid objects, so you could use it for drawing the schemes.

  • #5 Alex, August 17, 2012 at 1:32 p.m.


    the sketch mentioned above is exactly what I've been lookin four. Just one little question.

    Is it possible to reduce the arc radius of the annotations? That would be very useful for me.


Adding comments is currently not enabled.