%&tex
\documentclass{standalone}
\usepackage{tikz}
\usepackage{siltex}
\usetikzlibrary {calc,arrows.meta,positioning,patterns,math}
% Compliant PDF
\usepackage[a-3u]{pdfx}
%\input{graphics/tics.tikz}
        
\begin{document}
    \begin{tikzpicture}[x=0.9cm, y=0.9cm, nodes={text width=4.5cm,anchor=north west,draw=none}]
        \def \markerradius {0.5};
        \def \angle {40};
        \def \startangle {-90-\angle};
        \def \stopangle {-90+\angle};
        \def \length{4};
        \def \thick{0.3};
        \def \clampoffset{2};
        \pgfmathsetmacro{\clamppos}{\clampoffset-\markerradius*sin(\angle)};
        \pgfmathsetmacro{\side}{\markerradius*(1-cos(\angle))};
        \def \clampsection {++(${\side}*(0,1)$) arc[start angle=\startangle,end angle=\stopangle,radius=\markerradius] -- ++(${-1*\side}*(0,1)$)}; 
        \def \blockdistance {2.8}
        \def \blockpos {(0,0)};
        \def \markerdrop {0.5};
        \def \spacing {5.6};
        \def \yspacing {4.6};
    \tikzset{
        block/.pic=
        {
            \def \height {1.5};
            \def \width {1};
            \draw[pattern = north west lines] (\clamppos,-1) -- (\clamppos,-\markerdrop) -- \clampsection -- ++(0,-0.2) -- (\blockdistance,-\markerdrop-0.2) -- (\blockdistance,1) -- (\blockdistance+\width,1) -- (\blockdistance+\width,-1); 
        },
        upperclamp/.pic=
        {
        \def \startangle {90+\angle};
        \def \stopangle {90-\angle};
        \def \side {-\markerradius*(1-cos(\angle))};
            \draw[fill=lightgray] (0,0) -- (${\clamppos}*(1,0)$) coordinate(a) -- \clampsection coordinate(b) -- (\length,0) -- ++(0,\thick) -- (0,\thick);
        },
        lowerclamp/.pic=
        {
            \draw[fill=lightgray] (0,0) -- (${\clamppos}*(1,0)$) -- \clampsection -- ++(0,-\thick) -- (0,-\thick);
        },
        marker/.pic=
        {
            \draw[fill=gray] (0,0) circle(\markerradius);
        }
    }
        \def \nodepos {(\blockdistance-4.0,2.9)};
    \begin{scope}[shift={(0*\spacing,0)}]
        \def \eex {1.3};
        \def \eey {-0.5};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance+\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {1. Marker is clamped in springloaded end-effector.};
        \draw (2-\eex,{\markerradius+\eey*-1}) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}
    \begin{scope}[shift={(1*\spacing,0)}]
        \def \eex {0};
        \def \eey {0};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance+\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {2. End-effector is positioned on the holder.};
        \draw (2,\markerradius) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}
    \begin{scope}[shift={(2*\spacing,0)}]
        \def \eex {0};
        \def \eey {0.5};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance+\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {3. End-effector is moved down, forcing the upper clamp open.};
        \draw (2,\markerradius-\markerdrop) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}
    \begin{scope}[shift={(0*\spacing,-\yspacing)}]
        \def \eex {0};
        \def \eey {0.7};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance+\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {4. End-effector continues down, leaving the marker in the holder.};
        \draw (2,\markerradius-\markerdrop) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}
    \begin{scope}[shift={(1*\spacing,-\yspacing)}]
        \def \eex {1};
        \def \eey {0.7};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance+\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {5. The longer arm allows the end-effector to move sideways.};
        \draw (2,\markerradius-\markerdrop) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}
    \begin{scope}[shift={(2*\spacing,-\yspacing)}]
        \def \eex {1};
        \def \eey {0};
        \pgfmathsetmacro{\clampangle}{max(0,atan2(\eey,{\blockdistance-\eex}))};
        \draw \blockpos pic {block};
        \node at \nodepos {6. Return to begin position, now without marker.};
        \draw (2,\markerradius-\markerdrop) pic {marker};
        \begin{scope}[shift={(-\eex,-\eey)}]
            \draw (0,0) pic {lowerclamp};
            \draw (0,1) pic[rotate=\clampangle] {upperclamp};
        \end{scope}
    \end{scope}

    \draw (4.2,-1.3*\yspacing) -- (4.2,2.9);
    \draw[shift={(\spacing,0)}] (4.2,-1.3*\yspacing) -- (4.2,2.9);
    \draw(-1.4,-1.5) -- ++(3*\spacing,0);

    \end{tikzpicture}
\end{document}
