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

View file

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