We are starting to work with PIDs on our robot, and though we are using Neos for the shooter (so we will use the built-in PID), ultimately, we want to use Odometry for the drivetrain. So, I began with simple PIDF and KInematics to try to understand how these pieces fit together and ran into two questions about the 2020 implementation of the PID algorithm. One is specific to robotpy, the other is not.
- How do we implement the feedforward variable? I tried to import
edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward;(which is what the Java docs use) in python by doing…
$py >>>from wpilib.controller import SimpleMotorFeedforward
…but got a library not found error. I think I am using the most recent version of pyfrc because the Ramsete Controller imports fine. The new PID controller no longer supports kF on construction. Is there something else we should use?
- How do we “clamp” the outputs? We could use a simple if / then statement, or map, but I am wondering if there is a built-in function I am missing.