%&tex
    As the previous development cycle was aborted prematurely, that cycle did not finish.
    The second cycle is picks up at the feature selection step in the Development Cycle.

    \subsection{Feature Selection}
        The implementation of the end-effector proofed to be impractical.
        This means that only two features are left.
        The updated table in \autoref{tab:featurestab2} shows the updated feature comparison.
        Compared with the previous feature selection in \autoref{tab:firstfeatureselection}, the number of tests for the SCARA decreased and the Risk/Time increased.
        This is because System Test \ref{test_tool_change} relied on both the SCARA and the End-effector and is no longer applicable.
        Based on the feature comparison, the next component to implement is the SCARA.

        \begin{table}[]
            \caption{}
            \label{tab:featurestab2}
            \begin{tabular}{|l|l|l|l|l|l|}
                \hline
                Feature      & Dependees   & Tests  & Risk   & Time    & Risk/Time  \\ \hline
                SCARA        & -           & 2      & 50\%   & 12 days & 4.2        \\ \hline
                Carriage     & -           & 2      & 30\%   & 10 days & 3          \\ \hline
            \end{tabular}
        \end{table}

    \subsection{Rapid Development of SCARA}
        At the end of this implementation the SCARA is able to write the first characters
        This will be achieved by working through different levels of detail.
        Where each level adds more detail to the model.
        The levels that are implemented are as follow:
        \begin{enumerate}
            \item Basic kinematics model, no physics.
            \item Basic physics model, ideal 2D physics.
            \item Basic Motor behavior, 2D physics with non-ideal DC-motor.
            \item Basic control law, path planning.
            \item Advanced motor behavior, 2D physics with stepper motor behavior.
            \item Advanced physics model, 3D physics with complex dynamics with Lie-algebra.
            \item Marker lifting behavior, servo lifts marker of the board.
        \end{enumerate}
        This mainly describes the different level of physics detail.
        Together with the physics model there will be a solid 3D CAD model.
        The CAD model helps to check with dimensions and possible collisions of objects.

    \subsection{Variable Approach}
        The following steps is to increase the detail of the model.
        This is done according to the steps in the previous section.

        \subsubsection{Basics implementation}
            \begin{marginfigure}
                    \centering
                    \begin{tikzpicture}
                            \tikzstyle{arrow} = [-latex,ultra thick]
                    
                    % draw roof
                    \fill[pattern = north east lines] ($ (0,0) + (-1,0) $) rectangle ($ (0,0) + (1,0.5) $);
                    \draw[thick] ($ (0,0.5) + (-1,0) $) -- ($ (0,0.5) + (1,0) $);
                    
                    %draw arm and joints
                            \fill (0,0.5) circle (0.2);  
                            \draw[thick] (0,0.5) to node[midway,right,draw=none] {$a$} (-1.5,3.5);  
                            \fill (-1.5,3.5) circle (0.2); 
                            \draw[thick] (-1.5,3.5) to node[midway,above,draw=none] {$b$}(1.51,4.26);		
                            
                            %draw mass
                            \draw (1.7,4.32) circle (0.2) node {$m$};
                            
                            %draw arc
                    %\draw[dashed,gray] (-1.5,3.5) -- ++(2.5,0);
                    %\draw (1,0.5) arc (0:116:1cm) node[above,midway] {$\theta$};	

                    %\draw [arrow] (c.south) -- +(0,-1cm) node[midway,right,draw=none] {$F_{g} = m \cdot g$};
                    \end{tikzpicture}
                    \caption{Basic kinematics of the SCARA}
                    \label{fig:scaraarm}
            \end{marginfigure}
            The first four detail steps are just creating the basics dynamics of the SCARA as shown in \autoref{fig:scaraarm}
            It start with the kinematics model that is used to test the forward and inverse kinematics of the design.
            It gave a general idea of angles and arm lengths that are required in the design.
            The second detail iteration adds the basic physics of the model.
            This model was in the form of a double pendulum, with to powered joints.
            The ideal motors in the joints made it that it could move with almost infinite speed.
            To get a better idea of the forces in the model, the ideal motors are replaced with a better motor model.
            As the system did not operate with infinite gain anymore it the path planning was updated as well.
            A simple PID-controller was implemented to make the SCARA follow a rectangular path.
            
            \begin{marginfigure}
                \centering
                \includegraphics[width=0.9\linewidth]{graphics/scara_20sim_model.png}
                \caption{3D plot of the current implementation. The rectangular shapes represent are the linkages and implemented as rigid bodies. 
                The sphere on the origin and the one between both linkages represent the actuated joints.
                There is no inertia implemented for these joints.}
                \label{fig:scara_20sim}
            \end{marginfigure}
            
            The current implementation can be seen in \autoref{fig:scara_20sim}.
            Now that the model forms a basic with the non-ideal motors, basic physics and a control law, it can be used to make some estimates.
            The model was configured to follow the required path in the specified amount out time according to System Test \ref{test1}.
            The torque required gave a rough estimate of the required actuation force of the motors.
        
        \subsubsection{Detailed design decisions}
            The basic model gave some good insight and information about the dynamic behavior of the system.
            However, the current configuration is very simple but requires a motor in the joint.
            In \autoref{fig:scaradesign}, this setup is shown as configuration 1.
            The disadvantage is that a motorized joint is heavy and has to be accelerated with the rest of the arm.
            Other configurations in \autoref{fig:scaradesign} move the motor to a static position.
            Configuration 2 is a double arm setup, but has quite limited operating range.
            Due to a singularity in the system when both arms at the top are in line with each other.
            Configuration 3 also has such a singularity, but due to the extended top arm this point of singularity is outside of the operating range.
            However, this configuration requires one axis with two motorized joints on it.
            Even though this is possible, it does increase the complexity of the construction.
            By adding an extra linkage, the actuation can be split as shown in configuration 4.
            \begin{figure}
                \centering
                \includegraphics[width=0.875\linewidth]{graphics/scara_design.pdf}
                \caption{Four different SCARA configurations. The colored circles mark which of the joints are actuated. Configuration 3 has two independently actuated joints on the same position.}
                \label{fig:scaradesign}
            \end{figure}

            The actuation of the arm is done with stepper motors.
            The advantage of stepper motors over simple DC-motors is that they hold a specific position.
            There is no extra feedback loop required to compensate for external forces.
            However, they are heavier and more expensive.
            But the extra mass is probably beneficial as adds momentum to the base.
            Reducing the counter movement of the base when the arm is actuated.

        \subsubsection{Implementing details}
            The first step was to replace the DC-motor with a stepper motor model.
            This based on a model by \textcite{karadeniz_modelling_2018}.
            The controller is updated as well, to accommodate for the behavior of the steppers,

            The next step is to implement a dynamic model of the configuration (4) as shown in \autoref{fig:scaradesign}.
            The dynamics of the SCARA are based on a serial link structure \autocite{dresscher_modeling_2010}.


        \subsubsection{3D Modeling}
            With a full dynamics model in 20-sim, the next step was to design the system in OpenSCAD.
            Although 20-sim has a 3D editor, it is significantly easier to build components with OpenSCAD.
            Furthermore, for prototyping the OpenSCAD objects can be exported for 3D printing.
            The model made it possible to check component clearance and get an idea of size.
            The model is shown in \autoref{fig:scad_carriage}.
            \begin{figure}
                \centering
                \includegraphics[width=0.8\linewidth]{graphics/scad_carriage.png}
                \caption{Rendered 3D model of the SCARA}
                \label{fig:scad_carriage}
            \end{figure}

