Skip to main content

Akitting The RobotContainer

Akit in RobotContainer

This is a general outline of what code should go where in your RobotContainer file.

Setting up your Subsystems

Before the constructor, create instances of all your subsystem classes, but DO NOT define them yet.

private final LinSlideSubsystem linSlide;
private final IntakeSubsystem intake;
private final Hopper hopper;
private final Climber climber;

It will give you an error than you haven't defined the variable because it is FINAL, but we will fix it later

 

Cases

Real

Here, you are actually defining what those subsystems are - for the REAL implementation.

linSlide = new LinSlideSubsystem(new LinSlideIOAlpha());
intake = new IntakeSubsystem(new IntakeIOAlpha());
hopper = new Hopper(new HopperIOAlpha());
climber = new Climber(new ClimberIOAlpha());

Sim

Here, you are defining the subsystems - for the SIM implementation.

If you have a different implementation of the hardware for sim (like we did on Orca), this is where you would put that - This is an example from Orca's code

drive = new Drive(
        new GyroIO() {},
        new ModuleIOSim(TunerConstants.FrontLeft),
        new ModuleIOSim(TunerConstants.FrontRight),
        new ModuleIOSim(TunerConstants.BackLeft),
        new ModuleIOSim(TunerConstants.BackRight));

score = new ScoreMechSubsystem(new ScoreMechIOSim());
elevator = new ElevatorSubsystem(new ElevatorIOTalonFX());

ramp = new RampSubsystem(new RampIOSim());

Default

Here, you are defining the subsystems with the empty IO class - for the DEFAULT implementation.

This is just to be sure we don't create a subsystem with no definition

linSlide = new LinSlideSubsystem(new LinSlideIO() {});
intake = new IntakeSubsystem(new IntakeIO() {});
hopper = new Hopper(new HopperIO() {});
climber = new Climber(new ClimberIO() {});

 

You can also define the subsystems outside of the switch case if they are supposed to be the same in all cases.