\documentstyle[11pt]{article}
\title{A General Purpose Controller for Stiquito}

\author{Shyamsundar Pullela}

\begin{document}

\maketitle

\begin{abstract}
  This report describes a general purpose controller for the
Stiquito robots. Stiquito is a six legged, insect shaped Robot.
It uses the contraction property of shape memory alloy
actuator wire, Nitinol,  for driving the
legs. The controller has the facility to control the direction of
walking, synchronize the leg movements and it can be
programmed to have different gaits. The controller can also 
be given external clocking signal to control the
legs.     
\end{abstract}

\section {Introduction}
	 Stiquito is a six legged Robot. It works on the contracting
 property of Nitinol wire upon heating. The aim of this paper is
 to describe a
 general purpose controller, which can be programmed to get
 different gaits. The main idea is to provide a controller to
 the researchers so that they can concentrate on developing
 different gaits rather than worrying about how to implement
 those gaits on Stiquito. 

      The main controls needed to get different gaits are as
  follows:
\begin{itemize}
\item
	Some way of activating the legs in different order 
	so that we can get different gaits.   
\item
	Some way of controlling the displacement of the leg. This
	facility is used to turn the Stiquito in different
	directions. For example, less displacement for left legs and
	more displacement for right legs make the Stiquito to turn
	left.
\item
	Some way of synchronizing the legs of Stiquito with the
	external signal so that more than one Stiquito can work on a
	single task, signaling each about their status.

\end{itemize}

  The controller presented here does have all the above
facilities and in addition it also has the facility of 
using either an 
internal clock or an externally provided clock. The controller
is designed using the Actel FPGA. The pin diagram is shown
below and the fuctioning of the controller is explained in the
subsequent sections.


\section{A single leg Controller}

   The controller of a single leg is very simple. The ASM for
single leg is as follows.

\input{stk_leg_asm.latex}

  The machine will be looping in the start state as long as that
leg is inhibited. When inhibit is FALSE, the displacement is
loaded into the counter and is counted down. When the count
becomes zero it goes into a synchronizing state where it
waits for SYNC signal. After synchronization it goes back to
initial state.

  Here we have to notice that the value present on displacement
lines at the time of inhibit becoming FALSE will be taken as the
displacement. So any external circuit that controles this leg
should make sure that correct displacement value is present on
the lines at the time of activating the leg.

\section{Controller for six legs}

   The controller for six legs is nothing but a collection of
six of single-leg controllers, except that the displacement
values of all the left legs are connected together. Similarly
the displacement values of all the right legs are connected
together. All the six of them run with the same clock and have
their reset signals connected together.
  
   In the following sections, the purpose of different inputs
and outputs of the six-legged controller is explained.

\section{ The INHIBIT signals}

   These signals are used to control the activity of the
Stiquito legs. As long as the inhibit signal for a leg is TRUE
that particular leg is inactivated and so the signal on the
output pin for that leg would be FALSE. 

  When the inhibit signal of a leg becomes FALSE, the controller
latches the value of displacement present on the displacement
lines at that point and keeps the TRUE on the output
signal of that leg for those many number of clock pulses that
was latched when the inhibit signal went false. Then it goes
into synchronizing state where it waits for a SYNC signal which
is explained in the next section.

\section{ The SYNC signals}

   After maintaining the TRUE value on the output of the leg for
displacement number of clock cycles, the state machine goes into
a synchronizing state. The state machine waits in this state
till it receives a synchronizing signal and then goes into the
initial state. This synchronizing signal is not neccessary in
ideal setup. But in practice we don't have all the legs having
the same mechanical properties. So to over come this problem due
to the mechanical abberation we need to have a synchronizing
signal so that all the legs go into the initial state together.

   These signals are mainly introduced into the design to
synchronize one Stiquito with other. When the stiquitos are
exhibiting co-operative behavior it is essential for them to
synchronize with one another and these signals can used for that
purpose.

\section{The DISPLACEMENT signals}

   The Stiquito controller has two sets of signals for
controlling the displacement of the left and right legs
respectively. Displacement is measure of how many cycles the leg
should be activated. Since the leg is controlled by the Nitinol
wire, the more the number of cycles for which the leg is
activated, the more the time for which current is passed through
the nitinol wire and the more the leg swings backwards.
 
	For the sake of implementing the controller in digital domain
the maximum
displacement is divided into eight equal parts. So the
displacement is an integer between 0 and 7. Maximum displcement,
viz., 7, will activate the Nitinol wire for about a second and
a displacement 0 will not move the leg.

   The displacement is used to control the direction movement of
Stiquito. For example, if we give a displacement 2 to left legs
and displcement 7 to the right legs, then the right legs move
more than left legs and so the Stiquito turns towards left.
Similarly, the Stiquito turns right if we switch the values of
left and right displacements.
  
   Since the displacements are used only for turning the
Stiquito I could not conceive a situation where we need to give
different displacements to the legs on the same side. So all the
displacements of all the legs on the same side are connected
together. 

\section { The LEG-CNTR signals}

  There are six LEG-CNTR signals one for each leg. The legs are
numbered from top to bottom, left to right from 0 to 5. So all
the left legs are even numbered and all the right ones are odd.
The current output of the ACTEL pins is not sufficient to drive
the legs effectively. So these LEG-CNTR signals are driven
through FETs to get sufficient current. The LEG-CNTR pin of will
be having a TRUE value when the leg corresponding to that pin is
supposed to be activated. So during the time when there is a
TRUE on the pin, current is passed through the Nitinol wire
connected to the leg corresponding to that pin. Due to the heat
generated by the current, Nitinol wire shrinks and thus pulling
the leg backwards. The connections between the pins and the leg
is shown below.

\section { The CLK-10-Hz pin }

   A clock is provided on the Chip for convenience. It generates
a clock of approxmately 10Hz. The clock is generated by a loop
of odd number of NOT gates. Then it is frequency divided by a
sequence of T-Flip Flops.

\section { The CLK-IN pin}

  This signal is to be connected to the Clock that is to control
the state machine of the controller. You can either connect it
to the CLK-10-Hz pin or you can give it an external clock.

\section{ An Example: The TRIPOD gait}

  In this section I demonstrate how a Tripod gait can be
obtained using this controller. Other gaits can be obtained in
similar way. 

  Tripod gait is the one in which the legs are divided into two
sets, each set containing two les of one side and middle leg
of the other side. For example, in our controller the the legs
0, 3, 4 will be one set and 1, 2, 5 will be the other. For the
purpose of illustration lets give a displacement of 1 for each
leg. The timing diagram is shown below.

\input{tripod.latex}

\section{Conclusion}

  A programmable digital controller was designed. It can be
programmed to have different gaits and different speeds. The
main idea of the project is to give researchers a simple and
convinient controller so that they can concentrate on the actual
gaits rather than worring about how it can be implemented on
Stiquito.

\end{document}

