My motor gets to desired position with a specific button, then we click another button, the it retracts, after that the motor seems to overheat. I am using encoders in both areas.
One idea was to set a position tolerance for both the codes.
Another idea was to reset the targets position within those codes to zero. If I do that will it cause a problem with the other sections of my code that uses that motor also?
If your motor is getting hot, it has stalled.
This means that it’s running at high power and it can’t move because it’s hard up against a mechanical stop. So all the power goes into heat.
You need to ENSURE that you stop the motor before it hits a hard stop, or immediatly once it’s stopped…
If you are using RUN_TO_POSITION then you need to adjust the target position so the arm can reach to it before it hits anything.
If you are using RUN_USING_ENCODER then you need to monitor the encoder position yourself andreduce the power to zero (or close to 0) before you hit anything.
To help with this, you should use telemetry to display the current motor power and position.
Another way to stop from stalling the motor is to add a touch sensor to the end stop so when the arm hits the touch sensor it stop the motor.
Another idea is to just set the motor power to zero whenever it’s in the “home” position. This way, most of the time, the power will be off.
I love the new idea… I am going to work on all the three possible solutions and find out what worked or not…
I am using it on a viperslide and it is not fully extended I am wondering and it gets retracted when we are bringing it back to the home position. I did not think about setting it to zero and then activating it when called up.