So far I have gotten my robot tuned to stand for long periods of time, but out of 8 potentiometers, one of them is read in a manner that bugs out.
While holding the arm in position, it holds a steady value of the following:
But randomly, there’s occasional spikes that lead to the value becoming extremely incorrect, just causing the robot to collapse while trying to hold itself up:
Even after replacing the potentiometer, this still occurs at the 3 wire port. Is there any possibility for this to happen? It doesn’t occur with any other 3 wire port.
I tried to smoothen out the potentiometer by using the motors, and using the potentiometer as a homing device every 100 miliseconds, where the motor’s position will creep over 1 degree towards the potentiometer’s value every 100 miliseconds. But even with that the robot continues to have occasional disruptions from the potentiometer’s incorrect value as seen in the time lapse, and almost falls over due to this random disruption although a minute one but can be catastrophic:
To me this looks like the behavior of a broken potentiometer or loose wire, though you said you replaced it and continued to see the issue, so I’m not sure what to think. Have you tried simply swapping what port that potentiometer is plugged in to with another, working potentiometer?
Thank you for the suggestion! That may be very useful even in general, but I don’t know how to code the filter. If you know how to code it, I would love it if we can start another thread about that. But for the meantime I am trying to see how I can fix this problem without a form of prediction/average system.
Port C is the one with the random noise, but I took a video to show that the potentiometer never exceeds its range of motion so I am unsure how if could be broken when its out of the box.
Ill see if swapping the port works, or perhaps swapping the brain entirely.
From what I have seen, this is pretty common behavior for vex potentiometers. Even right out of the box, some just behave like this. Like others have said, you could try looking for a more reliable potentiometer, but you would probably have to test several of them.
I ran into a similar issue with the potentiometer on my tray angler. In this thread, I outlined the internal differences between an internal encoder and a potentiometer. I came to the conclusion that each sensor provides its own unique advantages and disadvantages. I came up with a solution that took advantage of each sensor’s input for more reliability.
Another conclusion of my experiment was the non-linearity of the potentiometer. Meaning if you turn a potentiometer θ degrees between
a and b and then φ degrees between c and d. θ and φ might be the same, but the difference between a->b and c->d would be very different. If you did the same experiment with the internal encoder the difference between a->b and c->d would be the same since encoder counts are designed to be equally spaced. Furthermore, the non-linearity is not uniform between each potentiometer, so that could explain why you see such large disruptions.
Maybe you could try using the delta in the internal encoder’s position to estimate the truth of the potentiometer value? If the internal encoder barely moves, but the potentiometer reads a huge difference then you know one of them is giving false values. Using the potentiometer to home the internal encoders is a good idea (it is what I used for my tray too), but could you try an alternative approach depending on the truth value of the sensors.