Hello! So I’m trying to find a method to stop motors from stalling within our program, but so far I am not so lucky. I have considered: P controller, and decreasing the motor power. I like the P controller method, but wouldn’t it let go of the object once the encoder stops spinning (claw is gripping)?
If you tell the gripper to close just a bit farther than it ic able to (due to an object being in the way), then the P constant will keep pressure on the claw, allowing you to hold objects without burning up your motor. You will have to find the right P value that is low enough not to overheat but high enough to keep a good grip, but it is totally possible.
The encoder truly doesn’t measure speed, it actually measures rotations by 360 degrees. If you want a wheel to turn one full rotation, you will tell the motor to go until the encoder reaches a value of 360.
In order to convert the encoder to RPM or speed, you will have to divide the encoder value by time. The encoder is rather more of an in-precise form of a potentiometer that can rotate infinitely both directions, as well as meant to handle faster rotation speeds.
Hopefully this helps