Last active
May 26, 2020 03:47
-
-
Save aakatz3/cccd9525368af92ff7fedbdda305015f to your computer and use it in GitHub Desktop.
Motor encoder constants for FTC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.firstinspires.ftc.teamcode; | |
/** | |
* Created by Andrew A. Katz on 12/9/2016. | |
* Updated 10/2/2019 to finally change to doubles, and to make everything units | |
* of CPR. PPR can be derived by multiplying by 4. | |
* Helper class that contains encoder data for various motors allowed by FTC. | |
* Contains motors from AndyMark, Pitsco, ModernRobotics, and Rev Robotics. | |
*/ | |
@SuppressWarnings("unused") | |
public final class Motors { | |
public static final int PPR_TO_CPR_RATIO = 4 / 1; | |
public static final double ANDYMARK_UNGEARED_CPR = 7; | |
public static final double ANDYMARK_20_CPR = 560; | |
public static final double ANDYMARK_40_CPR = 1120; | |
public static final double ANDYMARK_60_CPR = 1680; | |
public static final double ANDYMARK_3_7_CPR = 44.4; | |
public static final double TETRIX_CPR = 1440; | |
public static final double REV_HD_HEX_CPR = 2240; | |
public static final double MODERNROBOTICS_MATRIX_12V_CPR = 1478.4; | |
} |
Also, clearly some motors have fractional CPR.
Why not use doubles throughout to maintain accuracy?
truncating 44.4 to 44.0 is a 1 % error.
I'm a big one for consistency...
Any reason why you used PPR on the ungeared motor vs CPR ??
I know its been 3 years but:
for PPR vs CPR: there was not CPR data available at that time, for the motor without the gearbox. I felt it more useful to have the data than not.
As for the doubles vs ints, you are right, they should be doubles. I think it is because I was down casting and because none of the motors we had were affected, as we didn't have the 3:7 or the modern robotics motors. The decimals were included more for documentation than any other reason.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm a big one for consistency...
Any reason why you used PPR on the ungeared motor vs CPR ??