Simulation single file

Added a "set" method for the Terrain class + caught minor bugs.

Working on the required parts of a Simulation object as a whole before
taking it apart into smaller files.
Right now the simulation is running including the compass biped events
(albeit not really since nothing extends the leg after it's retracted).
Controller

Worked on adding pulses to the new controller pbject
Controller

Worked on handling events
Controller event handling

Corrected small bugs in compass biped.
Made sure "Switch" property is kept vertical when adding new pulses to
the controller.
Corrected minor bus in Controller.
Implemented the new torque output calculation with OutM.
Moved the leg extension event from last to 2nd.
Added a method to handle external events (specifically, ground impact) -
STILL NEEDS TO BE CODED
On Test.m now each event calls its class event handler and also event
interaction methods where appropriate.
Compass Biped

Caught a bug in compass biped that was calculating impacts incorrectly.
Robot is now able to walk but controller still needs fine tuning.
Also added a plot to the simulation's render to display the controller's
output.
Simulation class

** TO-DO in Controller **
+ Re-write adaptation function
+ Work on ext event handle
Just added a simple "GetPeriod" function

Worked on splitting Test.m into appropriate class methods for the
Simulation class. Test.m was reduced to only 30 lines :)

Simulation.m
Added and removed properties according to the ones used in Test.m
Removed old methods and added the SetTime, Derivative, Events and
StopButtonCb methods.
Deleted most of the old code but left some of it untouched to go over it
later.
** TO DO in Simulation **
Go over old code, mostly for simulation progress tracking: limit cycle
convergence and such

Sim.Init
Deals with initialization of simulation properties after all the
parameters have been set in Test.m. Additional initialization can be
performed afterwards.

Sim.Render
Deals with rendering the simulation graphics: creating the figure,
initializing handles and then updating it

Sim.Run
Runs the simulation and handles events
Controller feedback

Got rid of GetTorques function in CompassBiped

Added code for performing phase reset when the leg impacts the ground
(set ExtP_reset to desired reset phase). Also added code for adding an
"impulsive torque" to the legs upon impact, i.e., causing a sudden
change in angular velocities (either a constant change or bring them to
specific values)

Changed the 0 value for Switch and OutM so the output torque has the
appropriate dimension for CompassBiped when the controller uses no
pulses.
** TO DO ** figure out how to deal with a single pulse to one joint

Also re-coded the old adaptation function

Finally, stopped trying to render torques when no pulses exist.
AlexSim

Worked on simulating Alex's results. Simulator works nicely after
synchronizing the controller (which only takes care of leg retraction
and extension) by doing a phase reset.

Corrected a bug on phase resetting in the controller.
Also caught a bug in Run.m when it reaches the end of tspan.
Simulation statistics

Added several statistics about the model+controller's performance.
Now sim.Run outputs a struct that includes several statistics about the
simulation performance including: X, T, Torques, the stance foot's
position, steps taken, end result, min/max slope and convergence.

In Simulation.m, removed old commented code after re-coding it for the
new sim.

Also added additional conditions for stopping the simulation when the
robot falls, takes a very very small step or hits the ground while the
leg is still shortened.
Simulation Poincare

Worked on calculating the numerical poincare map.

If EndCond = 2, after convergence the IC and period are stored inside
the simulation object. Then sim.Poincare() can be called.
Alternatively, IClimCyc and Period can be set externally when the limit
cycle and period are already known.

The EndCond = 1 type of simulation was implemented. Here the robot needs
to walk a number on steps on the final slope, i.e., after the
inclination stops changing, if that's the case.

SimOut was merged with sim.End to create sim.Out, a single variable that
holds all the statistics.
Genetic algorithm

Just beginning to copy old files from the current algorithm
Simulation bugs + period

Corrected a bug where the info in sim was corrupted by PMsim. Now PMsim
is a shallow copy of sim (deriving from matlab.mixin.Copyable class).

Added a simple code to calculate the gait's period.
Added TestSim (a copy of AlexSim), to stop bugging Alex with my tests :)
Small bug

Now that sim.Period includes the number of steps for a complete cycle
and the step time, I used sim.Period(1) instead of sim.Period in
Poincare.m

NOTE: The period calculated is for the last step only. If the gait is
multi-period, a new simulation should be ran to get the IC at each step
and the period of each step in a full cycle.
Caught a bug for the EndCond = 1 sim type

When calculating the poincare map of higher periods it would keep
walking because Steps2Slope kept getting updated after each step.
Also "merged" Test.m into TestSim.m
Pareto method

Added old files of the Genetic Algorithm and worked on cleaning the code
of Pareto.m
Merge changes of master into Genetic Algorithm branch

Merge wouldn't work... will have to commit
Event triggered pulses

Worked on adding externally triggered pulses to Controller. Still has to
be checked.
Controller event triggered pulses

Squashed some bugs when setting up the controller.
Also tested the event triggered pulses.
Changed to ext. triggered controller
Merge remote-tracking branch 'origin/master' into GeneticAlgorithm