View Single Post
  #5   Spotlight this post!  
Unread 14-02-2016, 13:21
3205patriots 3205patriots is offline
Registered User
FRC #3205
 
Join Date: Jan 2016
Location: Concord
Posts: 6
3205patriots is an unknown quantity at this point
Re: Robot class cannot be instantiated

I narrowed down the subsystem, but I don't understand what the issue could be within it:

package org.usfirst.frc.team3205.robot.subsystems;

import org.usfirst.frc.team3205.robot.RobotMap;
import org.usfirst.frc.team3205.robot.commands.armStart;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboar d;

/**
*
*/
public class Arm extends Subsystem {

// Put methods for controlling this subsystem
// here. Call these from Commands.
private DigitalInput armUpperLimit;
private DigitalInput armLowerLimit;
private SpeedController armMover;
private Encoder armEncoder;

public Arm(){
armUpperLimit = new DigitalInput(RobotMap.ARM_UPPER_LIMIT);
//armMiddleLimit = new DigitalInput(RobotMap.ARM_MIDDLE_LIMIT);
armLowerLimit = new DigitalInput(RobotMap.ARM_LOWER_LIMIT);
armMover = new Talon(RobotMap.ARM_MOTOR);
armEncoder = new Encoder(0,0, false, Encoder.EncodingType.k4X); //CHANGE THE ENCODER PORTS
}

public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
setDefaultCommand(new armStart());
}

public boolean isUpperLimitSet(){
return armUpperLimit.get();
}

// public boolean isMiddleLimitSet(){
// return armMiddleLimit.get();
// }

public boolean isLowerLimitSet(){
return armLowerLimit.get();
}

public void moveUp(){
armMover.set(RobotMap.ARM_SPEED);
}

public void moveDown(){
armMover.set(-RobotMap.ARM_SPEED);
}

public void stopMoving(){
armMover.set(0.0);
}

public void resetEncoder(){
armEncoder.reset();
}

public int getEncoder(){
return armEncoder.getRaw();
}

public void updateSmartDashboard(){
SmartDashboard.putNumber("Arm Encoder", getEncoder());
SmartDashboard.putBoolean("Arm Upper Limit", isUpperLimitSet());
//SmartDashboard.putBoolean("Arm Middle Limit", isMiddleLimitSet());
SmartDashboard.putBoolean("Arm Lower Limit", isLowerLimitSet());
SmartDashboard.putNumber("Distance", armEncoder.getDistance());

}
}
Reply With Quote