Configure Controller Settings

There are many options to configuring on the Thrifty Nova. These can be configured in the constructor using a variety of configuration setters. These setters can be chained together to make for a very clean configuration style. The following is an example of this configuration strategy.

motor = new ThriftyNova(7)   // create with CAN ID 7
  .setInverted(true)         // reverse the motor
  .setBrakeMode(true);       // set brake mode

Configuration Error Handling

After you are done setting your configurations you can check for any errors reported from the motor controllers. The motor controller will provide a list of errors encountered while configuring values. Errors are represented by a status enum. The following examples show how to access these error codes, check for certain error codes, and clear the error list.

In this example we get a list of all errors, then iterate through the errors and printing them out.

List<Error> errors = motor.getErrors();
for (Error err : errors) {
  System.out.println(err.toString());
}

You can also check if a given error is present. Here we are checking if configuring brake mode has failed.

if (motor.hasError(Errors.SET_BRake_MODE)) {
  System.out.println("Setting brake mode has failed!");
}

You can also clear this error list. It will repopulate if more errors are encountered

motor.clearErrors();

Last updated