Skip to main content

Ironclad Best practices

Naming Conventions

  1. any code that is not auto generated should be written using camelCase.
  2. name things what they are.

Subsystem and Command Rules

  1. All hardware associated with a subsystem should be defined and initiated within the subsystem
  2. All hardware objects should be private (and final if applicable)
  3. Do not expose any hardware inside of public getters
public Cancoder getCancoder() {
return Cancoder
}

instead return information needed from the hardware

public Cancoder getCancoderPosition() {
return Cancoder.getPosition().getValueAsDouble();
}
  1. All commands that are not composite (command groups) should be written as inline commands inside the subsystem
  2. Do not expose any method that allows hardware such as motors to be controlled unless it is in a command. A stop() method is the only exception to this rule
public void moveMotor() { //this is bad
...
}

public Command moveMotor() { //this is good
...
}
  1. Composit commands should be written inside of RobotContainer or another command factory inside RobotContainer
  2. Commands such as goToPosition should NOT have an end condition by default. This allows the user to set and end condition for different use cases i.e. auto vs teleop
  3. Dont be afraid to run motors fast. speed is key
  4. Dont use excessive timeouts. Theres no need to run the motor for 5 seconds after a gamepiece is scored.
  5. Log everything. Use annotation logging and write custom loggers 3rd party classes.
  6. Expose Triggers for things that happen within your subsystem like sensors being tripped or motors reaching position.