\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[english,greek]{babel}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{graphicx}
\usepackage{indentfirst}
\usepackage{array}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{positioning}
\usepackage{cancel}
\usetikzlibrary{chains,
arrows.meta,
positioning,
quotes,
shapes,
calc}
\tikzset{
block/.style={
draw,
fill=blue!20,
rectangle,
minimum height=3em,
minimum width=1em,
text centered,
text width=2cm
},
sum/.style={
draw,
fill=blue!20,
circle,
},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={
pin edge={to-,thin,black}
}
}
\begin{document}
\begin{figure}[H]
\centering
\tikzstyle{block} = [draw, rectangle,
minimum height=3em, minimum width=3em, fill=blue!20]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\begin{tikzpicture}[auto,node distance=2cm, thick,node/.style={circle,draw}]
% We start by placing the blocks
\node [input, name=input] {};
\node [input, name=velocities, above of=input] {};
\node [sum, right of=input] (sum) {};
\node [block, right of=sum] (controller) {\textlatin{P-Controller}};
\node [sum, right of=controller, node distance=2cm] (vel_sum) {};
\node [block, right of=vel_sum] (jacobian) {$\text{\textlatin{J}}^{-1}$};
\node [block, right of=jacobian,
node distance=2cm] (integrator) {$\int$};
% We draw an edge between the controller and system block to
% calculate the coordinate u. We need it to place the measurement block.
%\draw [->] (controller) -- node[name=u] {$U$} (system);
\node [output, right of=integrator] (output) {};
\node [block, below of=vel_sum] (fwd_kin) {$\Gamma(.)$};
% Once the nodes are placed, connecting them is easy.
\draw [draw,->] (input) -- node[pos=0.1] {$p_{r},\omega_{r} \ +$} (sum);
\draw [draw,->] (velocities) -| node[pos=0.01] {$\dot{p}_r,\dot{\omega}_r$} node[pos=0.9] {$+$} (vel_sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (controller) -- node {$+$} (vel_sum);
\draw [->] (vel_sum) -- node {$ee_{vel}$} (jacobian);
\draw [->] (jacobian) -- node {$\dot{q}$} (integrator);
\draw [->] (integrator) -- node [name=q] {$q$}(output);
\draw [->] (q) |- (fwd_kin);
\draw [->] (fwd_kin) -| node[pos=0.99] {$-$}
node [near end] {$p,\omega$} (sum);
\end{tikzpicture}
\caption{Control Scheme}
\end{figure}
\end{document}
我已经编写了上述脚本,我想对其进行修改,使其显示黑色箭头。我花了一些时间,但找不到合适的解决方案,所以我在这里提问。任何想法都将不胜感激。
答案1
您的 MWE 存在许多问题:
- 图片元素样式定义两次
- 一些钛钾Z 库加载两次
- 为什么您要加载
chains
库quotes
但却不在图像代码中使用它们?
\documentclass[11pt]{article}
\usepackage[english,greek]{babel}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows.meta,
calc, chains,
positioning,
quotes,
shapes,
}
\usepackage{cancel}
\usepackage{hyperref}
\tikzset{
arr/.style = {-{Straight Barb[scale=0.8]},semithick},
block/.style = {draw, fill=blue!20,
minimum height=3em, minimum width=2em,},
dot/.style = {circle, fill, inner sep=2pt, outer sep=0pt},
sum/.style = {circle, draw, fill=blue!20},
every edge/.style = {draw, arr},
every edge quotes/.style = {auto, font=\small}
}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[
node distance=12mm and 11mm,
start chain = going right
]
% main branch
\begin{scope}[nodes={on chain}]
\coordinate (in-1);
\node[sum] (sum-1) {};
\node[block] (cntrl) {\textlatin{P-Controller}};
\node[sum] (sum-2) {};
\node[block] (jacobian) {$\mathrm{J}^{-1}$};
\node[block] (int) {$\int$};
\node[dot] (dot) {};
\coordinate (out);
\end{scope}
\coordinate[above=of in-1] (in-2);
\node[block, below=of sum-2] (fwd_kin) {$\Gamma(\cdot)$};
% edges
\draw (in-1) edge["{$p_{r},\omega_{r}\ +$}"] (sum-1)
(sum-1) edge["$e$"] (cntrl)
(cntrl) edge[pos=0.9, "$+$"] (sum-2)
(sum-2) edge["$ee_{\mathrm{vel}}$"] (jacobian)
(jacobian) edge["$\dot{q}$"] (int)
(int) edge[pos=0.25, "$q$"] (out);
\draw[->] (dot) |- (fwd_kin);
\draw[->] (dot) |- (in-2 -| jacobian) -- (jacobian);
\draw[->] (fwd_kin) -| node[pos=0.95, left] {$-$}
node [near end, left] {$p,\omega$} (sum-1);
\draw[->] (in-2) node[above right] {$\dot{p}_r,\dot{\omega}_r$} -|
node[pos=0.85,right] {$+$} (sum-2);
\end{tikzpicture}
\caption{Control Scheme}
\end{figure}
\end{document}
答案2
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{chains,
arrows.meta,
positioning,
quotes,
shapes,
calc}
\tikzset{
block/.style={
draw,
fill=blue!20,
rectangle,
minimum height=3em,
minimum width=1em,
text centered,
text width=2cm
},
sum/.style={
draw,
fill=blue!20,
circle,
},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={
pin edge={to-,thin,black}
}
}
\begin{document}
\tikzstyle{block} = [draw, rectangle,
minimum height=3em, minimum width=3em, fill=blue!20]
\tikzstyle{sum} = [draw, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\begin{tikzpicture}[auto,node distance=2cm, thick,node/.style={circle,draw}]
% We start by placing the blocks
\node [input, name=input] {};
\node [input, name=velocities, above of=input] {};
\node [sum, right of=input] (sum) {};
\node [block, right of=sum] (controller) {P-Controller};
\node [sum, right of=controller, node distance=2cm] (vel_sum) {};
\node [block, right of=vel_sum] (jacobian) {${J}^{-1}$};
\node [block, right of=jacobian,
node distance=2cm] (integrator) {$\int$};
% We draw an edge between the controller and system block to
% calculate the coordinate u. We need it to place the measurement block.
%\draw [->] (controller) -- node[name=u] {$U$} (system);
\node [output, right of=integrator] (output) {};
\node [block, below of=vel_sum] (fwd_kin) {$\Gamma(.)$};
% Once the nodes are placed, connecting them is easy.
\draw [draw,->] (input) -- node[pos=0.1] {$p_{r},\omega_{r} \ +$} (sum);
\draw [draw,->] (velocities) -| node[pos=0.01] {$\dot{p}_r,\dot{\omega}_r$} node[pos=0.9] {$+$} (vel_sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (controller) -- node {$+$} (vel_sum);
\draw [->] (vel_sum) -- node {$ee_{vel}$} (jacobian);
\draw [->] (jacobian) -- node {$\dot{q}$} (integrator);
\draw [->] (integrator) -- node [name=q] {$q$}(output);
\draw [->] (q) |- (fwd_kin);
\draw [->] (fwd_kin) -| node[pos=0.99] {$-$}
node [near end] {$p,\omega$} (sum);
\draw[->] (q) -- +(0,1) -| (jacobian); %added
\end{tikzpicture}
\end{document}