strongback / strongback-java

A library for FIRST Robotics Competition robots that makes it easier to write and test your robot code.
MIT License
41 stars 38 forks source link

Expose Talon SRX's internal encoder scaling. #101

Open agausmann opened 7 years ago

agausmann commented 7 years ago

While trying to implement closed-loop speed control on my Talon SRX, I found two methods that were of great use. CANTalon.configEncoderCodesPerRev() and CANTalon.configPotentiometerTurns() allow the user to provide the instance with an encoder resolution in common units. Delegating these would be able to replace the current scaling implementation that is provided by Strongback (pulses per degree). IMO this would be a preferred way of scaling encoder input, and I am not sure whether speed control would be feasible with the way that Strongback handles scaling right now.

agausmann commented 7 years ago

One thing we need to consider when making this change is whether Strongback should still provide measurements in degrees. The Gyroscope interface documentation explicitly states that its outputs are degrees and degrees per second, but the Talon's sensor and target I/O uses revolutions and RPM when a scale is provided by one of the methods outlined above.