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:
- AdvantageKit (mandatory for all versions) β Installation Guide
- CTRE controllers β Phoenix 6
- REV controllers β REVLib
Adding BasicMotor
-
In VS Code, open the command palette (
Ctrl+Shift+P
orCmd+Shift+P
) β
WPILib: Manage Vendor Libraries β Install new library (online)
-
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
- Core (advanced users only β minimal API, requires custom setup):
-
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 moduletank_example
β A classic tank drive robot with two sides powered by BasicMotorflywheel_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.