Merge first (and second) competition code into master#26
Conversation
Climbing plan made just need to code it
Solenoid staging, climbing states, and sensors and motor IDs added
Staging added.
Co-authored-by: theblindbandet <theblindbandet@users.noreply.github.com>
Co-authored-by: theblindbandet <theblindbandet@users.noreply.github.com> Co-authored-by: ultragamer1010 <sreeves750@gmail.com> Co-authored-by: HungryIronApple <hungryironapple@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
===========================================
- Coverage 9.63% 8.25% -1.39%
Complexity 17 17
===========================================
Files 18 20 +2
Lines 685 800 +115
Branches 47 50 +3
===========================================
Hits 66 66
- Misses 619 734 +115
|
| climberSolenoidB1.set(true); | ||
| climberSolenoidB2.set(false); | ||
| climberSolenoidC.set(true); | ||
| // if (climbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| manipulation.setIntakeExtend(false); | ||
| } | ||
| manipulation.setIntakeSpin(operator.getYButton()); | ||
| // manipulation.setIndexLoad(operator.getLeftTriggerAxis() > 0.5); |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| */ | ||
| public void arcadeDrive(double turnInput, double speedInput) { | ||
| speedInput = | ||
| climbMode ? speedInput * 0.3 : speedInput + (autoBalanceEnabled ? balanceScale : 0); |
There was a problem hiding this comment.
Extract this nested ternary operation into an independent statement.
| * @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.
This block of commented-out lines of code should be removed.
| */ | ||
| Manipulation(int pneumaticsForwardChannel, int pneumaticsReverseChannel, int intakeWheelID) {//, int indexLoadID) { | ||
| this.intakeWheel = new CANSparkMax(intakeWheelID, MotorType.kBrushless); | ||
| // this.indexLoad = new CANSparkMax(indexLoadID, MotorType.kBrushless); |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| private final double SHIFT_CURRENT_LOW = 0; | ||
| private final double SHIFT_VELOCITY = 0; // Wheel velocity | ||
| private final double OFF_BALANCE_THRESHOLD = 10; | ||
| private final double ON_BALANCE_THRESHOLD = 5; |
There was a problem hiding this comment.
Member name 'ON_BALANCE_THRESHOLD' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
| public class DriveModule implements Loggable { | ||
|
|
||
| private final double VELOCITY_COEFFICIENT = 600 / 2048; | ||
| private final double MAX_VELOCITY = 22000; |
There was a problem hiding this comment.
Abbreviation in name 'MAX_VELOCITY' must contain no more than '2' consecutive capital letters.
| public class DriveModule implements Loggable { | ||
|
|
||
| private final double VELOCITY_COEFFICIENT = 600 / 2048; | ||
| private final double MAX_VELOCITY = 22000; |
There was a problem hiding this comment.
Member name 'MAX_VELOCITY' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
|
|
||
| import edu.wpi.first.wpilibj.DoubleSolenoid; | ||
| import edu.wpi.first.wpilibj.PneumaticsModuleType; | ||
| import edu.wpi.first.wpilibj.DoubleSolenoid.Value; |
There was a problem hiding this comment.
Wrong lexicographical order for 'edu.wpi.first.wpilibj.DoubleSolenoid.Value' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'.
| import edu.wpi.first.wpilibj.PneumaticsModuleType; | ||
| import edu.wpi.first.wpilibj.DoubleSolenoid.Value; | ||
|
|
||
| import com.revrobotics.CANSparkMax; |
There was a problem hiding this comment.
Extra separation in import group before 'com.revrobotics.CANSparkMax'
| import edu.wpi.first.wpilibj.PneumaticsModuleType; | ||
| import edu.wpi.first.wpilibj.DoubleSolenoid.Value; | ||
|
|
||
| import com.revrobotics.CANSparkMax; |
There was a problem hiding this comment.
Wrong lexicographical order for 'com.revrobotics.CANSparkMax' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'.
| import edu.wpi.first.wpilibj.DoubleSolenoid.Value; | ||
|
|
||
| import com.revrobotics.CANSparkMax; | ||
| import com.revrobotics.CANSparkMaxLowLevel.MotorType; |
There was a problem hiding this comment.
Wrong lexicographical order for 'com.revrobotics.CANSparkMaxLowLevel.MotorType' import. Should be before 'edu.wpi.first.wpilibj.PneumaticsModuleType'.
| import com.revrobotics.CANSparkMax; | ||
| import com.revrobotics.CANSparkMaxLowLevel.MotorType; | ||
|
|
||
| import frc.robot.logging.Loggable; |
There was a problem hiding this comment.
Extra separation in import group before 'frc.robot.logging.Loggable'
| * @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.
Line is longer than 100 characters (found 119).
| Manipulation(int pneumaticsForwardChannel, int pneumaticsReverseChannel, int intakeWheelID) {//, int indexLoadID) { | ||
| 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.
Line is longer than 100 characters (found 131).
| * @param load True if it should load; false if not | ||
| * | ||
| */ | ||
| public void setIndexLoad(boolean load) { |
There was a problem hiding this comment.
'METHOD_DEF' should be separated from previous statement.
|
|
||
| public class ClimberSensors implements Loggable { | ||
| DigitalInput a1, a2, b1, b2, c1, c2; | ||
| DigitalInput b1, b2; |
There was a problem hiding this comment.
Each variable declaration must be in its own statement.
|
|
||
| // ClimberSensors climberSensors = new ClimberSensors(0, 1, 2, 3, 4, 5); | ||
| ClimberGates climberGates = new ClimberGates(6, 7, 8, 9, 10, 11, 12, 13); | ||
| climberSensors = new ClimberSensors(0,0); // TODO: Add sensors and input ids |
Maybe nestable loggables will be a thing someday. Doubt it though, sendables exist now
…into first-comp
|
|
||
| private double motorSpeed; | ||
|
|
||
| private double previousTime; |
There was a problem hiding this comment.
Remove this unused "previousTime" private field.
| System.out.println("--------HIT MAX CURRENT--------"); | ||
| } | ||
| // // Make sure we're not pulling too much current instantly | ||
| // if (climbingMotor.getStatorCurrent() > MAX_INSTANT_CURRENT |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| setClimbingState(ClimbingStates.ERROR); | ||
| } | ||
| // // Make sure we're not pulling too much current over time | ||
| // if (leftFilter.get() > MAX_AVERAGE_CURRENT || rightFilter.get() > MAX_AVERAGE_CURRENT) { |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| // this.setSpeed(0); | ||
| // } | ||
|
|
||
| // if (touch.getB()) { |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| climberSolenoidB2.set(false); | ||
| climberSolenoidC.set(true); | ||
| // if (gates.getB1()) { | ||
| // if (!gates.getB1()) { |
There was a problem hiding this comment.
This block of commented-out lines of code should be removed.
| // climberSolenoidB2.set(false); | ||
| // climberSolenoidC.set(true); | ||
| // // this.setPower(0); | ||
| // // TODO: set motor target here |
| ClimberGates climberGates = new ClimberGates(6, 7, 8, 9, 10, 11, 12, 13); | ||
| climber = new Climber(9, 10, climberSolenoidA, climberSolenoidB1, climberSolenoidB2, | ||
| climberSolenoidC, climberGates);// ,gyro, climberSensors); | ||
| // climberSensors = new ClimberSensors(0, 0); // TODO: Add sensors and input ids |
|
Code Climate has analyzed commit ff3a96a and detected 42 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 0.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 8.2% (-1.4% change). View more on Code Climate. |
Congratulations! We've managed to stress-test the code at not only one, but two competitions! Stable code that's been tested on the robot is usually merged into the master branch, but code written mere moments before a match might not be the most stable it could be. There were also a few things we need to remove, as a few things were just thrown-together hacks that should probably get actual solutions.
Things we need to do! As far as I've been made aware...
@RAR1741/students, if you want to work on this, feel free to assign yourself and get to work!