1
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{3d, arrows.meta, positioning, calc}
\usepackage{tikz-3dplot} % for 3D coordinate transformation



\begin{document}
    \begin{tikzpicture}[line join=round, line cap=round, 3d view={10}{30}]
        
        % Coordinate system
        \draw[->] (0,0,0) -- (3,0,0) node[anchor=north east]{$x$};
        \draw[->] (0,0,0) -- (0,3,0) node[anchor=north west]{$y$};
        \draw[->] (0,0,0) -- (0,0,3) node[anchor=south]{$z$};
        
        % DC Motor
        \draw[fill=gray!20, opacity=0.5] (0,-1,-1) -- (0,1,-1) -- (0,1,1) -- (0,-1,1) -- cycle;
        \draw (0,-1,-1) -- (0,1,-1) -- (0,1,1) -- (0,-1,1) -- cycle;
        \draw[fill=gray!20] (0,1,0) ellipse (1 and 0.3);
        \draw[fill=gray!20, opacity=0.5] (0,1,-1) -- (0,1,1) arc[start angle=0, end angle=180, x radius=1, y radius=0.3] -- cycle;
        \draw[fill=gray!20, opacity=0.5] (0,-1,-1) -- (0,-1,1) arc[start angle=0, end angle=180, x radius=1, y radius=0.3] -- cycle;
        
        % Arm 1
        \draw[thick] (0,1,0) -- (2,1,0);
        \filldraw[ball color=gray!50] (2,1,0) circle (0.1);
        \node[anchor=south west] at (2,1,0) {$m_1$};
        
        % Arm 2
        \draw[thick] (2,1,0) -- (2,-1,0);
        \filldraw[ball color=gray!50] (2,-1,0) circle (0.1);
        \node[anchor=east] at (2,-1,0) {$m_2$};
        
        % Labels
        \node[align=center] at (0,-0.5,0) {DC motor};
        \node[anchor=south west] at (1,1,0) {Arm 1};
        \node[anchor=south west] at (2,0,0) {Arm 2};
        
        % Dimensions
        \draw[<->] (0,1.2,0) -- (2,1.2,0) node[midway, above] {$l_1$};
        \draw[<->] (2.2,1,0) -- (2.2,-1,0) node[midway, right] {$l_2$};
        \draw[<->] (0,-1.2,0) -- (2,-1.2,0) node[midway, below] {$L_1$};
        \draw[<->] (2.2,-1,0) -- (2.2,-1,3) node[midway, right] {$L_2$};
        
        % Theta angles
        \draw[->] (0.5,1,0.2) arc[start angle=90, end angle=60, radius=0.5];
        \node at (0.8,1,0.5) {$\theta_1, \tau_1$};
        \draw[->] (2.5,-1,0.2) arc[start angle=90, end angle=60, radius=0.5];
        \node at (2.8,-1,0.5) {$\theta_2, \tau_2$};
        
        % Dashed Lines
        \draw[dashed] (2,-1,0) -- (2,-1,3);
        \draw[dashed] (0,0,0) -- (2,0,0);
        \draw[dashed] (0,1,0) -- (2,1,0);
        
        % Ghost arm positions
        \draw[dotted, thick] (0,-1,0) -- (2,-1,0) -- (2,-1,-3);
        \draw[dotted, thick] (0,-1,0) -- (0,0,0);
        
        % Dashed ghost lines for the angles
        \draw[dashed] (2,-1,0) -- (2,-2,0);
        \draw[dashed] (2,-1,0) -- (3,-1,0);
        
    \end{tikzpicture}
\end{document}
3

0

You must log in to answer this question.

Browse other questions tagged .