Quote:
Originally Posted by Guy997
Whenever we get the robots don't quit error, we're always assigning two sensors to one port, so maybe you're assigning two solenoids to one port on the PCM.
|
I was assigning the PCM to the default of 0. I thought I needed to since the PCM wasn't responding to any of my button clicks, but it looks like I just don't know how to properly assign button clicks with Command Based programming.
So when I remove the PCM assignment from the DoubleSolenoid object that error goes away. But then I re-add the modifications you mentioned before and I still get this error:
Code:
ERROR Unhandled exception: java.lang.ExceptionInInitializerError at [org.usfirst.frc.team869.robot.Robot.robotInit(Robot.java:42), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:241)]
OI Looks like this:
Code:
package org.usfirst.frc.team869.robot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.buttons.Button;
import org.usfirst.frc.team869.robot.commands.shiftDriveSpeed;
import org.usfirst.frc.team869.robot.commands.*;
//import edu.wpi.first.wpilibj.vision.USBCamera;
import edu.wpi.first.wpilibj.CameraServer;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
*/
public class OI {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);
public static Joystick driverController = new Joystick(RobotMap.driverControllerID);
public static Joystick operatorController = new Joystick(RobotMap.operatorControllerID);
public static JoystickButton joystickButtonA = new JoystickButton(driverController, RobotMap.logitechControllerAbutton);
static shiftDriveSpeed shiftHigh = new shiftDriveSpeed();
public OI() {
joystickButtonA.whenPressed(shiftHigh);
//new JoystickButton(driverController, RobotMap.logitechControllerYbutton).whenPressed(new driveShift(RobotMap.logitechControllerYbutton));
}
//public static USBCamera microSoftCam = new USBCamera("cam0");
/*shiftHighSpeed.whenPressed(new driveShift());
shiftHighSpeed.whenPressed(new driveShift(RobotMap.driveHighSpeed));
shiftHighTorque.whenPressed(new driveShift(RobotMap.driveHighTorque));*/
public static double getLeftDriveSpeed(){
return driverController.getRawAxis(RobotMap.logitechControllerLYAxis);
}
public static double getRightDriveSpeed(){
return driverController.getRawAxis(RobotMap.logitechControllerRYAxis);
}
// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.
//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:
// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());
// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
}