This commit is contained in:
Thies Lennart Alff 2023-11-03 09:01:10 +01:00
parent 56d0afd3b6
commit 347279437f
2 changed files with 28 additions and 25 deletions

View file

@ -4,24 +4,23 @@
\usepackage{etoolbox} \usepackage{etoolbox}
\tcbuselibrary{minted,skins,breakable} \tcbuselibrary{minted,skins,breakable}
\newtcblisting{pythoncode}[2][]{ \makeatletter
listing engine=minted, \renewenvironment{minted@colorbg}[1]{
listing only, \setlength{\fboxsep}{\z@}
nobeforeafter, \def\minted@bgcol{#1}
minted style=friendly, \noindent
minted language=python, \begin{lrbox}{\minted@bgbox}
minted options={escapeinside=||,fontsize=\scriptsize,numbersep=3mm,texcl=true,linenos,#1}, \begin{minipage}{\linewidth}}
left=5mm,enhanced, {\end{minipage}
overlay={ \end{lrbox}%
\begin{tcbclipinterior} \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}}
\fill[black!25] (frame.south west) rectangle ([xshift=5mm]frame.north west); \makeatother
\end{tcbclipinterior}
}, \usemintedstyle{friendly}
#2, \newminted[pythoncode]{python}{frame=single, framesep=2pt, numbersep=1mm, linenos, fontsize=\tiny, escapeinside=||, bgcolor=black!10}
}
\def\theFancyVerbLine{% \def\theFancyVerbLine{%
\rmfamily\tiny\arabic{FancyVerbLine}% \ttfamily\tiny\arabic{FancyVerbLine}%
{\tikz[remember picture,overlay]\node(minted-\arabic{FancyVerbLine}){};}% %{\tikz[remember picture,overlay]\node(minted-\arabic{FancyVerbLine}){};}%
} }

View file

@ -69,15 +69,15 @@
\end{tikzpicture} \end{tikzpicture}
\begin{itemize} \begin{itemize}
\color{mumgreen} \color{mumgreen}
\item these nodes are included in our template for assignment 1 \pause \item<7-> these nodes are included in our template for assignment 1 \pause
\item communication between them is already set up! \item<8-> communication between them is already set up!
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{Where to Start?} \frametitle{Where to Start?}
% \begin{noindent} % \begin{noindent}
\begin{pythoncode}[fontsize={\tiny}]{} \begin{pythoncode}
class DepthControlNode(Node): class DepthControlNode(Node):
def __init__(self): def __init__(self):
@ -96,7 +96,7 @@ class DepthControlNode(Node):
\end{pythoncode} \end{pythoncode}
% \end{noindent} % \end{noindent}
\begin{itemize} \begin{itemize}
\item<2-> \color<4->{gray}{implement callbacks (\texttt{on\_setpoint}, \texttt{on\_depth})} \only<4->{\color{mumbluefont}{$\Rightarrow$ already given in our template!}} \item<2-> \color<4->{gray}{implement callbacks (\texttt{on\_setpoint}, \texttt{on\_depth})} \only<4->{\color{mumbluefont}{$\Rightarrow$ given in template!}}
\item<3-> \color<5->{red}{implement the control law} \item<3-> \color<5->{red}{implement the control law}
\end{itemize} \end{itemize}
\end{frame} \end{frame}
@ -107,7 +107,7 @@ class DepthControlNode(Node):
\textbf{\Large Again, starting point already provided in our template!} \textbf{\Large Again, starting point already provided in our template!}
\vskip0.5cm \vskip0.5cm
% \begin{noindent} % \begin{noindent}
\begin{pythoncode}[fontsize={\tiny}]{} \begin{pythoncode}
class DepthControlNode(Node): class DepthControlNode(Node):
|\vdots| |\vdots|
@ -124,6 +124,8 @@ class DepthControlNode(Node):
\begin{equation} \begin{equation}
u = K_{\mathrm{p}} e + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e} u = K_{\mathrm{p}} e + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e}
\end{equation} \end{equation}
\pause
\centering
\begin{tikzpicture}[node distance=10mm and 20mm] \begin{tikzpicture}[node distance=10mm and 20mm]
\coordinate (start); \coordinate (start);
\coordinate[right=of start] (first_junction); \coordinate[right=of start] (first_junction);
@ -152,9 +154,10 @@ class DepthControlNode(Node):
\begin{equation} \begin{equation}
u = \textcolor{red}{K_{\mathrm{p}} e} + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e} u = \textcolor{red}{K_{\mathrm{p}} e} + K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau + K_{\mathrm{d}}\dot{e}
\end{equation} \end{equation}
\pause
\textbf{\Large Code:}\vskip0.25cm \textbf{\Large Code:}\vskip0.25cm
% \begin{noindent} % \begin{noindent}
\begin{pythoncode}[fontsize={\tiny}]{} \begin{pythoncode}
class DepthControlNode(Node): class DepthControlNode(Node):
|\vdots| |\vdots|
@ -172,8 +175,9 @@ class DepthControlNode(Node):
\begin{equation} \begin{equation}
u = K_{\mathrm{p}} e + \textcolor{mumblue}{K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau} + K_{\mathrm{d}}\dot{e} u = K_{\mathrm{p}} e + \textcolor{mumblue}{K_\mathrm{i} \int_0^{t} e\,\mathrm{d}\tau} + K_{\mathrm{d}}\dot{e}
\end{equation} \end{equation}
\pause
% \begin{noindent} % \begin{noindent}
\begin{pythoncode}[fontsize={\tiny}]{} \begin{pythoncode}
class DepthControlNode(Node): class DepthControlNode(Node):
def __init__(self): def __init__(self):
self.error_integral = 0.0 self.error_integral = 0.0
@ -207,7 +211,7 @@ class DepthControlNode(Node):
}{} }{}
\pause \pause
% \begin{noindent} % \begin{noindent}
\begin{pythoncode}[fontsize={\tiny}]{} \begin{pythoncode}
class DepthControlNode(Node): class DepthControlNode(Node):
def __init__(self): def __init__(self):
self.error_integral = 0.0 self.error_integral = 0.0