DriveTrain Base Classes

Date: Oct 16, 2020
Proposed by: Evan Pratten <@ewpratten>
Implemented: Oct 22, 2020
Related Pull Requests: 1, 2, 3

Abstract

DriveTrain code barely changes between robots, yet is one of the largest, most complex systems. The solution is to move the majority of the DriveTrain code into Lib5K, and make use of inheritance for actual implementation. By moving DriveTrains into Lib5K, we also open up the possibility of the library interacting with the drivetrain more seamlessly including:

  • Cleaner simulation code
  • Pre-made autonomous driving commands
  • Extensive system unit tests

Implementation

This change is implemented by splitting our regular DriveTrain into a few abstract layers:

  • AbstractDriveTrain
    • Contains common code between Tank, Holonomic, and Swerve drivetrains
  • TankDriveTrain
    • Implements AbstractDriveTrain
    • Contains code specific to any type of tank-style drivetrain
  • DualPIDTankDriveTrain
    • Implements TankDriveTrain
    • Contains path-following code that requires PID controllers
  • OpenLoopTankDriveTrain
    • Implements TankDriveTrain
    • Only contains code for driving with a controller

Revisions

  1. Split TankDriveTrain into DualPIDTankDriveTrain, and OpenLoopTankDriveTrain
  2. Move Pure Pursuit control code inside of DualPIDTankDriveTrain
  3. Added path following unit tests to Lib5K