Skip to content

Commit 22a4162

Browse files
authored
Merge pull request #60 from blair-robot-project/whitman_merge
Whitman merge
2 parents 8a262b7 + d17f577 commit 22a4162

File tree

111 files changed

+7010
-1907
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+7010
-1907
lines changed

build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protobuf {
6767
// options. Note the braces cannot be omitted, otherwise the
6868
// plugin will not be added. This is because of the implicit way
6969
// NamedDomainObjectContainer binds the methods.
70-
grpc { }
70+
grpc {}
7171
}
7272
}
7373
}
@@ -82,7 +82,7 @@ idea {
8282
}
8383
}
8484

85-
task convertFiles{
85+
task convertFiles {
8686
doLast {
8787
fileTree("./src/main/resources").matching { include "*" }.each { aFile ->
8888
exec {
@@ -94,14 +94,16 @@ task convertFiles{
9494
}
9595

9696
frc {
97-
//deployers += [to: "/home/lvuser/map.cfg", from: './src/main/resources/map.cfg']
98-
//deployers += [to: "/home/lvuser/profile.csv", from: './src/main/resources/profile.csv']
97+
// deployers += [to: "/home/lvuser/map.cfg", from: './src/main/resources/map.cfg']
98+
// deployers += [to: "/home/lvuser/profile.csv", from: './src/main/resources/profile.csv']
99+
// deployers += [to: "/home/lvuser/profile.csv", from: './src/main/resources/profile.csv']
99100
team = '449'
100101
robotClass = "org.usfirst.frc.team449.robot.Robot"
101102
}
102103

103104
wpi {
104-
wpilibVersion = "+" // The WPILib version to use. For this version of GradleRIO, must be a 2017 version
105+
wpilibVersion = "+"
106+
// The WPILib version to use. For this version of GradleRIO, must be a 2017 version
105107
ntcoreVersion = "+" // The NetworkTables Core version to use.
106108
opencvVersion = "+" // The OpenCV version to use
107109
cscoreVersion = "+" // The CSCore version to use
@@ -124,7 +126,7 @@ task genJavadoc(type: Jar, dependsOn: javadoc) {
124126
from javadoc.destinationDir
125127
}
126128

127-
task('copyResources', dependsOn: convertFiles){
129+
task('copyResources', dependsOn: convertFiles) {
128130
doLast {
129131
ssh.run {
130132
session(remotes.rio) {

gradle/wrapper/gradle-wrapper.jar

0 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Feb 15 17:39:11 EST 2017
1+
#Tue Mar 07 16:17:41 EST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

src/main/java/org/usfirst/frc/team449/robot/ReferencingCommandGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public abstract class ReferencingCommandGroup extends CommandGroup {
1414
/**
1515
* Subsystem to reference to
1616
*/
17-
MappedSubsystem subsystem;
17+
private MappedSubsystem subsystem;
1818

1919
/**
2020
* Instantiate the ReferencingCommandGroup

src/main/java/org/usfirst/frc/team449/robot/Robot.java

Lines changed: 89 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
import edu.wpi.first.wpilibj.Compressor;
44
import edu.wpi.first.wpilibj.IterativeRobot;
55
import edu.wpi.first.wpilibj.command.Scheduler;
6+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
67
import maps.org.usfirst.frc.team449.robot.Robot2017Map;
78
import org.usfirst.frc.team449.robot.drive.talonCluster.TalonClusterDrive;
9+
import org.usfirst.frc.team449.robot.drive.talonCluster.commands.DefaultArcadeDrive;
10+
import org.usfirst.frc.team449.robot.drive.talonCluster.commands.ExecuteProfile;
811
import org.usfirst.frc.team449.robot.drive.talonCluster.commands.PIDTest;
912
import org.usfirst.frc.team449.robot.drive.talonCluster.commands.SwitchToLowGear;
1013
import org.usfirst.frc.team449.robot.mechanism.climber.ClimberSubsystem;
1114
import org.usfirst.frc.team449.robot.mechanism.feeder.FeederSubsystem;
1215
import org.usfirst.frc.team449.robot.mechanism.intake.Intake2017.Intake2017;
16+
import org.usfirst.frc.team449.robot.mechanism.intake.Intake2017.commands.updown.IntakeUp;
17+
import org.usfirst.frc.team449.robot.mechanism.intake.IntakeSubsystem;
1318
import org.usfirst.frc.team449.robot.mechanism.pneumatics.PneumaticsSubsystem;
1419
import org.usfirst.frc.team449.robot.mechanism.singleflywheelshooter.SingleFlywheelShooter;
1520
import org.usfirst.frc.team449.robot.oi.OI2017ArcadeGamepad;
@@ -18,111 +23,180 @@
1823
import java.io.IOException;
1924

2025
/**
21-
* Created by BlairRobot on 2017-01-08.
26+
* The main class of the robot, constructs all the subsystems and initializes default commands.
2227
*/
2328
public class Robot extends IterativeRobot {
2429

30+
/**
31+
* The shooter subsystem (flywheel only)
32+
*/
2533
public static SingleFlywheelShooter singleFlywheelShooterSubsystem;
2634

35+
/**
36+
* The intake subsystem (intake motors and pistons)
37+
*/
2738
public static Intake2017 intakeSubsystem;
2839

40+
/**
41+
*The climber
42+
*/
2943
public static ClimberSubsystem climberSubsystem;
3044

45+
/**
46+
*The pneumatics (maybe doesn't work?)
47+
*/
3148
public static PneumaticsSubsystem pneumaticsSubsystem;
3249

50+
/**
51+
*The drive
52+
*/
3353
public static TalonClusterDrive driveSubsystem;
3454

55+
/**
56+
* OI, using an Xbox-style controller and arcade drive.
57+
*/
3558
public static OI2017ArcadeGamepad oiSubsystem;
3659

60+
/**
61+
* The cameras on the robot and the code to stream them to SmartDashboard (NOT computer vision!)
62+
*/
3763
public static CameraSubsystem cameraSubsystem;
3864

65+
/**
66+
* The auger used to feed balls into the shooter.
67+
*/
3968
public static FeederSubsystem feederSubsystem;
4069

41-
private static maps.org.usfirst.frc.team449.robot.Robot2017Map.Robot2017 cfg;
70+
/**
71+
* The object constructed directly from map.cfg.
72+
* */
73+
private static Robot2017Map.Robot2017 cfg;
4274

75+
/**
76+
* The method that runs when the robot is turned on. Initializes all subsystems from the map.
77+
*/
4378
public void robotInit() {
44-
System.out.println("Started robotInit");
79+
System.out.println("Started robotInit.");
80+
4581
try {
82+
//Try to construct map from the cfg file
4683
//cfg = (Robot2017Map.Robot2017) MappedSubsystem.readConfig("/home/lvuser/449_resources/balbasaur_map.cfg",
47-
cfg = (Robot2017Map.Robot2017) MappedSubsystem.readConfig("/home/lvuser/449_resources/final_map.cfg",
48-
//cfg = (Robot2017Map.Robot2017) MappedSubsystem.readConfig("/home/lvuser/449_resources/final_map_only_drive.cfg",
84+
//cfg = (Robot2017Map.Robot2017) MappedSubsystem.readConfig("/home/lvuser/449_resources/final_map.cfg",
85+
cfg = (Robot2017Map.Robot2017) MappedSubsystem.readConfig("/home/lvuser/449_resources/fancy_map.cfg",
4986
Robot2017Map.Robot2017.newBuilder());
5087
} catch (IOException e) {
88+
//This is either the map file not being in the file system OR it being improperly formatted.
5189
System.out.println("Config file is bad/nonexistent!");
5290
e.printStackTrace();
5391
}
5492

93+
//Construct the OI (has to be done first because other subsystems take the OI as an argument.)
5594
oiSubsystem = new OI2017ArcadeGamepad(cfg.getArcadeOi());
5695
System.out.println("Constructed OI");
5796

97+
//Construct the drive (not in a if block because you kind of need it.)
5898
driveSubsystem = new TalonClusterDrive(cfg.getDrive(), oiSubsystem);
5999
System.out.println("Constructed Drive");
60100

101+
//Construct camera if it's in the map.
61102
if (cfg.hasCamera()) {
62103
cameraSubsystem = new CameraSubsystem(cfg.getCamera());
63104
}
64105

106+
//Construct climber if it's in the map.
65107
if (cfg.hasClimber()) {
66108
climberSubsystem = new ClimberSubsystem(cfg.getClimber());
67109
}
68110

111+
//Construct shooter if it's in the map.
69112
if (cfg.hasShooter()) {
70113
singleFlywheelShooterSubsystem = new SingleFlywheelShooter(cfg.getShooter());
71114
System.out.println("Constructed SingleFlywheelShooter");
72115
}
73116

74-
// pneumaticsSubsystem = new PneumaticsSubsystem(cfg.getPneumatics());
75-
// System.out.println("Constructed PneumaticsSubsystem");
76-
117+
//Construct pneumatics if it's in the map.
77118
if (cfg.hasPneumatics()) {
78119
pneumaticsSubsystem = new PneumaticsSubsystem(cfg.getPneumatics());
79120
System.out.println("Constructed PneumaticsSubsystem");
80121
}
81122

123+
//Construct intake if it's in the map.
82124
if (cfg.hasIntake()) {
83125
intakeSubsystem = new Intake2017(cfg.getIntake());
84126
}
85127

86-
if (cfg.hasFeeder()){
128+
//Construct feeder if it's in the map.
129+
if (cfg.hasFeeder()) {
87130
feederSubsystem = new FeederSubsystem(cfg.getFeeder());
88131
}
89132

133+
//Map the buttons (has to be done last because all the subsystems need to have been instantiated.)
90134
oiSubsystem.mapButtons();
91135
System.out.println("Mapped buttons");
92136

137+
//Activate the compressor if its module number is in the map.
93138
if (cfg.hasModule()) {
94139
Compressor compressor = new Compressor(cfg.getModule());
95140
compressor.setClosedLoopControl(true);
96141
compressor.start();
97142
}
98143
}
99144

145+
/**
146+
* Run when we first enable in teleop.
147+
*/
100148
@Override
101149
public void teleopInit() {
102-
// if (driveSubsystem.shifter != null) {
103-
// Scheduler.getInstance().add(new SwitchToHighGear(driveSubsystem));
104-
// }
150+
//Stop the drive for safety reasons
151+
driveSubsystem.setVBusThrottle(0, 0);
105152

106-
driveSubsystem.setDefaultThrottle(0, 0);
153+
driveSubsystem.leftMaster.canTalon.enable();
154+
driveSubsystem.rightMaster.canTalon.enable();
107155

108-
if (driveSubsystem.shifter != null){
156+
//Switch to low gear if we have gears
157+
if (driveSubsystem.shifter != null) {
109158
Scheduler.getInstance().add(new SwitchToLowGear(driveSubsystem));
110159
}
160+
161+
if (intakeSubsystem != null) {
162+
Scheduler.getInstance().add(new IntakeUp(intakeSubsystem));
163+
}
164+
165+
// Scheduler.getInstance().add(new DefaultArcadeDrive(driveSubsystem.straightPID, driveSubsystem, oiSubsystem));
111166
}
112167

168+
/**
169+
* Run every tick in teleop.
170+
*/
113171
@Override
114172
public void teleopPeriodic() {
173+
//Run all commands. This is a WPILib thing you don't really have to worry about.
115174
Scheduler.getInstance().run();
116175
}
117176

177+
/**
178+
* Run when we first enable in autonomous
179+
*/
118180
@Override
119181
public void autonomousInit() {
120-
driveSubsystem.setDefaultThrottle(0, 0);
182+
//Set throttle to 0 for safety reasons
183+
if (driveSubsystem.shifter != null) {
184+
Scheduler.getInstance().add(new SwitchToLowGear(driveSubsystem));
185+
}
186+
driveSubsystem.leftMaster.canTalon.enable();
187+
driveSubsystem.rightMaster.canTalon.enable();
188+
driveSubsystem.setVBusThrottle(0, 0);
121189
Scheduler.getInstance().add(new PIDTest(driveSubsystem));
190+
// Scheduler.getInstance().add(new ExecuteProfile(driveSubsystem));
122191
}
123192

193+
/**
194+
* Runs every tick in autonomous.
195+
*/
124196
@Override
125197
public void autonomousPeriodic() {
198+
//Run all commands. This is a WPILib thing you don't really have to worry about.
126199
Scheduler.getInstance().run();
200+
SmartDashboard.putNumber("Heading", driveSubsystem.getGyroOutput());
127201
}
128202
}

src/main/java/org/usfirst/frc/team449/robot/Tester2017.java

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

src/main/java/org/usfirst/frc/team449/robot/components/NavxSubsystem.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44
* A subsystem that has a NavX on it.
55
*/
66
public interface NavxSubsystem {
7+
/**
8+
* Get the output of the NavX
9+
*
10+
* @return The heading, on a scale of -180 to 180.
11+
*/
712
double getGyroOutput();
813
}

0 commit comments

Comments
 (0)