-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
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.
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; | |||
} | |||
|
|||
} |
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.
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); |
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.
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; |
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.
Add Units
/* | ||
* @param value | ||
* @return | ||
*/ |
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.
Delete lines.
motor.set(ControlMode.Position, unitModel.toTicks(pos)); | ||
} | ||
|
||
} |
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.
Cntrl + alt + l
|
||
@Override | ||
public void end(boolean interrupted) { | ||
elevator.setPower(0); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return Math.abs(elevator.getPosition() - height) <= Constants.Elevator.OFFSET; |
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.
Put isFinished() before end().
@Override | ||
public void initialize () { | ||
} | ||
|
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.
Delete lines
elevator.setPower(0); | ||
} | ||
} | ||
|
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.
Cntrl+alt+l
} | ||
|
||
/** | ||
<<<<<<< HEAD |
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.
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; |
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.
The order, IMO, should be:
- elevator instance
- blank line
- motor
- unit model
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.
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 🙂
/** | ||
* get power | ||
* @return | ||
*/ | ||
public double getPower () { | ||
return motor.get(); | ||
} |
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.
Is this method needed?
* @param value | ||
* @return |
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.
Document value
and and the return value.
* @param value | ||
* @return | ||
*/ | ||
public double getDeadband ( double value){ |
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.
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) { |
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.
Command names should start with a verb.
@@ -1,4 +1,4 @@ | |||
package frc.robot.subsystems; | |||
package frc.robot.subsystems.Elevator; |
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.
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 🙂.
public double toVelocity(double ticks100ms) { | ||
return (ticks100ms / ticksPerUnit) * 10; | ||
} | ||
|
||
public int toTicks100ms(double velocity){ | ||
public int toTicks100ms(double velocity) { |
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.
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.
public static final Boolean VOLT = true; | ||
public static final int SAT = 12; |
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.
These contants names aren't clear, please find more meaningful names.
Create height, Joysticpower commands