I’ve been getting that error for the past week. I can’t seem to figure it out. Everything else works but the tank drive with the SparkMAX neo brushless motors. We have tried commenting out the other functions other then the drive.
Here is the code:
/----------------------------------------------------------------------------/
/* Copyright © 2017-2018 FIRST. All Rights Reserved. /
/ Open Source Software - may be modified and shared by FRC teams. The code /
/ must be accompanied by the FIRST BSD license file in the root directory of /
/ the project. /
/----------------------------------------------------------------------------*/
package frc.robot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.Spark;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.GenericHID.Hand;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import com.revrobotics.CANEncoder;
import edu.wpi.first.wpilibj.Watchdog;
public class Robot extends TimedRobot {
private DifferentialDrive m_myRobot;
//private SpeedControllerGroup m_leftDrive;
//private SpeedControllerGroup m_rightDrive;
private static final int leftDeviceID = 0;
private static final int rightDeviceID = 1;
private static final int leftDeviceID2 = 2;
private static final int rightDeviceID2 = 3;
private CANSparkMax m_leftMotor;
private CANSparkMax m_rightMotor;
private CANSparkMax m_leftMotor2;
private CANSparkMax m_rightMotor2;
private CANEncoder m_leftencoder;
private CANEncoder m_rightencoder;
private CANEncoder m_leftencoder2;
private CANEncoder m_rightencoder2;
private Spark intake;
private Spark intake2;
private XboxController gamePad;
private double leftAxisValue = 0;
private double rightAxisValue = 0;
private Spark lift;
private Watchdog help;
private DoubleSolenoid Claw;
@Override
public void robotInit() {
/**
- SPARK MAX controllers are intialized over CAN by constructing a CANSparkMax object
- The CAN ID, which can be configured using the SPARK MAX Client, is passed as the
- first parameter
- The motor type is passed as the second parameter. Motor type can either be:
- com.revrobotics.CANSparkMaxLowLevel.MotorType.kBrushless
- com.revrobotics.CANSparkMaxLowLevel.MotorType.kBrushed
- The example below initializes four brushless motors with CAN IDs 1 and 2. Change
- these parameters to match your setup
*/
m_leftMotor = new CANSparkMax(leftDeviceID, MotorType.kBrushless);
m_leftencoder = m_leftMotor.getEncoder();
m_rightMotor = new CANSparkMax(rightDeviceID, MotorType.kBrushless);
m_rightencoder = m_rightMotor.getEncoder();
m_leftMotor2 = new CANSparkMax(leftDeviceID2, MotorType.kBrushless);
m_leftencoder2 = m_leftMotor2.getEncoder();
m_rightMotor2 = new CANSparkMax(rightDeviceID2, MotorType.kBrushless);
m_rightencoder2 = m_rightMotor2.getEncoder();
//help= new Watchdog(0.02, callback);
SpeedControllerGroup m_left = new SpeedControllerGroup(m_leftMotor, m_leftMotor2);
SpeedControllerGroup m_right = new SpeedControllerGroup(m_rightMotor, m_rightMotor2);
m_myRobot = new DifferentialDrive(m_left, m_right);
intake = new Spark(4);
intake2 = new Spark(5);
lift= new Spark(6);
Claw= new DoubleSolenoid(1,2);
//Solenoid_break= new DoubleSolenoid(1,2);
// Initialize a single gamepad controller
gamePad = new XboxController(0);
leftAxisValue = gamePad.getRawAxis(1);
rightAxisValue = gamePad.getRawAxis(3);
}
@Override
public void teleopPeriodic() {
SmartDashboard.updateValues();
//encoders
SmartDashboard.putNumber(“Encoder Position”, m_leftencoder.getPosition());
SmartDashboard.putNumber(“Encoder Velocity”, m_leftencoder.getVelocity());
m_myRobot.setSafetyEnabled(false);
// Tank drive controlled with the left and right joysticks of the gamepad
leftAxisValue = gamePad.getRawAxis(1);
rightAxisValue = gamePad.getRawAxis(3);
m_myRobot.tankDrive(leftAxisValue, rightAxisValue);
// If the gamepad's right bumper is held, run the intake at 50% power
if (gamePad.getRawButton(6)) {
intake.set(0.5);
intake2.set(0.5);
} else if(gamePad.getRawButton(8)) {
intake.set(-0.5);
intake2.set(-0.5);
} else {
intake.set(0);
intake2.set(0);
}
//Elevator Lift
if(gamePad.getRawButton(5)) {
lift.set(0.5);
} else if(gamePad.getRawButton(7)) {
lift.set(-0.5);
}else {
lift.set(0);
}
//Breaking System According to the Binder
if(gamePad.getRawButton(2)) {
Claw.set(DoubleSolenoid.Value.kForward);
}else if (gamePad.getRawButton(3)) {
Claw.set(DoubleSolenoid.Value.kReverse);
}
}
}
Here is the Error:
********** Robot program starting **********
Unable to retrieve SPARK MAX firmware version please verify the deviceID field matches the configured CAN ID of the controller, and that the controller is connected to the CAN Bus.
Error at com.revrobotics.CANSparkMaxLowLevel.(CANSparkMaxLowLevel.java:253): Unable to retrieve SPARK MAX firmware version please verify the deviceID field matches the configured CAN ID of the controller, and that the controller is connected to the CAN Bus.
Default disabledInit() method… Overload me!
Default disabledPeriodic() method… Overload me!
Default robotPeriodic() method… Overload me!