2

right now I try to create the following diagram with Tikz:

enter image description here

But I have problems to create the arrows between the different nodes, especially the arrow between the node amcl, sensor transforms and odometry source, the arrow "/tf", which goes from the arrow, described above, to the node move_base. The last arrow, where I have problems, goes from the sensor sources to the arrow between local costmap and global costmap.

Could anyone help me creating this picture?

Thank you very much in advance!

My code right now looks like this:

\begin{tikzpicture}
    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](amcl) at (0,1.6){amcl};
    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](sensor transforms) at (0, 0){sensor transforms};
    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](odometry source) at (0, -1.6){odometry source};

    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](map server) at (14, 1.6){map server};
    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](sensor sources) at (14, 0.0){sensor sources};

    \node[draw, minimum height=6cm, minimum width=7cm](move base) at(7,0){};
    \node[draw, ellipse, text width=1.5cm, scale=0.75](global planner) at(5.3,1.6){global planner};
    \node[draw, ellipse, text width=1.5cm, scale=0.75](global costmap) at(8.8,1.6){global costmap};
    \node[draw, ellipse, text width=2.4cm, scale=0.75](local planner) at(5.3, -1.6){local planner};
    \node[draw, ellipse, text width=2.5cm, scale=0.75](local costmap) at(8.8, -1.6){local costmap};
    \node[draw, ellipse, text width=1.75cm, scale=0.75](recovery behaviors) at(7.05, 0.0){recovery behaviors};

    \node[draw, minimum height=1cm, minimum width=3.7cm, scale=0.75](base controller) at (5.3, -4.0){base controller};


    \draw[->](map server) -- (global costmap);
    \draw[->](global costmap) -- (global planner);
    \draw[->](global planner) -- (local planner);
    \draw[->](local costmap) -- (recovery behaviors);
    \draw[->](local costmap) -- (local planner);
    \draw[->](global costmap) -- (recovery behaviors);
    \draw[<->](global costmap) -- (local costmap);
    \draw[->](local planner) -- (base controller);
    \draw[->](odometry source) -- (local planner);
\end{tikzpicture}
2
  • Welcome! You could just add \draw[->](amcl) -- (sensor transforms); \draw[->](sensor transforms)-- (odometry source);\draw[<->](local costmap)-- (global costmap); to get these arrows.
    – user194703
    Commented Nov 26, 2019 at 17:57
  • Hey thanks for your answer. My question was not specific enough. If am using your code, the arrow from the node amcl to sensor transforms is from the bottom of the amcl node to the top of the sensor transform. What I want is the same as in the picture. Therefore, the arrows needs to be on the right. What I am also looking for is the arrow "sensor topics", which goes from sensor sources to the arrow between global costmap and local costmap. I will edit my question to make it more specific.
    – Simon K
    Commented Nov 26, 2019 at 18:39

1 Answer 1

2

Here is a way to add the arrows. I also switched to relative positioning, using the library of the same name, and added several other features such as copy shadows, local bounding boxes and a fit. Repeating collections of pgf keys get absorbed in styles. You will have to complete the edge texts. (No, I do not think that the quotes library will make things significantly simpler here. ;-)

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{shapes.geometric,fit,positioning,shadows}
\begin{document}
\begin{tikzpicture}[box/.style={draw, minimum height=1cm, minimum
        width=3.7cm, scale=0.75},
  elli/.style={draw, ellipse, text width=1.5cm, scale=0.75,align=center},
  Blue/.style={fill=blue!20},Gray/.style={fill=gray!20},
  bullet/.style={circle,fill,inner sep=1pt},
  >=stealth,font=\sffamily,node distance=2.5em]
  %
    \begin{scope}[local bounding box=left]
     \node[box,Gray](amcl){amcl};
     \node[box,below=of amcl,double copy shadow={shadow xshift=-.5ex},Blue](sensor transforms) {sensor transforms}; 
     \node[box,below=of sensor transforms,Blue](odometry source){odometry source};
    \end{scope} 
    %
    \begin{scope}[local bounding box=ellipses,anchor=center,nodes=elli]
     \node[right=3.8cm of odometry source, text width=2.4cm](local planner){local planner};
     \path (local planner.center) 
        ++ (0,3) node(global planner) {global planner}
        ++ (4,0) node(global costmap){global costmap}
        ++ (0,-3)   node[text width=2.5cm](local costmap){local costmap};
     \path  (local planner.center) --  (global costmap.center)
      node[text width=1.75cm,midway](recovery behaviors) {recovery behaviors};
    \end{scope} 
    \node[draw, fit=(ellipses),inner sep=5mm,
        label={[anchor=north west,scale=0.6]north west:move\_base}](move base){};
    %
    \node[box,above right=0em and 3.8cm of global costmap,Gray](map server) {map\_server};
    \node[box,below=4em of map server,double copy shadow={shadow xshift=-.5ex},Blue](sensor sources) {sensor sources};
    %
    \node[box,below=2cm of local planner,Blue](base controller){base controller};
    %
    \node[right=1ex of sensor transforms,bullet] (p){};
    \node[bullet] at (sensor sources-|local costmap)(q){};
    \begin{scope}[semithick,nodes={scale=0.6,align=center}]
    \draw (amcl) -| (p) (odometry source) -| (p) (sensor transforms) -- (p);
    \draw[->](amcl) -- (sensor transforms);
    \draw[->](sensor transforms)-- (odometry source);
    \draw[->] (p) -- node {"tf"\\[1ex] tf/tMessage} (p-|move base.west);
    \draw[<->](local costmap)-- (global costmap);
    \draw[->](map server) -| 
        node[pos=0.15] {"/map"\\[1ex] nav\_get...} (global costmap);
    \draw[->](global costmap) -- (global planner);
    \draw[->](global planner) -- (local planner);
    \draw[->](local costmap) -- (recovery behaviors);
    \draw[->](local costmap) -- (local planner);
    \draw[->](global costmap) -- (recovery behaviors);
    \draw[<->](global costmap) -- (local costmap);
    \draw[->](local planner) -- node[pos=0.7,left]{"cmd\_vel"}
         node[pos=0.7,right]{"geometry\_message/Twist"} (base controller);
    \draw[->](odometry source) --  node {"odom"\\[1ex] nav\_mess/Odometry} (local planner);
    \draw[->](sensor sources)-- node[above,pos=0.3]{bla} node[below,pos=0.3]{blub}(q);
    \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

1
  • Awesome, thank you very much!
    – Simon K
    Commented Nov 26, 2019 at 18:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .