Hello. I’m Drason from Team 135. We used to be a C++ team but we have recently transitioned to using Java. A huge error we’ve been getting is the “Robots Don’t Quit” error for unhandled exceptions.
We’ve literally followed the example program nearly exactly and it will crash every single time.
We have no idea what’s going on and would really prefer not to use Iterative for the rest of the season. Do any teams here have any idea as to what this might be?
Sorry, I don’t have the error log with me currently. I’ll try and post that tomorrow morning.
Here is a simple subsystem.
package org.usfirst.frc.team1135.robot.subsystems;
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
import edu.wpi.first.wpilibj.command.Subsystem;
import org.usfirst.frc.team1135.robot.commands.DriveJ;
import org.usfirst.frc.team1135.robot.Robot;
import org.usfirst.frc.team1135.robot.RobotMap;
import edu.wpi.first.wpilibj.RobotDrive;import com.ctre.CANTalon;
/**
*
*/
public class DriveTrain extends Subsystem {final static int NUMBER_DRIVETRAIN_MOTORS = 4;
static final int FRONT_LEFT = 0;
static final int REAR_LEFT = 1;
static final int FRONT_RIGHT = 2;
static final int REAR_RIGHT = 3;static CANTalon] drivetrainMotors = new CANTalon[NUMBER_DRIVETRAIN_MOTORS];
public RobotDrive chassis; public ADXRS450_Gyro gyro; public void InitializeDriveTrainMotors() {
drivetrainMotors[FRONT_LEFT] = new CANTalon(Robot.robotmap.FRONT_LEFT_TALON_ID);
drivetrainMotors[REAR_LEFT] = new CANTalon(Robot.robotmap.REAR_LEFT_TALON_ID);
drivetrainMotors[FRONT_RIGHT] = new CANTalon(Robot.robotmap.FRONT_RIGHT_TALON_ID);
drivetrainMotors[FRONT_LEFT] = new CANTalon(Robot.robotmap.FRONT_LEFT_TALON_ID);chassis = new RobotDrive(drivetrainMotors[FRONT_LEFT], drivetrainMotors[REAR_LEFT], drivetrainMotors[FRONT_RIGHT], drivetrainMotors[REAR_RIGHT]);
chassis.setSafetyEnabled(false);drivetrainMotors[FRONT_LEFT].setInverted(Robot.robotmap.LEFT_SIDE_INVERTED);
drivetrainMotors[FRONT_RIGHT].setInverted(Robot.robotmap.RIGHT_SIDE_INVERTED);
drivetrainMotors[REAR_LEFT].setInverted(Robot.robotmap.LEFT_SIDE_INVERTED);
drivetrainMotors[REAR_RIGHT].setInverted(Robot.robotmap.RIGHT_SIDE_INVERTED);
}public void TankDrive(double leftpower, double rightpower) {
chassis.tankDrive(leftpower, rightpower);
}public void initDefaultCommand() { setDefaultCommand(new DriveJ()); }
Here is a simple command.
package org.usfirst.frc.team1135.robot.commands;
import org.usfirst.frc.team1135.robot.Robot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.Command;/**
*
*/
public class DriveJ extends Command {public DriveJ() { // Use requires() here to declare subsystem dependencies // eg. requires(chassis); requires(Robot.drivetrain); } // Called just before this Command runs the first time protected void initialize() { Robot.drivetrain.InitializeDriveTrainMotors(); } // Called repeatedly when this Command is scheduled to run protected void execute() { Robot.drivetrain.TankDrive( Robot.oi.GetJoystickY(Robot.oi.LEFT_JOYSTICK), Robot.oi.GetJoystickY(Robot.oi.RIGHT_JOYSTICK)); } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return false; } // Called once after isFinished returns true protected void end() { Robot.drivetrain.chassis.tankDrive(0, 0); } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { }
}