I’m having an issue with simulating an arm mechanism on my team’s robot code. I’m using Phoenix 6 with a trapezoid motion profile to provide PID control and a SingleJointedArmSim to simulate movement. Whenever I set the setpoint of the arm to, say, 100 degrees, it only moves to a fraction of that setpoint.
The ratio does not remain consistent however. Here’s some data I gathered on it:
Setpoint | Actual | Ratio |
---|---|---|
100 | 27 | 3.703 |
150 | 41 | 3.658 |
200 | 48 | 4.166 |
400 | 105 | 3.809 |
600 | 150 | 4.000 |
1000 | 180 | 5.555 |
Because of this I’ve set a temporary 4x multiplier on each of the setpoints when grabbing them from the arm constants, but once you remove it the problem reappears.
My code is linked here:
https://github.com/4201VitruvianBots/Crescendo2024/blob/main/src/main/java/frc/robot/subsystems/Arm.java
I’m not sure whether the problem is due to my simulation code or the primary code since we don’t have the arm mechanism fully wired yet.
Steps to reproduce the problem:
- Simulate the repository
- Connect to controller port 2
- Press and hold “V” on the keyboard (this will activate the arm setpoint)
- Compare the setpoint and actual position under network tables in AdvantageKit/RealOutputs/Arm