We used the code of the Talon CAN rpm to reach a certain rpm every time but having a problem to check if the rpm is stable. We programmed a block that check’s if the rpm is stable for 4 times( with a clearance of ±100) but were wondering if there’s a better for doing this check?
Thanks in advance!
The big question is whether four queries is enough to demonstrate stability. Plot the curves of your motor speed response over time to determine whether your system is underdamped (oscillates, though eventually converges) or critically or overdamped (does not oscillate). If you are critically or overdamped, your plan is proably adequate. If your system oscillates, measure the period of that oscillation (in terms of feedback counts), and make sure that your stability criterion includes at least that many samples.
I am almost 100% certain your motor speed will NOT be stable. Especially when a different battery is put in your robot.
You are better off varying motor power to “maintain” a speed corridor.
From this, I understand that they are using the internal PID of the Talon to maintain speed, not depending on a voltage setting: