-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Manipulation #7
base: master
Are you sure you want to change the base?
Changes from 12 commits
d6c08b4
4163e72
d13ec9c
910d366
8699047
0d3f789
f9fce03
447dbcd
3a6203e
f70bebd
e24a260
1c66fd0
04646a9
2679dfe
2491a64
9a5c730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package frc.robot; | ||
|
||
import edu.wpi.first.wpilibj.DoubleSolenoid; | ||
import edu.wpi.first.wpilibj.PneumaticsModuleType; | ||
import edu.wpi.first.wpilibj.DoubleSolenoid.Value; | ||
|
||
import com.revrobotics.CANSparkMax; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong lexicographical order for 'com.revrobotics.CANSparkMax' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra separation in import group before 'com.revrobotics.CANSparkMax' |
||
import com.revrobotics.CANSparkMaxLowLevel.MotorType; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong lexicographical order for 'com.revrobotics.CANSparkMaxLowLevel.MotorType' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'. |
||
|
||
import frc.robot.logging.Loggable; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra separation in import group before 'frc.robot.logging.Loggable' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import statement for 'frc.robot.logging.Loggable' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line. |
||
import frc.robot.logging.Logger; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Import statement for 'frc.robot.logging.Logger' is in the wrong order. Should be in the 'THIRD_PARTY_PACKAGE' group, expecting not assigned imports on this line. |
||
|
||
public class Manipulation implements Loggable { | ||
|
||
private CANSparkMax intakeWheel; | ||
private DoubleSolenoid intakePneumatics; | ||
private CANSparkMax indexLoad; | ||
|
||
private double speed; | ||
private boolean spinning; | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First sentence of Javadoc is missing an ending period. |
||
* Constructor | ||
* | ||
* @param pneumaticsForwardChannel The Solenoid id for the forward channel for the intake | ||
* @param pneumaticsReverseChannel The Solenoid id for the reverse channel for the intake | ||
* @param intakeWheelID The CAN id of the spark for the intake | ||
* @param indexLoadID The CAN id of the spark for the index loader | ||
* | ||
*/ | ||
Manipulation(int pneumaticsForwardChannel, int pneumaticsReverseChannel, int intakeWheelID, int indexLoadID) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is longer than 100 characters (found 114). |
||
this.intakeWheel = new CANSparkMax(intakeWheelID, MotorType.kBrushless); | ||
this.indexLoad = new CANSparkMax(indexLoadID, MotorType.kBrushless); | ||
this.intakePneumatics = new DoubleSolenoid(PneumaticsModuleType.REVPH, pneumaticsForwardChannel, pneumaticsReverseChannel); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is longer than 100 characters (found 131). |
||
|
||
intakeWheel.setInverted(true); | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First sentence of Javadoc is missing an ending period. |
||
* Spins the intake motor | ||
* | ||
* @param spin True if the motor should spin; false if not | ||
* | ||
*/ | ||
public void setIntakeSpin(boolean spin) { | ||
this.speed = spin ? -0.5 : 0.0; | ||
intakeWheel.set(speed); | ||
this.spinning = spin; | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First sentence of Javadoc is missing an ending period. |
||
* Moves the intake system | ||
* | ||
* @param extend True if the pneumatics should extend; false if not | ||
* | ||
*/ | ||
public void setIntakeExtend(boolean extend) { | ||
intakePneumatics.set(extend ? Value.kForward : Value.kReverse); | ||
} | ||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First sentence of Javadoc is missing an ending period. |
||
* Moves power cells down indexing system | ||
* | ||
* @param load True if it should load; false if not | ||
* | ||
*/ | ||
public void setIndexLoad(boolean load) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'METHOD_DEF' should be separated from previous statement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'METHOD_DEF' should be separated from previous line. |
||
indexLoad.set(load ? 0.5 : 0.0); | ||
} | ||
|
||
@Override | ||
public void setupLogging(Logger logger) { | ||
logger.addAttribute("Manipulation/IntakeWheelSpeed"); | ||
logger.addAttribute("Manipulation/IntakeWheelEnabled"); | ||
} | ||
|
||
@Override | ||
public void log(Logger logger) { | ||
logger.log("Manipulation/IntakeWheelSpeed", speed); | ||
logger.log("Manipulation/IntakeWheelEnabled", spinning); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,12 @@ public class Robot extends TimedRobot { | |
|
||
LoggableController driver; | ||
LoggableController operator; | ||
Manipulation manipulation; | ||
|
||
LoggablePowerDistribution pdp; | ||
|
||
boolean manipulationEnabled = true; | ||
|
||
/** | ||
* This function is run when the robot is first started up and should be used for any | ||
* initialization code. | ||
|
@@ -38,6 +41,13 @@ public void robotInit() { | |
driver = new LoggableController("Driver", 0); | ||
operator = new LoggableController("Operator", 1); | ||
|
||
if (manipulationEnabled) { | ||
System.out.println("Initializing manipulation..."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace this use of System.out or System.err by a logger. |
||
manipulation = new Manipulation(0, 1, 7, 8); | ||
} else { | ||
System.out.println("Manipulation initialization disabled."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace this use of System.out or System.err by a logger. |
||
} | ||
|
||
logger = new Logger(); | ||
timer = new LoggableTimer(); | ||
|
||
|
@@ -71,6 +81,16 @@ public void teleopInit() { | |
@Override | ||
public void teleopPeriodic() { | ||
// Robot code goes here | ||
if (this.manipulationEnabled) { | ||
if (driver.getRightBumperPressed()) { | ||
manipulation.setIntakeExtend(true); | ||
} else if (driver.getLeftBumperPressed()) { | ||
manipulation.setIntakeExtend(false); | ||
} | ||
manipulation.setIntakeSpin(operator.getYButton()); | ||
manipulation.setIndexLoad(operator.getXButton()); | ||
} | ||
|
||
logger.log(); | ||
logger.writeLine(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"fileName": "REVLib.json", | ||
"name": "REVLib", | ||
"version": "2022.1.1", | ||
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", | ||
"mavenUrls": [ | ||
"https://maven.revrobotics.com/" | ||
], | ||
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib.json", | ||
"javaDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-java", | ||
"version": "2022.1.1" | ||
} | ||
], | ||
"jniDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-driver", | ||
"version": "2022.1.1", | ||
"skipInvalidPlatforms": true, | ||
"isJar": false, | ||
"validPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxaarch64bionic", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxraspbian", | ||
"osxx86-64" | ||
] | ||
} | ||
], | ||
"cppDependencies": [ | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-cpp", | ||
"version": "2022.1.1", | ||
"libName": "REVLib", | ||
"headerClassifier": "headers", | ||
"sharedLibrary": false, | ||
"skipInvalidPlatforms": true, | ||
"binaryPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxaarch64bionic", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxraspbian", | ||
"osxx86-64" | ||
] | ||
}, | ||
{ | ||
"groupId": "com.revrobotics.frc", | ||
"artifactId": "REVLib-driver", | ||
"version": "2022.1.1", | ||
"libName": "REVLibDriver", | ||
"headerClassifier": "headers", | ||
"sharedLibrary": false, | ||
"skipInvalidPlatforms": true, | ||
"binaryPlatforms": [ | ||
"windowsx86-64", | ||
"windowsx86", | ||
"linuxaarch64bionic", | ||
"linuxx86-64", | ||
"linuxathena", | ||
"linuxraspbian", | ||
"osxx86-64" | ||
] | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong lexicographical order for 'edu.wpi.first.wpilibj.DoubleSolenoid.Value' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'.