allwpilib
allwpilib copied to clipboard
Improvements to DCMotorSim and SingleJointedArmSim
This PR does the following
- Renames DCMotorSim to AngularMechanismSim. I'm not opposed to other options. This serves as a base class for mechanisms with both angular position and velocity states.
- AngularMechanismSim provides all of the same overloads that were added to FlywheelSim in this PR along with their positional counterparts.
- SingleJointedArmSim inherits from AngularMechanismSim to save on method duplication.
- Both classes have only one constructor.
- SingleJointedArmSim now works for alternative pivot positions not just the end of the arm.
- SingleJointedArmSim now provides methods for setting position and velocity independently, getting the arm length, getting the pivot point, getting the arm's mass.
- LinearSystemID has been modified to provide methods for creating the plants needed for both of these classes along with some duplication removal.
Items to check/get feedback on.
- Should I remove estimateMOI from SingleJointedArmSim or modify it?
- The arm tests are failing with actual values somewhat close to their expected value, but not close enough. I'm not sure how to fix.
- EDIT: The arm tests are working. I noticed that the comments in the ArmSimulation example didn't have the correct values as listed in the Constants file. I corrected the comments.