PID vs. Neural Network Control - MATLAB lab files
ARAI Lab (Autonomous Robots and AI Lab), University of Hartford

Requirements: MATLAB R2019b or newer. No toolboxes needed.

Start here: open this folder in MATLAB, then run the lab scripts in order.
  lab1_pid_arm.m        Part 1: tune a PID on the robot arm joint
  lab2_train_nn.m       Part 2: train a neural network by trial and error
  lab3_stress_tests.m   Part 3: stress tests (set robotKey to arm, segway or twolink)
  lab4_segway.m         Part 4: self-balancing robot
  lab5_manipulator.m    Part 5 (optional): two-link manipulator
  lab6_drone.m          Part 6: quadrotor drone

Building blocks:
  arai_params.m         robot settings (arm, segway, twolink, drone)
  default_conditions.m  stress-test switches (payload, friction, push, noise)
  simulate_robot.m      equations of motion for all three robots
  controller_step.m     PID and network control laws
  make_pid.m, make_nn.m controller constructors
  nn_features.m         what the network sees
  nn_forward.m          the network itself
  train_es.m            evolution-strategies training
  episode_cost.m        training score
  random_targets.m      random targets used in training
  compute_metrics.m     overshoot, settling time, final error, RMS, motor jitter
  print_metrics.m       prints a scoreboard
  plot_compare.m        plots runs against the target
  animate_robot.m       plays back a run
  pretrained_weights.m  the networks used in the online playground

The same robots and controllers run in the online playground, so results match
except for runs with a noisy sensor, which use a different random number generator.
