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

Commit fa7085c

Browse files
committed
set up subsystem interfaces
added some methods and motor controllers to Lift, Climber, and Intake
1 parent b9cb9d8 commit fa7085c

7 files changed

Lines changed: 257 additions & 7 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.usfirst.frc.team199.Robot2018;
22

3+
import edu.wpi.first.wpilibj.SpeedController;
4+
import edu.wpi.first.wpilibj.TalonSRX;
5+
36
/**
47
* The RobotMap is a mapping from the ports sensors and actuators are wired into
58
* to a variable name. This provides flexibility changing wiring, makes checking
@@ -16,4 +19,12 @@ public class RobotMap {
1619
// number and the module. For example you with a rangefinder:
1720
// public static int rangefinderPort = 1;
1821
// public static int rangefinderModule = 1;
22+
23+
public static SpeedController intakeMotors = new TalonSRX(000000);
24+
public static SpeedController liftMotors = new TalonSRX(000000);
25+
public static SpeedController climberMotors = new TalonSRX(000000);
26+
27+
28+
29+
1930
}

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

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

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

5+
import org.usfirst.frc.team199.Robot2018.RobotMap;
6+
7+
import edu.wpi.first.wpilibj.SpeedController;
58
/**
69
*
710
*/
811
public class Climber extends Subsystem implements ClimberInterface {
912

10-
// Put methods for controlling this subsystem
11-
// here. Call these from Commands.
13+
private final SpeedController climberMotors = RobotMap.climberMotors;
14+
1215

1316
/**
1417
* Set the default command for a subsystem here.
@@ -17,5 +20,49 @@ public void initDefaultCommand() {
1720
// Set the default command for a subsystem here.
1821
//setDefaultCommand(new MySpecialCommand());
1922
}
23+
24+
25+
26+
27+
/**
28+
*
29+
*/
30+
public void runClimber() {
31+
attachToLift();
32+
attachToBar();
33+
goUp();
34+
35+
}
36+
37+
/**
38+
* attaches the climber hook to the lift.
39+
* Requires that Lift is on the ground
40+
*/
41+
public void attachToLift() {
42+
43+
}
44+
45+
/**
46+
* winches upwards
47+
*/
48+
public void goUp() {
49+
50+
}
51+
52+
/**
53+
* attaches hook to bar and releases it from the lift
54+
*/
55+
public void attachToBar() {
56+
57+
}
58+
59+
/**
60+
* stops the climber
61+
*/
62+
public void stopClimber() {
63+
climberMotors.stopMotor();
64+
}
65+
66+
2067
}
2168

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

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

10+
/**
11+
*
12+
*/
13+
public void runClimber();
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+
* winches upwards
23+
*/
24+
public void goUp();
25+
26+
/**
27+
* attaches hook to bar and releases it from the lift
28+
*/
29+
public void attachToBar();
30+
31+
/**
32+
* stops the climber
33+
*/
34+
public void stopClimber();
35+
36+
1037
}
Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
package org.usfirst.frc.team199.Robot2018.subsystems;
22

3+
import org.usfirst.frc.team199.Robot2018.RobotMap;
4+
5+
import edu.wpi.first.wpilibj.SpeedController;
36
import edu.wpi.first.wpilibj.command.Subsystem;
47

58
/**
69
*
710
*/
811
public class IntakeEject extends Subsystem implements IntakeEjectInterface {
9-
10-
// Put methods for controlling this subsystem
11-
// here. Call these from Commands.
12+
13+
private final SpeedController intakeRollers = RobotMap.intakeMotors;
14+
15+
1216

1317
/**
1418
* Set the default command for a subsystem here.
@@ -17,5 +21,46 @@ public void initDefaultCommand() {
1721
// Set the default command for a subsystem here.
1822
//setDefaultCommand(new MySpecialCommand());
1923
}
24+
25+
/**
26+
* returns current motor value
27+
*/
28+
public double getIntake() {
29+
return intakeMotors.get();
30+
}
31+
32+
/**
33+
* Uses (insert sensor here) to detect
34+
* a cube in front of the robot.
35+
*/
36+
public boolean detectCube() {
37+
38+
}
39+
40+
/**
41+
* Uses (insert sensor here) to detect if
42+
* the cube is currently inside the robot
43+
*
44+
*/
45+
public boolean hasCube() {
46+
47+
}
48+
49+
/**
50+
* stops the motors
51+
*
52+
*/
53+
public boolean stopIntake() {
54+
intakeRollers.stop();
55+
}
56+
57+
/**
58+
* Spins the rollers
59+
* @param speed - positive -> rollers in, negative -> rollers out
60+
*/
61+
public void runIntake(double speed) {
62+
63+
}
64+
2065
}
2166

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 getIntake();
14+
15+
/**
16+
* Uses (insert sensor here) to detect
17+
* a cube in front of the robot.
18+
*/
19+
public boolean detectCube();
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 boolean 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
}
Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package org.usfirst.frc.team199.Robot2018.subsystems;
22

3+
import org.usfirst.frc.team199.Robot2018.RobotMap;
4+
5+
import edu.wpi.first.wpilibj.SpeedController;
36
import edu.wpi.first.wpilibj.command.Subsystem;
47

58
/**
69
*
710
*/
811
public class Lift extends Subsystem implements LiftInterface {
912

10-
// Put methods for controlling this subsystem
11-
// here. Call these from Commands.
13+
private final SpeedController liftMotors = RobotMap.liftMotors;
1214

1315
/**
1416
* Set the default command for a subsystem here.
@@ -17,5 +19,56 @@ public void initDefaultCommand() {
1719
// Set the default command for a subsystem here.
1820
//setDefaultCommand(new MySpecialCommand());
1921
}
22+
23+
/**
24+
* Uses (insert sensor here) to detect the distance above the ground
25+
*/
26+
public double getDistance() {
27+
28+
}
29+
30+
/**
31+
* stops the lift
32+
*/
33+
public void stopLift() {
34+
liftMotors.stopMotor();
35+
}
36+
37+
/**
38+
* gets current motor values
39+
*/
40+
public double getLift() {
41+
return liftMotors.get();
42+
}
43+
44+
/**
45+
* goes to the bottom
46+
*/
47+
public void goToGround() {
48+
49+
}
50+
51+
/**
52+
* goes to switch height
53+
*/
54+
public void goToSwitch() {
55+
56+
}
57+
58+
/**
59+
* goes to scale height
60+
* @param offset - the distance up or down from standard scale height
61+
*/
62+
public void goToScale(double offset) {
63+
64+
}
65+
66+
/**
67+
* goes to bar height
68+
*/
69+
public void goToBar() {
70+
71+
}
72+
2073
}
2174

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

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

10+
/**
11+
* Uses (insert sensor here) to detect the distance above the ground
12+
*/
13+
public double getDistance();
14+
15+
/**
16+
* stops the lift
17+
*/
18+
public void stopLift();
19+
20+
/**
21+
* gets current motor values
22+
*/
23+
public double getLift();
24+
25+
/**
26+
* goes to the bottom
27+
*/
28+
public void goToGround();
29+
30+
/**
31+
* goes to switch height
32+
*/
33+
public void goToSwitch();
34+
35+
/**
36+
* goes to scale height
37+
* @param offset - the distance up or down from standard scale height
38+
*/
39+
public void goToScale(double offset);
40+
41+
/**
42+
* goes to bar height
43+
*/
44+
public void goToBar();
45+
1046
}

0 commit comments

Comments
 (0)