We are having an issue with our drive motors, where it is giving us the error, "DifferentialDrive… Output not updated often enough. edu.wpi.first.wpilibj.MotorSafety.check(MotorSafety.java:101)
here is our Drivetrain code:
package frc.robot.subsystems;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import frc.robot.RobotMap;
import frc.robot.commands.JoystickDrive;
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;
import edu.wpi.first.wpilibj.Joystick;
/**
- Add your docs here.
*/
public class Drivetrain extends Subsystem {
double Kp = .05;
WPI_VictorSPX rightDriveMotor = new WPI_VictorSPX(6);
WPI_VictorSPX rightFollower = new WPI_VictorSPX(20);
WPI_VictorSPX rightMotor = new WPI_VictorSPX(7);
WPI_VictorSPX leftDriveMotor = new WPI_VictorSPX(2);
WPI_VictorSPX leftFollower = new WPI_VictorSPX(10);
WPI_VictorSPX leftMotor = new WPI_VictorSPX(5);
DifferentialDrive robotDrive = new DifferentialDrive(leftDriveMotor, rightDriveMotor);
public Drivetrain() {
}
public void drive(double move, double turn) {
robotDrive.arcadeDrive(move, turn, false);
}
public void joystickDrive (Joystick move) {
robotDrive.arcadeDrive(move.getY(), -move.getZ(), true);
}
public void MotorSafetyHelper() {
rightDriveMotor.setSafetyEnabled(false);
rightMotor.setSafetyEnabled(false);
leftDriveMotor.setSafetyEnabled(false);
leftMotor.setSafetyEnabled(false);
}
// Put methods for controlling this subsystem
// here. Call these from Commands.
@Override
public void initDefaultCommand() {
setDefaultCommand(new JoystickDrive());
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}
}
and out JoystickDrive command
package frc.robot.commands;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.Robot;
public class JoystickDrive extends Command {
public JoystickDrive() {
requires(Robot.drivetrain);
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
Robot.drivetrain.joystickDrive(Robot.oi.joystickDrive);
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
I know that the MotorSafety is a part of the RobotDrive class, is there a way I can edit the class itself and set the Safety to disabled? Can I make a custom command and extend RobotDrive. If so, how?
Thanks