Added Test and Additional methods to AnglerSubsystem#43
Added Test and Additional methods to AnglerSubsystem#43Sahiltheram wants to merge 9 commits intomainfrom
Conversation
| angler.runToReverseLimit(); | ||
| if (angler.isAtReverseLimit()) { | ||
| angler.resetEncoderToZero(); | ||
| finished = true; |
There was a problem hiding this comment.
We should probably have a timeout of 5 seconds(?) to prevent this from hanging forever if the switch is broken
| public static final double ANGLER_LOW_ROTATIONS = -50; //Lowest position of Angler | ||
| public static final double ANGLER_HIGH_ROTATIONS = 50; //Highest position of Angler | ||
| public static final double ANGLER_FIXED_ROTATIONS = 0.1; //Fixed position of Angler in Fixed ShootState | ||
| public static final double ANGLER_HOME_ROTATIONS = 0.0; |
There was a problem hiding this comment.
These comments should not have been removed.
| public static final double ANGLER_ENCODER_LOW = 0; | ||
| public static final double ANGLER_ENCODER_HIGH = 100; | ||
| public static final double ANGLER_ANGLE_LOW = 0; | ||
| public static final double ANGLER_ANGLE_HIGH = 45; |
There was a problem hiding this comment.
We should have comments about these constants as well
|
|
||
| /** | ||
| * Gets the desired Angle Position and uses a PID controller to get the motor there | ||
| */ |
There was a problem hiding this comment.
Add comment about the units the angle is expected to be (@param...)
| * Drive toward the forward limit switch and stop once it is pressed. | ||
| * Call this repeatedly from a command while homing. | ||
| */ | ||
| public void runToForwardLimit() { |
There was a problem hiding this comment.
The way this method is written, it is expecting to be called in a loop until the switch is hit - if it only called once, the motor will run forever (well, it will run until the limit switch is hit and the hardware stops the motor).
In this case, I think it is better to just use a "run forward" method, since you rely on the command to repeatedly check the switch and end when it is hit. Sorry if I caused you to do extra work here.
Same for the other method below.
| private double calculate(double angle) { | ||
| return AnglerSubsystem.calculateRotationsForAngle( | ||
| angle, | ||
| Constants.ANGLER_ENCODER_HIGH, |
There was a problem hiding this comment.
This would break when the constants change, so you should hardcode test values that will not change with the constants to separate the test code from the real ones.
No description provided.