allwpilib icon indicating copy to clipboard operation
allwpilib copied to clipboard

Improvements to DCMotorSim and SingleJointedArmSim

Open narmstro2020 opened this issue 3 months ago • 3 comments

This PR does the following

  1. 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.
  2. AngularMechanismSim provides all of the same overloads that were added to FlywheelSim in this PR along with their positional counterparts.
  3. SingleJointedArmSim inherits from AngularMechanismSim to save on method duplication.
  4. Both classes have only one constructor.
  5. SingleJointedArmSim now works for alternative pivot positions not just the end of the arm.
  6. SingleJointedArmSim now provides methods for setting position and velocity independently, getting the arm length, getting the pivot point, getting the arm's mass.
  7. 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.

  1. Should I remove estimateMOI from SingleJointedArmSim or modify it?
  2. 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.
  3. 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.

narmstro2020 avatar May 25 '24 02:05 narmstro2020