\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{graphicx} %BIlder einbinden
\usepackage{amsmath} %erweiterte Mathe-Zeichen
\usepackage{amsfonts} %weitere fonts
\usepackage[utf8]{inputenc} %Umlaute & Co
\usepackage{hyperref} %Links
\usepackage{ifthen} %ifthenelse
\usepackage{enumerate}
\usepackage{pdfpages}
\usepackage{algpseudocode} %Pseudocode
\usepackage{dsfont} % schöne Zahlenräumezeichen
\usepackage{amssymb, amsthm} %noch stärker erweiterte Mathe-Zeichen
\usepackage{tikz} %TikZ ist kein Zeichenprogramm
\usetikzlibrary{trees,automata,arrows,shapes}

\pagestyle{empty}


\topmargin-50pt

\newcounter{aufgabe}
\def\tand{&}

\newcommand{\makeTableLine}[2][0]{%
  \setcounter{aufgabe}{1}%
  \whiledo{\value{aufgabe} < #1}%
  {%
    #2\tand\stepcounter{aufgabe}%
  }
}

\newcommand{\aufgTable}[1]{
  \def\spalten{\numexpr #1 + 1 \relax}
  \begin{tabular}{|*{\spalten}{p{1cm}|}}
    \makeTableLine[\spalten]{A\theaufgabe}$\Sigma$~~\\ \hline
    \rule{0pt}{15pt}\makeTableLine[\spalten]{}\\
  \end{tabular}
}

\def\header#1#2#3#4#5#6#7{\pagestyle{empty}
\begin{minipage}[t]{0.47\textwidth}
\begin{flushleft}
{\bf #4}\\
#5
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{flushright}
#6 \vspace{0.5cm}\\
%                 Number of Columns    Definition of Columns      second empty line
% \begin{tabular}{|*{5}{C{1cm}|}}\hline A1&A2&A3&A4&$\Sigma$\\\hline&&&&\\\hline\end{tabular}\\\vspace*{0.1cm}
\aufgTable{#7}
\end{flushright}
\end{minipage}
\vspace{1cm}
\begin{center}
{\Large\bf Assignment #1}

{(Hand-in date #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

%Kommando für Aufgaben
%\Aufgabe{AufgTitel}{Punktezahl}
\newcommand{\Aufgabe}[2]{\stepcounter{n}
\textbf{Exercise \arabic{n}: #1} (#2 Punkte)\\}




\begin{document}
    %\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
    \header{3}{}{2015-12-05}{Mobile Robots}{
    	\textit{Jan-Peter Hohloch}\\ \textit{Maximus Mutschler}
    }{SS 15}{3}
    \vspace{1cm}

	\Aufgabe{}{8}
	\begin{enumerate}[(a)]

	\item
	\begin{tikzpicture}
	\draw[->] (1,0) -- (-3,0) node[anchor=north]{$x$ in m};
	\draw[->] (0,0) -- (0,2) node[anchor=east] {$y$ in m};
	
	\draw	(0,0) node[anchor=north] {0}
	
	(-1,0) node[anchor=north] {-1}
	(-2,0) node[anchor=north] {-2}
	;
	
		\draw	(0,1) node[anchor=east] {1};
	
	\coordinate (A) at (0,0);
	\coordinate (B) at (0,1);
	\coordinate (C) at (-1,1);
	\coordinate (D) at (-2,1);
		
	\draw [fill=blue] (A) circle (2pt) node [left] {x1};
	\draw [fill=blue] (B) circle (2pt) node [right] {x2};
	\draw [fill=blue] (C) circle (2pt) node [left] {x3};
	\draw [fill=blue] (D) circle (2pt) node [left] {x4};	

	\draw[red,->] (A) -- (0,1) ;
	 \draw[blue,->] (A) -- (0,0.5) ;
	\draw[blue,->] (B) -- (0,1.5) ;
	\draw[blue,->] (C) -- (-1,0.5) ;
	\draw[blue,->] (D) -- (-2,1.5) ;
	
	\draw[red,->] (B) arc (0:180:0.5) ;
	\draw[red,->] (C) arc (0:180:0.5) ;

	%TODO Trajectories
	\end{tikzpicture}
	\item $u_t= \begin{pmatrix}
	\frac{2v_t-l\omega_t}{2}\\
	\frac{2v_t+l\omega_t}{2}\\
	\end{pmatrix}$
	\\ $l=0.2m$ \\
		\begin{itemize}
		 \item$ v_0=1\\
		 \omega_0=0 
		 \\u_0= \begin{pmatrix}
			\frac{2*1}{2}\\
			\frac{2*1}{2}\\
			\end{pmatrix}=
			\begin{pmatrix}
				1\\
				1
			\end{pmatrix} \frac{m}{s}$
		\item$ \Delta s=r * \Delta \varTheta\\
		r=0.5,\Delta \varTheta= \pi \\
		 v_1= \frac{\Delta s}{\Delta t_1} 
		= 0.5\pi\\
		\omega_1=\frac{\Delta \varTheta}{\Delta t_1} 
		 = \pi
		\\
		u_1= \begin{pmatrix}
		\frac{2*0.5*\pi-0.2*\pi}{2}\\
		\frac{2*0.5*\pi+0.2*\pi}{2}\\
		\end{pmatrix} = \begin{pmatrix} 1.2567\\ 1.885 \end{pmatrix} \frac{m}{s}
		$	
			\item$ \Delta s=r * \Delta \varTheta\\
			r=0.5,\Delta \varTheta= -\pi \\
			v_2= \frac{\Delta s}{\Delta t_2} 
			= -0.5\pi\\
			\omega_2=\frac{\Delta \varTheta}{\Delta t_2} 
			= -\pi
			\\
			u_2= \begin{pmatrix}
			\frac{-2*0.5*\pi+0.2*\pi}{2}\\
			\frac{-2*0.5*\pi-0.2*\pi}{2}\\
			\end{pmatrix} = \begin{pmatrix} -1.2567\\ -1.885 \end{pmatrix} \frac{m}{s}
			$	
		\end{itemize}
			
	\item $l_\omega = 0.3m$ irrelevant\\ $l_a = 0.5m \\
 \varPsi	=  tan^{-1}(\frac{l_a}{r_t})\\
 v_t= \frac{\Delta s}{\Delta t}
	$
	\begin{itemize}
		\item 	$u_1=\begin{pmatrix}
			0^\circ\\
			1 \frac{m}{s}
		\end{pmatrix} $
		\item 
			$ \varPsi_1	=  tan^{-1}(\frac{0.5}{0.5}) = 45^\circ\\
			v_1= 0.5*\pi= 1.5708 \frac{m}{s}\\
			u_1=\begin{pmatrix}
			45^\circ\\
			1.5708 \frac{m}{s}
		\end{pmatrix} $
		\item 	
			$u_2=-u_1=\begin{pmatrix}
			-45^\circ\\
			-1.5708 \frac{m}{s}
			\end{pmatrix} $
		
	\end{itemize}	

\end{enumerate}
	
	
	\Aufgabe{}{4}
	$ r=1m \\
	l_\omega = 0.3m\\
	l_a=0.5m
	$
	\begin{enumerate}[(a)]
		\item 
		Assumed left rotation:\\
		$\varPsi_l = tan^{-1}(\frac{l_a}{r-0,5l_\omega}) = tan^{-1}(\frac{0.5}{1-0.5*0.3})= 30.47^\circ\\
		\varPsi_r = tan^{-1}(\frac{l_a}{r+0,5l_\omega}) = tan^{-1}(\frac{0.5}{1+0.5*0.3})=23.5^\circ
		$
		
		
			\begin{figure}[!htb]
			
				\centering
				\includegraphics[width=0.6\textwidth]{CalcPhi.png}
				\caption{\label{fig:Psi01} Determination of $\varPsi_r$ and $\varPsi_l$}
				
			\end{figure}
		\item
		$sl = 2*PI* (1-0.5*0.3) = 5.341m	\\
		sr = 2*PI* (1+0.5*0.3)  =7.225m\\
		sl -sr = 1.885m
		$
			
	\end{enumerate}

	\Aufgabe{}{8}
	\begin{enumerate}[(a)]
	\item $ r= \frac{l}{2\tan^{-1}(\varPsi)}$
	\item todo 	
	\item $ l_1 = r\tan^{-1}(\varPsi_1)\\
	l_2 = r\tan^{-1}(\varPsi_2)\\
	$
\item $r = \frac{l\sin(\Psi_2-\frac{\pi}{2})\sin(\Psi_1-\frac{\pi}{2})}{\Psi_1+\Psi_2}$ 

	\end{enumerate}
	Die war zu einfach ... da ist irgendwas falsch...    
	
     
    

\end{document}

