-
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
Omer elevator #7
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.
- There is some lack of documentation in the code, make sure to complete it.
- There is a bunch of code that was deleted in this branch, i.e. gripper
code. Why is that?- Also, there is diff in this branch that is unrelated to it, i.e. changes to Gradle files. These changes aren't related to the elevator, so they should be made in another branch.
- There are a few unused
import
s in the code, delete them. Also, run Ctrl+Alt+L on your code (which will also optimize yourimport
s 🙃).
Good luck! I'm here for any questions 🙂
public static final double kI = 0; | ||
public static final double kD = 0; | ||
public static final double kF = 0; | ||
public static final double RADIUS = 0.66; |
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.
Radius of what?
public static class Gripper { | ||
public static final int LEFTMOTOR = 0; | ||
public static class Elevator { | ||
public static final int motor = 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.
Why did you delete gripper constants?
private final UnitModel unitModel = new UnitModel(Constants.Elevator.TICKS_PER_METER); | ||
private static Elevator INSTANCE = null; | ||
private Elevator(){ | ||
motor.setInverted(TalonFXInvertType.Clockwise); |
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.
Shouldn't that be a constant?
public static final double kI = 0; | ||
public static final double kD = 0; | ||
public static final double kF = 0; | ||
public static final double RADIUS = 0.66; |
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.
Radius of what?
public static class Gripper { | ||
public static final int LEFTMOTOR = 0; | ||
public static class Elevator { | ||
public static final int motor = 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.
Why did you delete gripper constants?
} | ||
|
||
public double getheight(){ | ||
return unitModel.toUnits(motor.getSensorCollection().getIntegratedSensorPosition()); |
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.
You can simply use getSelectedSensorPosition()
:
return unitModel.toUnits(motor.getSensorCollection().getIntegratedSensorPosition()); | |
return unitModel.toUnits(motor.getSelectedSensorPosition()); |
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
import frc.robot.subsystems.elevator.Elevator; | ||
|
||
public class Height extends CommandBase { |
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 need to start with a verb.
@Override | ||
public boolean isFinished() { | ||
return Math.abs( elevator.getheight() - height); | ||
} | ||
} |
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.
A few unrelated notes:
isFinished()
need to return aboolean
, butMath.abs
returns adouble
in this case.TalonFX.getClosedLoopError()
can quite help you here 🙂.isFinished()
should come beforeend()
.
omer elevator