Closed GalexY727 closed 1 year ago
Would this be a good idea? We are already using index in a lot of other parts of our code, why should we switch to use variables instead? Many different parts of our code use the index, changing the constants would break several things in different files.
What is trying to be said here is that instead of having 'hard coded' values, such as:
public static final double[] PLACEMENT_SPEEDS_BACK = {
// Low | Index 0
-0.15,
// Mid | Index 1
-0.24,
// High | Index 2
-0.4,
// Reset | Index 3
0.0
};
instead, write the function like:
public static final double LOW_PLACEMENT_BACK = 270 + 0;
public static final double MID_PLACEMENT_BACK = 270 - 44;
public static final double HIGH_PLACEMENT_BACK = 270 - 54;
public static final double RESET_PLACEMENT_BACK = 78;
public static final double[] PLACEMENT_POSITIONS_BACK = {
LOW_PLACEMENT_BACK,
MID_PLACEMENT_BACK,
HIGH_PLACEMENT_BACK,
RESET_PLACEMENT_BACK
};
sorry for any confusion this post may have caused
With the addition of shooting forward and backward, we now need to do some more organizing in our PlacementConstants class. I recommend taking all of the values inside of the arrays in placement constants and extracting them into their own value, similar to how Jerome's Arm Indices worked.
Example:
If we wanted to hard code in a automatic pivot stow mechanic (#2), instead of saying
we could simply write
please note that PLACEMENT_POSITIONS,SPEEDS,TIMES,etc are not being removed, they are just changing from a low level storage environment to a step above in abstraction.
i.e.
💃