Home - captainsoccer/BasicMotor GitHub Wiki

πŸ› οΈ BasicMotor

⚠️ This wiki is still in progress. Information may be incomplete or subject to change.

Welcome to BasicMotor – a lightweight, beginner-friendly Java library for working with FRC motor controllers under a single, consistent interface.
Whether you’re experimenting on a test bot or simplifying your drivetrain code, BasicMotor helps you control brushed and brushless motors with clean, readable syntax and minimal setup.


What is BasicMotor?

BasicMotor is designed to reduce the complexity of motor control in FRC robot code.
Instead of juggling multiple vendor APIs, it provides one unified, intuitive interface that works across different motor controllers and use cases.

  • Supports both brushed and brushless controllers
  • Multiple vendor library versions – choose the package that matches your setup
  • AdvantageKit (mandatory) integration for automatic logging
  • Simulation support for testing without hardware

It’s great for prototyping, demos, training, test bots, and production robots where readability and maintainability matter.


Why Use BasicMotor?

  • βœ… Clean, consistent API that’s easy to learn and teach
  • βœ… Swap between CTRE and REV controllers with minimal code changes
  • βœ… Works with brushed or brushless motors
  • βœ… Logs key data automatically (AdvantageKit)
  • βœ… Multithreaded updates for reliable performance
  • βœ… Includes simulation motors for off-robot testing

Supported Motor Controllers

BasicMotor currently supports the following motor controllers:

  • CTRE (Phoenix 6 required)

    • Talon FX
    • Talon SRX
    • Victor SPX
  • REV Robotics (REVLib required)

    • Spark MAX (brushed + brushless)
    • Spark Flex (brushed + brushless)

AdvantageKit is required for every version of BasicMotor.
Additional controllers may be added in future versions.
Want to add your own? See the Implementing Your Own Controller guide.


Installation

BasicMotor is distributed as modular vendor libraries so you can pick only what you need.

Dependencies

You must install AdvantageKit (mandatory) plus the vendor library corresponding to the brand of controllers you’re using:

Adding BasicMotor

  1. In VS Code, open the command palette (Ctrl+Shift+P or Cmd+Shift+P) β†’
    WPILib: Manage Vendor Libraries β†’ Install new library (online)

  2. Paste one of the following URLs, depending on the module you want:

    • Core (advanced users only – minimal API, requires custom setup):
      https://captainsoccer.github.io/BasicMotor/BasicMotor-Core.json
      
    • REV controllers only:
      https://captainsoccer.github.io/BasicMotor/BasicMotor-Rev.json
      
    • CTRE controllers only:
      https://captainsoccer.github.io/BasicMotor/BasicMotor-Ctre-Full.json
      
    • Full package (all supported controllers):
      https://captainsoccer.github.io/BasicMotor/BasicMotor-Full.json
      
  3. Add the following to your Robot.java to keep motors updated:

    @Override
    public void robotPeriodic() {
      CommandScheduler.getInstance().run();
      MotorManager.getInstance().periodic(); // must run AFTER CommandScheduler
    }
    

The motor manger should be run after the command scheduler, not before.

Example Projects

The following example projects demonstrate how to use BasicMotor in real robot subsystems:

  • swerve_example – Implements a swerve drive using BasicMotor for each module
  • tank_example – A classic tank drive robot with two sides powered by BasicMotor
  • flywheel_example – A flywheel shooter controlled and logged via BasicMotor

Visit the Examples page for full code and setup instructions.

Next Steps

To learn how to create and configure motors in your robot code, head over to the Usage page for setup instructions, code examples, and best practices.