Skip to content

Conversation

@TheBitEffect
Copy link
Contributor

@TheBitEffect TheBitEffect commented Apr 8, 2022

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

  • Remove whatever-the-heck that autonomous is and replace it with whatever-the-heck we have now!
  • Reimpliment our own climber back into the code! (Hopefully should just be uncommenting code and testing it.)
  • Remove shooter code! (Shooter? What shooter?)
  • ...and much, much more! (from looking at the code, that might actually be it)

@RAR1741/students, if you want to work on this, feel free to assign yourself and get to work!

espmancer and others added 30 commits January 15, 2022 16:23
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>
@TheBitEffect TheBitEffect self-assigned this Apr 8, 2022
@codecov
Copy link

codecov bot commented Apr 8, 2022

Codecov Report

Merging #26 (ff3a96a) into master (2c8045c) will decrease coverage by 1.38%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
src/main/java/frc/robot/Autonomous.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/BoostInput.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/Climber.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/ClimberGates.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/ClimberSensors.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/DriveModule.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/Drivetrain.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/Manipulation.java 0.00% <0.00%> (ø)
src/main/java/frc/robot/Robot.java 0.00% <0.00%> (ø)
... and 1 more

Impacted file tree graph

climberSolenoidB1.set(true);
climberSolenoidB2.set(false);
climberSolenoidC.set(true);
// if (climbingMotor.getStatorCurrent() > NEXT_AB_STATE_CURRENT

Choose a reason for hiding this comment

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

This block of commented-out lines of code should be removed.

manipulation.setIntakeExtend(false);
}
manipulation.setIntakeSpin(operator.getYButton());
// manipulation.setIndexLoad(operator.getLeftTriggerAxis() > 0.5);

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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;

Choose a reason for hiding this comment

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

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;

Choose a reason for hiding this comment

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

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;

Choose a reason for hiding this comment

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

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;

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 edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;

import com.revrobotics.CANSparkMax;

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 edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;

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

import edu.wpi.first.wpilibj.DoubleSolenoid.Value;

import 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 com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;

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'

* @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 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);

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

* @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.


public class ClimberSensors implements Loggable {
DigitalInput a1, a2, b1, b2, c1, c2;
DigitalInput b1, b2;

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

TODO found


private double motorSpeed;

private double previousTime;

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

This block of commented-out lines of code should be removed.

// this.setSpeed(0);
// }

// if (touch.getB()) {

Choose a reason for hiding this comment

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

This block of commented-out lines of code should be removed.

climberSolenoidB2.set(false);
climberSolenoidC.set(true);
// if (gates.getB1()) {
// if (!gates.getB1()) {

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

TODO found

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

Choose a reason for hiding this comment

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

TODO found

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit ff3a96a and detected 42 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 7
Clarity 17
Bug Risk 3
Style 12

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants