Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 089009a

Browse files
authored
Merge pull request #39 from kaytay7430/master
set up subsystem interfaces
2 parents 57eb918 + b17b748 commit 089009a

9 files changed

Lines changed: 234 additions & 123 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/RobotMap.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
package org.usfirst.frc.team199.Robot2018;
99

10+
11+
import edu.wpi.first.wpilibj.SpeedController;
12+
1013
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
1114
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;
1215
import com.kauailabs.navx.frc.AHRS;
@@ -20,6 +23,7 @@
2023
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
2124
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
2225

26+
2327
/**
2428
* The RobotMap is a mapping from the ports sensors and actuators are wired into
2529
* to a variable name. This provides flexibility changing wiring, makes checking
@@ -36,7 +40,11 @@ public class RobotMap {
3640
// number and the module. For example you with a rangefinder:
3741
// public static int rangefinderPort = 1;
3842
// public static int rangefinderModule = 1;
39-
43+
44+
public static WPI_TalonSRX intakeMotor;
45+
public static WPI_TalonSRX liftMotor;
46+
public static WPI_TalonSRX climberMotor;
47+
4048
public static Encoder leftEnc;
4149
public static WPI_TalonSRX dtLeftDrive;
4250
public static WPI_VictorSPX dtLeftSlave;
@@ -87,6 +95,13 @@ private void configSPX(WPI_VictorSPX mc) {
8795
}
8896

8997
public RobotMap() {
98+
99+
intakeMotor = new WPI_TalonSRX(getPort("IntakeTalonSRX", 4));
100+
configSRX(intakeMotor);
101+
liftMotor = new WPI_TalonSRX(getPort("LiftTalonSRX", 5));
102+
configSRX(liftMotor);
103+
climberMotor = new WPI_TalonSRX(getPort("ClimberTalonSRX", 6));
104+
configSRX(climberMotor);
90105

91106
leftEnc = new Encoder(getPort("1LeftEnc", 0), getPort("2LeftEnc", 1));
92107
dtLeftDrive = new WPI_TalonSRX(getPort("LeftTalonSRXDrive", 0));
@@ -161,4 +176,5 @@ public int getPort(String key, int def) {
161176
}
162177
return (int) SmartDashboard.getNumber("Port/" + key, def);
163178
}
179+
164180
}

Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/TalonVelocityController.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

Robot2018/src/org/usfirst/frc/team199/Robot2018/autonomous/VelocityPIDController.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Climber.java

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
import edu.wpi.first.wpilibj.command.Subsystem;
44

5+
import org.usfirst.frc.team199.Robot2018.RobotMap;
6+
7+
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
8+
59
/**
610
*
711
*/
812
public class Climber extends Subsystem implements ClimberInterface {
913

10-
// Put methods for controlling this subsystem
11-
// here. Call these from Commands.
14+
private final WPI_TalonSRX climberMotor = RobotMap.climberMotor;
15+
1216

1317
/**
1418
* Set the default command for a subsystem here.
@@ -17,5 +21,40 @@ public void initDefaultCommand() {
1721
// Set the default command for a subsystem here.
1822
//setDefaultCommand(new MySpecialCommand());
1923
}
24+
25+
26+
27+
28+
/**
29+
* runs the motors
30+
*
31+
*/
32+
public void runClimber(double speed) {
33+
34+
}
35+
36+
/**
37+
* attaches the climber hook to the lift.
38+
* Requires that Lift is on the ground
39+
*/
40+
public void attachToLift() {
41+
42+
}
43+
44+
/**
45+
* attaches hook to bar and releases it from the lift
46+
*/
47+
public void attachToBar() {
48+
49+
}
50+
51+
/**
52+
* stops the climber
53+
*/
54+
public void stopClimber() {
55+
climberMotor.stopMotor();
56+
}
57+
58+
2059
}
2160

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/ClimberInterface.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,26 @@ public interface ClimberInterface {
77
* */
88
public void initDefaultCommand();
99

10+
/**
11+
* runs the motors
12+
*/
13+
public void runClimber(double speed);
14+
15+
/**
16+
* attaches the climber hook to the lift.
17+
* Requires that Lift is on the ground
18+
*/
19+
public void attachToLift();
20+
21+
/**
22+
* attaches hook to bar and releases it from the lift
23+
*/
24+
public void attachToBar();
25+
26+
/**
27+
* stops the climber
28+
*/
29+
public void stopClimber();
30+
31+
1032
}
Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package org.usfirst.frc.team199.Robot2018.subsystems;
22

3+
import org.usfirst.frc.team199.Robot2018.RobotMap;
4+
5+
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
6+
37
import edu.wpi.first.wpilibj.command.Subsystem;
48

59
/**
610
*
711
*/
812
public class IntakeEject extends Subsystem implements IntakeEjectInterface {
9-
10-
// Put methods for controlling this subsystem
11-
// here. Call these from Commands.
13+
14+
private final WPI_TalonSRX intakeMotor = RobotMap.intakeMotor;
15+
16+
1217

1318
/**
1419
* Set the default command for a subsystem here.
@@ -17,5 +22,46 @@ public void initDefaultCommand() {
1722
// Set the default command for a subsystem here.
1823
//setDefaultCommand(new MySpecialCommand());
1924
}
25+
26+
/**
27+
* returns current motor value
28+
*/
29+
public double getIntakeSpeed() {
30+
return intakeMotor.get();
31+
}
32+
33+
/**
34+
* Uses (insert sensor here) to detect
35+
* a cube in front of the robot.
36+
*/
37+
public boolean seeCube() {
38+
return false;
39+
}
40+
41+
/**
42+
* Uses (insert sensor here) to detect if
43+
* the cube is currently inside the robot
44+
*
45+
*/
46+
public boolean hasCube() {
47+
return false;
48+
}
49+
50+
/**
51+
* stops the motors
52+
*
53+
*/
54+
public void stopIntake() {
55+
intakeMotor.stopMotor();
56+
}
57+
58+
/**
59+
* Spins the rollers
60+
* @param speed - positive -> rollers in, negative -> rollers out
61+
*/
62+
public void runIntake(double speed) {
63+
64+
}
65+
2066
}
2167

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/IntakeEjectInterface.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,35 @@ public interface IntakeEjectInterface {
77
* */
88
public void initDefaultCommand();
99

10+
/**
11+
* returns current motor value
12+
*/
13+
public double getIntakeSpeed();
14+
15+
/**
16+
* Uses (insert sensor here) to detect
17+
* a cube in front of the robot.
18+
*/
19+
public boolean seeCube();
20+
21+
/**
22+
* Uses (insert sensor here) to detect if
23+
* the cube is currently inside the robot
24+
*
25+
*/
26+
public boolean hasCube();
27+
28+
/**
29+
* stops the motors
30+
*
31+
*/
32+
public void stopIntake();
33+
34+
/**
35+
* Spins the rollers
36+
* @param speed - positive -> rollers in, negative -> rollers out
37+
*/
38+
public void runIntake(double speed);
39+
40+
1041
}

0 commit comments

Comments
 (0)