Added overrides for canandcoder, falcon/talonfx for encoder pulse per rotation configuration option.

This commit is contained in:
thenetworkgrinch
2023-08-09 16:20:15 -05:00
parent f88fdfb6cf
commit de4e35db62
3 changed files with 30 additions and 3 deletions

View File

@@ -169,4 +169,24 @@ public class DeviceJson
throw new RuntimeException(
"Could not create absolute encoder from data port of " + type + " id " + id);
}
/**
* Get the encoder pulse per rotation based off of the encoder type.
*
* @param angleEncoderPulsePerRotation The configured pulse per rotation.
* @return The correct pulse per rotation based off of the encoder type.
*/
public int getPulsePerRotation(int angleEncoderPulsePerRotation)
{
switch (type)
{
case "canandcoder":
return 360;
case "falcon":
case "talonfx":
return 2048;
default:
return angleEncoderPulsePerRotation;
}
}
}