Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions src/main/java/frc/robot/Manipulation.java
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;

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'.


import com.revrobotics.CANSparkMax;

Choose a reason for hiding this comment

The 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'.

Choose a reason for hiding this comment

The 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;

Choose a reason for hiding this comment

The 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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra separation in import group before 'frc.robot.logging.Loggable'

Choose a reason for hiding this comment

The 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;

Choose a reason for hiding this comment

The 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;

/**

Choose a reason for hiding this comment

The 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) {

Choose a reason for hiding this comment

The 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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is longer than 100 characters (found 131).


intakeWheel.setInverted(true);
}

/**

Choose a reason for hiding this comment

The 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;
}

/**

Choose a reason for hiding this comment

The 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);
}
/**

Choose a reason for hiding this comment

The 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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'METHOD_DEF' should be separated from previous statement.

Choose a reason for hiding this comment

The 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);
}

}
20 changes: 20 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,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.
Expand All @@ -39,6 +42,13 @@ public void robotInit() {
driver = new LoggableController("Driver", 0);
operator = new LoggableController("Operator", 1);

if (manipulationEnabled) {
System.out.println("Initializing manipulation...");

Choose a reason for hiding this comment

The 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.");

Choose a reason for hiding this comment

The 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();

Expand Down Expand Up @@ -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();
}
Expand Down
73 changes: 73 additions & 0 deletions vendordeps/REVLib.json
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"
]
}
]
}