From: David Date: Fri, 20 Nov 2015 16:07:34 +0000 (-0800) Subject: fix conflicts X-Git-Url: http://challenge-bot.com/repos/?p=3501%2F2015-FRC-Spark;a=commitdiff_plain;h=eb9e6bd8da48f0833680f6e6705542bacacd4dd8 fix conflicts --- eb9e6bd8da48f0833680f6e6705542bacacd4dd8 diff --cc .gitignore index 98a068b,227a010..7a58fe3 --- a/.gitignore +++ b/.gitignore @@@ -1,7 -1,3 +1,10 @@@ ++<<<<<<< HEAD +# -*- mode: gitignore; -*- +*~ +\#*\# +.\#* ++======= ++>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e *.pydevproject .metadata .gradle @@@ -43,4 -39,4 +46,8 @@@ local.propertie .texlipse # STS (Spring Tool Suite) -.springBeans ++<<<<<<< HEAD +.springBeans ++======= ++.springBeans ++>>>>>>> fb376f02820fc8dd8404759e2b45fa582969dc3e diff --cc src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java index 0000000,6bebe54..9c391da mode 000000,100644..100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/robot/OI.java @@@ -1,0 -1,31 +1,31 @@@ + package org.usfirst.frc3501.RiceCatRobot.robot; + + import org.usfirst.frc3501.RiceCatRobot.commands.ToggleClaw; + import org.usfirst.frc3501.RiceCatRobot.commands.ToggleCompressor; + + import edu.wpi.first.wpilibj.Joystick; + import edu.wpi.first.wpilibj.buttons.JoystickButton; + + public class OI { - public static Joystick leftJoystick; - public static Joystick rightJoystick; - public static JoystickButton trigger; - public static JoystickButton toggleCompressor; - public static JoystickButton toggleClaw; ++ public static Joystick leftJoystick; ++ public static Joystick rightJoystick; ++ public static JoystickButton trigger; ++ public static JoystickButton toggleCompressor; ++ public static JoystickButton toggleClaw; + - public OI() { - System.out.println("OI is open"); - leftJoystick = new Joystick(RobotMap.LEFT_STICK_PORT); - rightJoystick = new Joystick(RobotMap.RIGHT_STICK_PORT); ++ public OI() { ++ System.out.println("OI is open"); ++ leftJoystick = new Joystick(RobotMap.LEFT_STICK_PORT); ++ rightJoystick = new Joystick(RobotMap.RIGHT_STICK_PORT); + - trigger = new JoystickButton(rightJoystick, RobotMap.TRIGGER_PORT); ++ trigger = new JoystickButton(rightJoystick, RobotMap.TRIGGER_PORT); + - toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT); - toggleClaw.whenPressed(new ToggleClaw()); ++ toggleClaw = new JoystickButton(rightJoystick, RobotMap.TOGGLE_PORT); ++ toggleClaw.whenPressed(new ToggleClaw()); + - toggleCompressor = new JoystickButton(rightJoystick, - RobotMap.TOGGLE_COMPRESSOR_PORT); - toggleCompressor.whenPressed(new ToggleCompressor()); ++ toggleCompressor = new JoystickButton(rightJoystick, ++ RobotMap.TOGGLE_COMPRESSOR_PORT); ++ toggleCompressor.whenPressed(new ToggleCompressor()); + - } ++ } + } diff --cc src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java index 0000000,1191d0e..e83f800 mode 000000,100644..100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/robot/Robot.java @@@ -1,0 -1,69 +1,69 @@@ + package org.usfirst.frc3501.RiceCatRobot.robot; + + import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm; + import org.usfirst.frc3501.RiceCatRobot.subsystems.Claw; + import org.usfirst.frc3501.RiceCatRobot.subsystems.DriveTrain; + + import edu.wpi.first.wpilibj.Compressor; + import edu.wpi.first.wpilibj.IterativeRobot; + import edu.wpi.first.wpilibj.Timer; + import edu.wpi.first.wpilibj.command.Scheduler; + + public class Robot extends IterativeRobot { - static Timer timer; - public static OI oi; - public static DriveTrain driveTrain; - public static Arm arm; - public static Claw claw; - public static Compressor compressor; ++ static Timer timer; ++ public static OI oi; ++ public static DriveTrain driveTrain; ++ public static Arm arm; ++ public static Claw claw; ++ public static Compressor compressor; + - public void robotInit() { - RobotMap.init(); - driveTrain = new DriveTrain(); - arm = new Arm(); - claw = new Claw(); - oi = new OI(); - compressor = new Compressor(RobotMap.COMPRESSOR_PORT); - } ++ public void robotInit() { ++ RobotMap.init(); ++ driveTrain = new DriveTrain(); ++ arm = new Arm(); ++ claw = new Claw(); ++ oi = new OI(); ++ compressor = new Compressor(RobotMap.COMPRESSOR_PORT); ++ } + - public void autonomousInit() { - } ++ public void autonomousInit() { ++ } + - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - } ++ public void autonomousPeriodic() { ++ Scheduler.getInstance().run(); ++ } + - public void teleopInit() { - System.out.println("running teleopInit"); - } ++ public void teleopInit() { ++ System.out.println("running teleopInit"); ++ } + - public void teleopPeriodic() { - Scheduler.getInstance().run(); ++ public void teleopPeriodic() { ++ Scheduler.getInstance().run(); + - } ++ } + - public void operate() { - driveTrain.arcadeDrive(OI.rightJoystick.getY(), - OI.rightJoystick.getTwist()); - claw.doTriggerAction(); - if (OI.leftJoystick.getRawButton(8)) { - arm.setArmSpeeds(0.3); - } else if (OI.leftJoystick.getRawButton(9)) { - arm.setArmSpeeds(-0.3); - } else if (OI.leftJoystick.getRawButton(6)) { - arm.setLeft(0.3); - } else if (OI.leftJoystick.getRawButton(7)) { - arm.setLeft(-0.3); - } else if (OI.leftJoystick.getRawButton(11)) { - arm.setRight(-0.3); - } else if (OI.leftJoystick.getRawButton(10)) { - arm.setRight(0.3); - } - if (Math.abs(OI.leftJoystick.getY()) < 0.05) { - arm.setArmSpeeds(0); ++ public void operate() { ++ driveTrain ++ .arcadeDrive(OI.rightJoystick.getY(), OI.rightJoystick.getTwist()); ++ claw.doTriggerAction(); ++ if (OI.leftJoystick.getRawButton(8)) { ++ arm.setArmSpeeds(0.3); ++ } else if (OI.leftJoystick.getRawButton(9)) { ++ arm.setArmSpeeds(-0.3); ++ } else if (OI.leftJoystick.getRawButton(6)) { ++ arm.setLeft(0.3); ++ } else if (OI.leftJoystick.getRawButton(7)) { ++ arm.setLeft(-0.3); ++ } else if (OI.leftJoystick.getRawButton(11)) { ++ arm.setRight(-0.3); ++ } else if (OI.leftJoystick.getRawButton(10)) { ++ arm.setRight(0.3); ++ } ++ if (Math.abs(OI.leftJoystick.getY()) < 0.05) { ++ arm.setArmSpeeds(0); + - } else { - arm.fineTuneControl(OI.leftJoystick.getY()); - } ++ } else { ++ arm.fineTuneControl(OI.leftJoystick.getY()); + } ++ } + } diff --cc src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java index 0000000,95604c3..90f10ec mode 000000,100644..100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/robot/RobotMap.java @@@ -1,0 -1,41 +1,42 @@@ + package org.usfirst.frc3501.RiceCatRobot.robot; + + import edu.wpi.first.wpilibj.DoubleSolenoid; + import edu.wpi.first.wpilibj.DoubleSolenoid.Value; + + /** + * The RobotMap is a mapping from the ports sensors and actuators are wired into + * to a variable name. This provides flexibility changing wiring, makes checking + * the wiring easier and significantly reduces the number of magic numbers + * floating around. + */ + public class RobotMap { - public final static int LEFT_STICK_PORT = 0, RIGHT_STICK_PORT = 1; - public final static int TRIGGER_PORT = 1, TOGGLE_PORT = 2, - TOGGLE_COMPRESSOR_PORT = 11; - public static final int DRIVE_FRONT_LEFT = 4, DRIVE_FRONT_RIGHT = 5, - DRIVE_REAR_LEFT = 3, DRIVE_REAR_RIGHT = 6; - public static final int DRIVE_LEFT_A = 3, DRIVE_LEFT_B = 4, - DRIVE_RIGHT_A = 2, DRIVE_RIGHT_B = 1; ++ public final static int LEFT_STICK_PORT = 0, RIGHT_STICK_PORT = 1; ++ public final static int TRIGGER_PORT = 1, TOGGLE_PORT = 2, ++ TOGGLE_COMPRESSOR_PORT = 11; ++ public static final int DRIVE_FRONT_LEFT = 4, DRIVE_FRONT_RIGHT = 5, ++ DRIVE_REAR_LEFT = 3, DRIVE_REAR_RIGHT = 6; ++ public static final int DRIVE_LEFT_A = 3, DRIVE_LEFT_B = 4, ++ DRIVE_RIGHT_A = 2, DRIVE_RIGHT_B = 1; + - public static final double DISTANCE_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) / 256; ++ public static final double DISTANCE_PER_PULSE = ++ ((3.66 / 5.14) * 6 * Math.PI) / 256; + - public static final int ARM_LEFT = 2, ARM_RIGHT = 7; - public static final double ARM_HIGH_SPEED = 0.5, ARM_LOW_SPEED = 0.5; ++ public static final int ARM_LEFT = 2, ARM_RIGHT = 7; ++ public static final double ARM_HIGH_SPEED = 0.5, ARM_LOW_SPEED = 0.5; + - // Claw - public static final int SOLENOID_FORWARD = 0, SOLENOID_REVERSE = 1, - MODULE_NUMBER = 0; - public final static Value open = DoubleSolenoid.Value.kForward, - close = DoubleSolenoid.Value.kReverse; - public static double DRIVE_DEAD_ZONE = 0.25; - // Compressor - public static final int COMPRESSOR_PORT = 0; ++ // Claw ++ public static final int SOLENOID_FORWARD = 0, SOLENOID_REVERSE = 1, ++ MODULE_NUMBER = 0; ++ public final static Value open = DoubleSolenoid.Value.kForward, ++ close = DoubleSolenoid.Value.kReverse; ++ public static double DRIVE_DEAD_ZONE = 0.25; ++ // Compressor ++ public static final int COMPRESSOR_PORT = 0; + - public static void init() { - } ++ public static void init() { ++ } + - public static enum Direction { - LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD; - } ++ public static enum Direction { ++ LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD; ++ } + } diff --cc src/org/usfirst/frc3501/RiceCatRobot/subsystems/DriveTrain.java index 4117c6a,dda70f8..c02dea9 --- a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/DriveTrain.java @@@ -8,104 -8,108 +8,108 @@@ import edu.wpi.first.wpilibj.CounterBas import edu.wpi.first.wpilibj.command.Subsystem; public class DriveTrain extends Subsystem { - private CANJaguar frontLeft, frontRight, rearLeft, rearRight; - private Encoder leftEncoder, rightEncoder; + private CANJaguar frontLeft, frontRight, rearLeft, rearRight; + private Encoder leftEncoder, rightEncoder; - public DriveTrain() { - frontLeft = new CANJaguar(RobotMap.DRIVE_FRONT_LEFT); - frontRight = new CANJaguar(RobotMap.DRIVE_FRONT_RIGHT); - rearLeft = new CANJaguar(RobotMap.DRIVE_REAR_LEFT); - rearRight = new CANJaguar(RobotMap.DRIVE_REAR_RIGHT); - leftEncoder = new Encoder(RobotMap.DRIVE_LEFT_A, RobotMap.DRIVE_LEFT_B, - false, EncodingType.k4X); - rightEncoder = new Encoder(RobotMap.DRIVE_RIGHT_A, - RobotMap.DRIVE_RIGHT_B, false, EncodingType.k4X); - leftEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE); - rightEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE); - } + public DriveTrain() { + frontLeft = new CANJaguar(RobotMap.DRIVE_FRONT_LEFT); + frontRight = new CANJaguar(RobotMap.DRIVE_FRONT_RIGHT); + rearLeft = new CANJaguar(RobotMap.DRIVE_REAR_LEFT); + rearRight = new CANJaguar(RobotMap.DRIVE_REAR_RIGHT); + leftEncoder = new Encoder(RobotMap.DRIVE_LEFT_A, RobotMap.DRIVE_LEFT_B, + false, EncodingType.k4X); + rightEncoder = new Encoder(RobotMap.DRIVE_RIGHT_A, RobotMap.DRIVE_RIGHT_B, + false, EncodingType.k4X); + leftEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE); + rightEncoder.setDistancePerPulse(RobotMap.DISTANCE_PER_PULSE); + } - public void resetEncoders() { - leftEncoder.reset(); - rightEncoder.reset(); - } + public void resetEncoders() { + leftEncoder.reset(); + rightEncoder.reset(); + } - public double getRightSpeed() { - // Returns inches per second - return rightEncoder.getRate(); - } + public double getRightSpeed() { - // Returns in per second ++ // Returns inches per second + return rightEncoder.getRate(); + } - public double getLeftSpeed() { - return leftEncoder.getRate(); - } - - public double getAverageSpeed() { - return (getRightSpeed() + getLeftSpeed())/2; - } + public double getLeftSpeed() { + return leftEncoder.getRate(); + } - public double getRightDistance() { - // Returns distance in inches - return rightEncoder.getDistance(); - } ++ public double getAverageSpeed() { ++ return (getRightSpeed() + getLeftSpeed()) / 2; ++ } + - public double getLeftDistance() { - // Returns distance in inches - return leftEncoder.getDistance(); - } + public double getRightDistance() { - // Returns distance in in ++ // Returns distance in inches + return rightEncoder.getDistance(); + } + + public double getLeftDistance() { - // Returns distance in in ++ // Returns distance in inches + return leftEncoder.getDistance(); + } + ++ public void stop() { ++ setMotorSpeeds(0, 0); ++ } + - public void stop() { - setMotorSpeeds(0, 0); + public void setMotorSpeeds(double leftSpeed, double rightSpeed) { + if (Math.abs(leftSpeed) < RobotMap.DRIVE_DEAD_ZONE) { + leftSpeed = 0; } - - public void setMotorSpeeds(double leftSpeed, double rightSpeed) { - if (Math.abs(leftSpeed) < RobotMap.DRIVE_DEAD_ZONE) { - leftSpeed = 0; - } - if (Math.abs(rightSpeed) < RobotMap.DRIVE_DEAD_ZONE) { - rightSpeed = 0; - } - this.frontLeft.set(leftSpeed); - this.frontRight.set(-rightSpeed); - this.rearLeft.set(leftSpeed); - this.rearRight.set(-rightSpeed); + if (Math.abs(rightSpeed) < RobotMap.DRIVE_DEAD_ZONE) { + rightSpeed = 0; } + this.frontLeft.set(leftSpeed); + this.frontRight.set(-rightSpeed); + this.rearLeft.set(leftSpeed); + this.rearRight.set(-rightSpeed); + } - public void arcadeDrive(double yVal, double twist) { - if (yVal < 0 && Math.abs(yVal) < 0.1125) { - yVal = 0; - } else if (yVal > 0 && Math.abs(yVal) < 0.25) { - yVal = 0; - } else if (yVal > 0) { - yVal -= 0.25; - } else if (yVal < 0) { - yVal += 0.15; - } - if (Math.abs(twist) < RobotMap.DRIVE_DEAD_ZONE) { - twist = 0; - } - - double leftMotorSpeed; - double rightMotorSpeed; - // adjust the sensitivity (yVal+rootof (yval)) / 2 - yVal = (yVal + Math.signum(yVal) * Math.sqrt(Math.abs(yVal))) / 2; - // adjust the sensitivity (twist+rootof (twist)) / 2 - twist = (twist + Math.signum(twist) * Math.sqrt(Math.abs(twist))) / 2; - if (yVal > 0) { - if (twist > 0) { - leftMotorSpeed = yVal - twist; - rightMotorSpeed = Math.max(yVal, twist); - } else { - leftMotorSpeed = Math.max(yVal, -twist); - rightMotorSpeed = yVal + twist; - } - } else { - if (twist > 0.0) { - leftMotorSpeed = -Math.max(-yVal, twist); - rightMotorSpeed = yVal + twist; - } else { - leftMotorSpeed = yVal - twist; - rightMotorSpeed = -Math.max(-yVal, -twist); - } - } - setMotorSpeeds(leftMotorSpeed, rightMotorSpeed); + public void arcadeDrive(double yVal, double twist) { + if (yVal < 0 && Math.abs(yVal) < 0.1125) { + yVal = 0; + } else if (yVal > 0 && Math.abs(yVal) < 0.25) { + yVal = 0; + } else if (yVal > 0) { + yVal -= 0.25; + } else if (yVal < 0) { + yVal += 0.15; + } + if (Math.abs(twist) < RobotMap.DRIVE_DEAD_ZONE) { + twist = 0; } - @Override - protected void initDefaultCommand() { + double leftMotorSpeed; + double rightMotorSpeed; + // adjust the sensitivity (yVal+rootof (yval)) / 2 + yVal = (yVal + Math.signum(yVal) * Math.sqrt(Math.abs(yVal))) / 2; + // adjust the sensitivity (twist+rootof (twist)) / 2 + twist = (twist + Math.signum(twist) * Math.sqrt(Math.abs(twist))) / 2; + if (yVal > 0) { + if (twist > 0) { + leftMotorSpeed = yVal - twist; + rightMotorSpeed = Math.max(yVal, twist); + } else { + leftMotorSpeed = Math.max(yVal, -twist); + rightMotorSpeed = yVal + twist; + } + } else { + if (twist > 0.0) { + leftMotorSpeed = -Math.max(-yVal, twist); + rightMotorSpeed = yVal + twist; + } else { + leftMotorSpeed = yVal - twist; + rightMotorSpeed = -Math.max(-yVal, -twist); + } } + setMotorSpeeds(leftMotorSpeed, rightMotorSpeed); + } + + @Override + protected void initDefaultCommand() { + } - - public void stop() { - setMotorSpeeds(0, 0); - } }