Hello all, my team just finished up mech on our offseasion bot and have handed it off to programming. This robot includes a TalonFX powered elevator we were hoping to control with motion magic. However, this has it a few major snags I hope the kind people of CD will be able to help us with.
-
It moves as I would expect (ish), until it gets to about 80% of its goal height, then, instead of continuing or even maintaining that height, it simply stops resisting and falls back down, before halting at constant (same each time) but seemingly random height every time and simply stalling there, with no obvious reason.
-
To make sure it reads the correct height, we attempted to use the set height on trigger function for the motor’s limit switches, but found that this for some reason this stopped motion magic from running while the limit switch was triggered. This issue did not persist when the on-controller set height function was disabled.
Our code for the elevator can be found here
Thank you all in advance!
Not sure if this is the problem, but a couple of seasons ago we had an issue where the arm we were driving with motion magic would reach a speed and then move erratically. After some debug, we found that the values we were using for kf and kp would cause the calculation within the controller to exceed 1023 when trying to achieve the velocity specified in the motion magic profile. We went back and corrected those values and got the nice predictable behavior we were looking for. You have probably been looking at this, but in case you haven’t, here is the link to the CTRE closed loop control documentation: Motor Controller Closed Loop — Phoenix documentation
1 Like
Unfortunately the cause you describe seems to be phoenix 5 specific, phoenix 6 uses an entirely diffrent scale that directly outputs voltage or duty cycle values. The max output we observed tended to be <0.2 duty cycle.
1 Like
In Phoenix Tuner, you should be able to see the target position, actual position, target velocity, and error plotted over time.
I’d recommend checking out that graph as you move your elevator and see if that gives you any clues to go off of.
From your description, it’s hard to tell if the issue lies in your PIDF values, motion magic configuration, or sensor configuration
so, we got the pidf working quite well, negating issue one, however the limit switch behavior still persists
If your still having this issue, reaching out to CTRE support at [email protected] or calling them via the number here Contact Us during the hours listed has always worked for to get issues (even if they’re on my end) figured out quickly.