Skip to main content

Global Standards

Global Dependencies

  • WPIlib is the framework that teams use to write code for FRC robots.
  • AdvantageKit is a logging framework created by FRC team 6328 which has been released for public use.
  • Gversion is an AdvantageKit dependency that creates the BuildConstants.java file which is important for log replay.
  • Lombok is an annotation based java library that helps reduce boilerplate code by automatically generating getters, setters, etc.
  • Spotless is a code formatter that automatically formats the entire project when compiled.
  • GomeiLib is a custom library developed by FRC 19 in an attempt to reduce the amount of rewritten code from year to year.

These dependencies should be present in the build.gradle file in each robot project.

Data

Naming Conventions

  • Classes and Enumerations should follow PascalCase.
  • Variables should follow camelCase.
  • Constants should follow SNAKE_CASE.
  • Variables should have any relevant unit in the name, for example intakeTemperatureCelcius.

Object Instantiation

Objects should be declared and instantiated separately. Static variables should be instantiated in static blocks, while all other variables should be instantiated in a constructor, regardless of reliance on parameters:

...

public class AClass {

public static int variable1;
private int variable2;
private int variable3;

static {
variable1 = 42;
}

public AClass(variable3) {
this.variable2 = 17;
this.variable3 = variable3;
}

...
}

Modifiers

Member variables should always be private with @Getter/@Setter annotations if they require getters and/or setters. Static variables should always come before non-static variables

Constants should always have the public static final modifiers.

Default Units

190 uses these default units for all robot code:

MeasurementUnit
Linear PositionMeters
Linear VelocityMeters per Second
Linear AccelerationMeters per Second Squared
Angluar PositionRadians
Angular VelocityRadians per Second
Angular AccelerationRadians per Second Squared
MassKilograms
Moment of InertiaKilogram Meters Squared
ForceNetwons
Torque/MomentNewton Meters
VoltageVolts
CurrentAmps
TemperatureCelcius