Hello, any idea how to lock a dc motor when I attend a desired height in a lifting system?
You will need a PID program to hold the lift at the desire height.
And that also means you will need a potentiometer or encoder for that too
If you are thinking of shorting the positive and negative connections together, be aware that that is not programmatically possible with VEX electronics.
Just send around 15 power up.
You could build a simple DIY solenoid using Vex parts and have it lock the lifting system while keeping the motor turned off or stopped.
There is no way to lock a Motor in vex. Instead you will have to 1. Use a PID loop (better, but complicated) or 2. Apply ~15 motor power in the opposite direction of the force applied, in this case 15 motor power up (not as good, but very simple).
You can also use a Vex worm gear drive along with standard Vex gears. It automatically locks into its current position when the motor has stopped.
I do not know much about it but according my son, PID or even just P control will do it. PID is proportional, integral, and derivative. There is a lot of information on the forum about how to do it.
Indeed. For locking lift height the code is very simple with only the proportional component of a PID loop.
float constant = 0.02; int error = actual-desired //usually would do desired-actual with a negative constant //but this is easier to understand int motorSpeed = constant * error;
The larger the error, the higher the speed, the hard part is tuning the constant, which can be achieved with some trial/error when you only have the P and not the ID.
Simply change desired in your button control (add or subtract value), and actual is the readout from your potentiates or encoders on the lift. There are plenty of other forum posts on PID/P loops but thats just a quick explanation.
P is a good suggestion, although remember that using P only from a PID+C will, by definition, always give you some location error in your arm. This may be fine, or tuned out depending upon the repeatability of your load, it just depends upon your application and whether you are using it in auton or driver (i.e. a human can fix it)