Navx in a Command-based Java program

We’re able to get the navx sensor to work fine in an iterative program, but we’re having trouble getting it to work in a command based program.

It compiles, but we’re getting the famous “Robots don’t quit” message with an error: -1029. We tried creating the object in the drivetrain subsystem, in robot.java, and in robotmap, to no avail.

Any help would be appreciated! Here’s our code

Thanks!!

try:

public static AHRS ahrs = new AHRS(SerialPort.Port.kMXP);

instead of:

static AHRS ahrs = new AHRS(SPI.Port.kMXP);

and add import:

import edu.wpi.first.wpilibj.SerialPort;

Thanks! We’ll give it a shot this morning.