[wpilib] Fix MOI calculation error in SingleJointedArmSim (#4968)

Previous calculation derivation mixed up length and distance to CG.
This commit is contained in:
Matt
2023-01-18 23:40:39 -05:00
committed by GitHub
parent 42c997a3c4
commit 27ba096ea1
8 changed files with 69 additions and 80 deletions

View File

@@ -54,8 +54,8 @@ public class Robot extends TimedRobot {
private final Joystick m_joystick = new Joystick(kJoystickPort);
// Simulation classes help us simulate what's going on, including gravity.
private static final double m_armReduction = 600;
private static final double m_armMass = 5.0; // Kilograms
private static final double m_armReduction = 200;
private static final double m_armMass = 8.0; // Kilograms
private static final double m_armLength = Units.inchesToMeters(30);
// This arm sim represents an arm that can travel from -75 degrees (rotated down front)
// to 255 degrees (rotated down in the back).
@@ -67,7 +67,6 @@ public class Robot extends TimedRobot {
m_armLength,
Units.degreesToRadians(-75),
Units.degreesToRadians(255),
m_armMass,
true,
VecBuilder.fill(kArmEncoderDistPerPulse) // Add noise with a std-dev of 1 tick
);