Auto only doing one side.

So I have confirmed that my booleans have been changing and have been getting the game data. The problem I am having is that the code always only goes to the right.

I believe you are missing the “==” in your if statements.

if(Robot.variables.right =**=** true)

Don’t do equality comparison with booleans. You made a typo and used a single equal sign for assignment instead of double equals for comparison. Your code is essentially:

if (true) {
  // right side auto
} else if (true) {
  // left side auto

These types of bugs are usually avoided by not doing boolean comparisons, since

if(Robot.variables.right == true)

is equivalent to simply

if (Robot.variables.right)

Another common strategy is to hide variables behind accessor (“getter”) methods; replacing the field access with a method call would have resulted in a compilation error with a single equals sign:

if (Robot.variables.isRightSide() = true) // compilation error

I’m surprised your IDE didn’t catch this.

Tried that, crashed. I can try again though.

You are doing that logic in the CenterAuto constructor. That is run before any of the variables are set. The easiest way to fix this is to change your SendableChooser to store a reference to the constructor of the auto mode and then construct the auto mode in autonomousInit(). Like this:

Member variables

Command autonomousCommand;
SendableChooser<Supplier<Command>> autonomousModes;

In robot init

autonomousModes = new SendableChooser<>();
autonomousModes.addObject("Right Auto", RightAuto::new);
autonomousModes.addObject("Center Auto", CenterAuto::new);
autonomousModes.addObject("Left Auto", LeftAuto::new);
autonomousModes.addObject("Drive Straight", () -> new driveForward(4));
autonomousModes.addObject("Do Nothing", stopCom::new);

In auto init

// ----
// Game data logic here
// ----

autonomousCommand = autonomousModes.getSelected().get();
if (autonomousCommand != null) autonomousCommand.start();

In teleop init

if (autonomousCommand != null) autonomousCommand.cancel();