Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to draw a control block, but I got problem to connect two input to a block

How can draw a line from the u1 to the estimator without drawing on the estimator block?

enter image description here

This is what I tried

\tikzstyle{block} = [draw, rectangle, 
    minimum height=1cm, minimum width=2cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{arrow}=[draw, -latex]
\tikzstyle{pinstyle} = [pin edge={latex-, black}]
\tikzstyle{sum} = [draw, circle, node distance=1cm]

% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
   % We start by placing the blocks
   \node [input, name=input] {};
   \node [sum, right of=input] (sum) {};
   \node [block, right of=sum] (controller) {Controller};
   \node [block, right of=controller, node distance=3cm] (system) {System};         
   \node [output, right of=system] (output) {};

   %Connect
   \draw [arrow] (input) -- node {$y_{_1ref}$} (sum);
   \draw [arrow] (sum) -- node [name=y_err_one] {$e_{_1}$} (controller);
   \draw [arrow] (controller) -- node [name=u_one] {$u_{_1}$} (system);
   \draw [arrow] (system) -- node [name=y_one] {$y_{_1}$} (output);

   %Second leader
   \node [block, below of=u_one] (estimator_one) {Estimator};
   %\node [block, left of=estimator_one, node distance=3cm] (cs_to_js_one) {CS2JS};
   %\node [block, left of=cs_to_js_one] (for_kin) {Forward Kinematics};

   %Connect
   \draw [arrow] (y_one) |- (estimator_one);
   \draw [arrow] (u_one) |- (estimator_one);
   \draw [arrow] (estimator_one) -| node[pos=0.99] {$-$} 
        node [near end, name=y_est_one] {$y_{_1est}$} (sum);


\end{tikzpicture}
share|improve this question
    
Welcome to TeX.SE! Not an answer to your question, but for reference, have a look at Should \tikzset or \tikzstyle be used to define TikZ styles? Could you turn your snippet into a complete MWE Welcome! –  cmhughes Feb 16 '13 at 16:59
1  
Do not use |- or -| if you want just one straight line. TikZ has -- for that: \draw [arrow] (u_one) -- (estimator_one); –  Qrrbrbirlbel Feb 16 '13 at 17:19
add comment

1 Answer 1

up vote 3 down vote accepted

In the code below the main change is

   \path [arrow] (u_one) -- ($(estimator_one.north)+(0,.5)$) 
                         -| ($(estimator_one.east)+(1,1)$)
                         -| ($(estimator_one.east)+(1,0)$)
                         --(estimator_one.east);

which requires \usetikzlibrary{calc}

I also changed tikstyle= to tikzset, as discussed in Should \tikzset or \tikzstyle be used to define TikZ styles?

screenshot

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}

\tikzset{
        block/.style = {draw, rectangle, 
                        minimum height=1cm, 
                        minimum width=2cm},
        input/.style = {coordinate},
        output/.style = {coordinate},
        arrow/.style={draw, -latex},
        pinstyle/.style = {pin edge={latex-, black}},
        sum/.style = {draw, circle, node distance=1cm}
}

\begin{document}
% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
   % We start by placing the blocks
   \node [input, name=input] {};
   \node [sum, right of=input] (sum) {};
   \node [block, right of=sum] (controller) {Controller};
   \node [block, right of=controller, node distance=3cm] (system) {System};         
   \node [output, right of=system] (output) {};

   %Connect
   \draw [arrow] (input) -- node {$y_{_1ref}$} (sum);
   \draw [arrow] (sum) -- node [name=y_err_one] {$e_{_1}$} (controller);
   \draw [arrow] (controller) -- node [name=u_one] {$u_{_1}$} (system);
   \draw [arrow] (system) -- node [name=y_one] {$y_{_1}$} (output);

   %Second leader
   \node [block, below of=u_one] (estimator_one) {Estimator};
   %\node [block, left of=estimator_one, node distance=3cm] (cs_to_js_one) {CS2JS};
   %\node [block, left of=cs_to_js_one] (for_kin) {Forward Kinematics};

   %Connect
   \draw [arrow] (y_one) |- (estimator_one);
   \path [arrow] (u_one) -- ($(estimator_one.north)+(0,.5)$) -| ($(estimator_one.east)+(1,1)$)-| ($(estimator_one.east)+(1,0)$)--(estimator_one.east);
   \draw [arrow] (estimator_one) -| node[pos=0.99] {$-$} 
        node [near end, name=y_est_one] {$y_{_1est}$} (sum);


\end{tikzpicture}
\end{document}
share|improve this answer
1  
I think with \draw[arrow] (u_one)--(estimator_one); should be enough. –  Ignasi Feb 16 '13 at 17:28
    
Also this one a solution, but is it possible to draw a line to the right side of the estimator block? –  Kicsi Mano Feb 16 '13 at 17:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.