Skip to content
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

Jonathan #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Jonathan #6

wants to merge 8 commits into from

Conversation

lotan23
Copy link
Contributor

@lotan23 lotan23 commented Sep 9, 2022

Create height, Joysticpower commands

@lotan23 lotan23 requested a review from GaiaZano05 September 9, 2022 10:05
Copy link
Contributor

@GaiaZano05 GaiaZano05 left a comment

Choose a reason for hiding this comment

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

Graet job Jonathan!

@@ -22,6 +22,7 @@ public static final class Gripper {
public static final Boolean VOLT = true;
public static final int SAT = 12;
public static final double TICKS_PER_METER = 2048/(Math.PI*Math.PI*0.066/10);
public static final double OFFSET = 0.03;
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Cntrl+alt+l

@@ -22,6 +22,7 @@ public static final class Gripper {
public static final Boolean VOLT = true;
public static final int SAT = 12;
public static final double TICKS_PER_METER = 2048/(Math.PI*Math.PI*0.066/10);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add units

@@ -22,6 +22,7 @@ public static final class Gripper {
public static final Boolean VOLT = true;
public static final int SAT = 12;
public static final double TICKS_PER_METER = 2048/(Math.PI*Math.PI*0.066/10);
public static final double OFFSET = 0.03;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add Units

Comment on lines +58 to +61
/*
* @param value
* @return
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete lines.

motor.set(ControlMode.Position, unitModel.toTicks(pos));
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Cntrl + alt + l

Comment on lines +22 to +30

@Override
public void end(boolean interrupted) {
elevator.setPower(0);
}

@Override
public boolean isFinished() {
return Math.abs(elevator.getPosition() - height) <= Constants.Elevator.OFFSET;
Copy link
Contributor

Choose a reason for hiding this comment

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

Put isFinished() before end().

Comment on lines +16 to +19
@Override
public void initialize () {
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete lines

elevator.setPower(0);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Cntrl+alt+l

@lotan23 lotan23 requested a review from katzuv September 10, 2022 14:23
}

/**
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

This line should be deleted.


public class Elevator extends SubsystemBase {
private final WPI_TalonFX motor = new WPI_TalonFX(Ports.Elevator.MOTOR);
private static Elevator INSTANCE = null;
Copy link
Member

Choose a reason for hiding this comment

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

The order, IMO, should be:

  • elevator instance
  • blank line
  • motor
  • unit model

Copy link
Member

@katzuv katzuv left a comment

Choose a reason for hiding this comment

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

Great job! A few notes:

  • Command names should start with a verb.
  • There is some lack of documentation in the code, make sure to add it.
  • There is a bunch of code that was deleted in this branch, i.e. gripper code. Why is that?
  • There are some files here that are tracked which shouldn't be, i.e. files in the .idea directory. Read here to learn how to resolve this issue.

Good luck! I'm here for any questions 🙂

Comment on lines +35 to +41
/**
* get power
* @return
*/
public double getPower () {
return motor.get();
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this method needed?

Comment on lines +59 to +60
* @param value
* @return
Copy link
Member

Choose a reason for hiding this comment

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

Document value and and the return value.

* @param value
* @return
*/
public double getDeadband ( double value){
Copy link
Member

Choose a reason for hiding this comment

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

This method name is not clear. It sounds like it returns the deadband value, not the value after applying the deadbend on it.
But anyway, it seems to me you should use the Talon's deadbend functionality instead of implementing it by yourself.

private final double height;
private Elevator elevator;

public Height(double height, Elevator elevator) {
Copy link
Member

Choose a reason for hiding this comment

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

Command names should start with a verb.

@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.Elevator;
Copy link
Member

Choose a reason for hiding this comment

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

UnitModel shouldn't live in the eleavotr's package, because it's relevant to other subsystems in the robot as well. Return it to where it was before 🙂.

Comment on lines +18 to +22
public double toVelocity(double ticks100ms) {
return (ticks100ms / ticksPerUnit) * 10;
}

public int toTicks100ms(double velocity){
public int toTicks100ms(double velocity) {
Copy link
Member

Choose a reason for hiding this comment

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

These changes should be made in this branch, as they are not relevant to the eleavtor. You should delete them and move them to a different branch.

Comment on lines 22 to 23
public static final Boolean VOLT = true;
public static final int SAT = 12;
Copy link
Member

Choose a reason for hiding this comment

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

These contants names aren't clear, please find more meaningful names.

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.

3 participants