Getting Started

To get started using the Thrifty Nova you must use the ThriftyLib.

ThriftyLib is currently in beta, and only has support for Java at this time. Support for C++ and Python are coming soon.

API Install

To install the ThriftyLib beta, please paste the following link into the WPILIB VSCode:

https://docs.home.thethriftybot.com/ThriftyLib/Latest/ThriftyLib.json

Basic Device Usage

Before we break it down, here is a template to demonstrate simple ThriftyNova API usage.

public class MySubsystem extends Subsystem {
  private volatile MySubsystem instance; // singleton instance

  private ThriftyNova motor; // motor instance

  private MySubsystem() { // constructor initialization 
    motor = new ThriftyNova(7); // creates motor with CAN ID 7
  }

  public void periodic() { // update method called periodically 
    motor.setPercent(1); // set motor to output full forward 
  }

  public synchronized MySubsystem getInstance() {  // singleton getter
    return instance == null ? instance = new Instance() : instance;
}

Lets break that down...

Each Thrifty Nova is represented by an object. You must have create a ThriftyNova instance variable in your subsystem to hold this object.

private ThriftyNova motor;  

To actually instantiate the motor we call the ThrifyNova constructor. The constructor takes the CAN ID of the motor as a parameter.

motor = new ThriftyNova(7);

In order to command the motor we use various setters. To set the output percentage of the motor we use the setPercent method. The method takes an argument from -1.0, full reverse, to 1.0, full forward, where 0 is idle.

motor.setPercent(1.0);   // 100% forward
motor.setPercent(0.75);  // 75% forward
motor.setPercent(0);     // off
motor.setPercent(-0.25); // 25% reverse
motor.setPercent(-1.0);  // 100% reverse

Last updated