Skip to main content

Motors and Drivetrains

In this training module, we will explore the various motors and drivetrains commonly used in FRC robots. We will also write our first Java: reading a controller and driving a simulated differential drive robot through MWLib, the team's robot library, so we never program a motor directly.


Presentation​


Do this lesson in Scriptum

The exercises below are the Motors and Drivetrains lesson in Scriptum. Open the lesson, start the simulated robot and follow its README. Each step is checked with the Verify button.

New Java in this lesson: calling methods, double variables and the arithmetic operators + - * /.

Exercises​

Motors​

  • Read the controller sticks from your own code
    • Declare double variables and store the stick values in them
    • Remember that pushing a stick forward gives a negative number

Drivetrains​

  • Tank drive: the left stick drives the left side and the right stick drives the right side
    • Drive forward, backward, and spin in place
  • Arcade drive: the left stick drives forward and backward (up/down) and turns (left/right)
    • Use arithmetic: left = forward + turn and right = forward - turn
  • Bonus: add a speed limit, and try squaring the stick values for finer control

Hardware​

Hardware Interfacing​

Software​

Software Tools​

  • VSCode: Our primary Integrated Development Environment (IDE) for programming.
  • Driver Station: Software used to control and monitor the robot during competitions.