Spark Max Not Receiving Input

Hi all,

For some reason, the relatively simple code I wrote for our bot is only driving the left side of our drivetrain. Is there any reason why the CANSparkMax objects are not being initialized properly? The same issue pops up for our shooter Spark Maxes.

 public DriveTrain() {

    m_frontLeft = new CANSparkMax(PortConstants.FRONT_LEFT_DRIVE, MotorType.kBrushless);
    m_middleLeft = new CANSparkMax(PortConstants.MIDDLE_LEFT_DRIVE, MotorType.kBrushless);
    m_backLeft = new CANSparkMax(PortConstants.BACK_LEFT_DRIVE, MotorType.kBrushless);    

    m_frontRight = new CANSparkMax(PortConstants.FRONT_RIGHT_DRIVE, MotorType.kBrushless);
    m_middleRight = new CANSparkMax(PortConstants.MIDDLE_RIGHT_DRIVE, MotorType.kBrushless);
    m_backRight = new CANSparkMax(PortConstants.BACK_RIGHT_DRIVE, MotorType.kBrushless);   


    m_mainDrive = new DifferentialDrive(m_backLeft, m_backRight);

  public void tankDrive(final double x, final double z, final double correction){
    m_mainDrive.tankDrive(-x+z, -x-z); 
public class RobotContainer {

    public final DriveTrain m_driveTrain = DriveTrain.getInstance();

    public RobotContainer() {
      m_driveTrain.setDefaultCommand(new RunCommand(
        () -> m_driveTrain.tankDrive((m_mainStick.getRawAxis(1)) , (m_mainStick.getRawAxis(4)), 0.0),

What is the actual controller you are using? Most likely axis 4 is not what you think it is.

Agree… log your axis values and check what is passed in…

Also, make sure your motors aren’t fighting each other.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.