Created Wrist Subsystem

Created the wrist subsystem, commented out compile pathfinder in build.gradle. Edited Robot Map by changing carriage to wrist motors
This commit is contained in:
mayabartels
2019-01-21 13:07:41 -08:00
parent 3615e5c257
commit f0fdfabc2e
4 changed files with 59 additions and 4 deletions
@@ -37,7 +37,8 @@ public class Robot extends IterativeRobot
public static final Climber climber = new Climber();
public static final Pnumatics pnumatics = new Pnumatics();
public static final Pnumatics pnumatics = new Pnumatics();
public static final Wrist wrist = new Wrist();
public static final long periodMS = 10;
public static final ControlLooper controlLoop = new ControlLooper("Main control loop", periodMS);
@@ -18,8 +18,8 @@ public class RobotMap {
public static final int DRIVETRAIN_RIGHT_MOTOR2_CAN_ID = 5;
//carriage motors
public static final int CARRIAGE_LEFT_MOTOR_CAN_ID = 8;
public static final int CARRIAGE_RIGHT_MOTOR_CAN_ID = 9;
public static final int WRIST_LEFT_MOTOR_CAN_ID = 8;
public static final int WRITST_RIGHT_MOTOR_CAN_ID = 9;
//Elevator Motors
public static final int ELEVATOR_MOTOR1_ID = 6;
@@ -0,0 +1,54 @@
package org.usfirst.frc4388.robot.subsystems;
import edu.wpi.first.wpilibj.command.Subsystem;
import org.usfirst.frc4388.controller.XboxController;
import org.usfirst.frc4388.robot.Constants;
import org.usfirst.frc4388.robot.Robot;
import org.usfirst.frc4388.robot.RobotMap;
import org.usfirst.frc4388.robot.commands.*;
import org.usfirst.frc4388.robot.subsystems.Drive.DriveControlMode;
import org.usfirst.frc4388.utility.CANTalonEncoder;
import org.usfirst.frc4388.utility.ControlLoopable;
import org.usfirst.frc4388.utility.PIDParams;
import org.usfirst.frc4388.utility.SoftwarePIDPositionController;
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
import com.ctre.phoenix.motorcontrol.RemoteLimitSwitchSource;
import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.SensorCollection;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
/**
* Add your docs here.
*/
public class Wrist extends Subsystem
{
//PID encoder and motor
private CANTalonEncoder wristRight;
private WPI_TalonSRX wristLeft;
//Encoder ticks to inches for encoders
public static final double ENCODER_TICKS_TO_INCHES = Constants.kElevatorEncoderTicksPerInch;
public Wrist()
{
try
{
//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);
}
catch(Exception e)
{
System.err.println("You thought the code would work, but it was me, error. An error occurred in the Wrist Construtor");
}
}
@Override
public void initDefaultCommand()
{
}
}