From fcd28bc782f95c2888ed10ca43468876bb33eadb Mon Sep 17 00:00:00 2001 From: mayabartels Date: Tue, 22 Jan 2019 16:47:17 -0800 Subject: [PATCH] Minor fixes. Added to wrist Added function to get angle --- .../org/usfirst/frc4388/robot/Constants.java | 5 +-- .../frc4388/robot/subsystems/Wrist.java | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/Constants.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/Constants.java index f6a18a1..21b73c4 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/Constants.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/Constants.java @@ -23,12 +23,13 @@ public class Constants { public static double kDriveStraightBasicMaxSteerMagnitude = 0.8; // keep absolute value of steer parameter below this public static double kDriveTurnBasicTankMotorOutput = 0.4; public static double kDriveTurnBasicSingleMotorOutput = 0.15; - public static double kElevatorWheelDiameterInches = 1; + public static double kArmWheelDiameterInches = 1; //Changes depending on mechanical design + // Encoders public static int kDriveEncoderTicksPerRev = 4096; public static double kDriveEncoderTicksPerInch = (double)kDriveEncoderTicksPerRev / (kDriveWheelDiameterInches * Math.PI); - // Elevator + // Arm public static int kArmEncoderTickesPerRev = 256; public static double kArmInchesOfTravelPerRev = 3.75; public static double kArmEncoderTicksPerInch = 126.36; diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Wrist.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Wrist.java index 65e1fd0..8cab5cc 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Wrist.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Wrist.java @@ -39,9 +39,7 @@ public class Wrist extends Subsystem { //PID wrist encoder and talon wristRight = new CANTalonEncoder(RobotMap.WRIST_LEFT_MOTOR_CAN_ID, ENCODER_TICKS_TO_INCHES, FeedbackDevice.QuadEncoder); - wristLeft = new WPI_TalonSRX(RobotMap.WRITST_RIGHT_MOTOR_CAN_ID); - - + //wristLeft = new WPI_TalonSRX(RobotMap.WRITST_RIGHT_MOTOR_CAN_ID); } catch(Exception e) { @@ -49,8 +47,38 @@ public class Wrist extends Subsystem } } + public double armAngle(double encoderValue) + { + double angle = 0; + + //Insert conversion from encoder value to angle of arm + + return angle; + } + + public void stationaryWrist() + { + double angle = armAngle(ENCODER_TICKS_TO_INCHES); + + + } + @Override public void initDefaultCommand() { } + + public void updateStatus(Robot.OperationMode operationMode) + { + if (operationMode == Robot.OperationMode.TEST) + { + try + { + } + catch (Exception e) + { + System.err.println("Wrist update status error"); + } + } + } }