![]() |
PWM to velocity?
One more question about the encoder module..
I couldn't find the actual python code anywhere online... We have been able to set up the PID module for the power to each motor. The joysticks decide the value to be reached and the pwm values change until that value is reached. Our next task is how to use a velocity target value and connect that to the motor output (based on the error velocity value). We plan on doing this using potentiometers to determine the velocity...can anyone help us on somehow reaching the target velocity by altering the pwm output on the motors? |
Re: Adams Coprocessor Solution
I'll scour around for some of the old encoder modules, although I don't recommend you use them just yet.
You intend to use potentiometers to figure out velocity? I would recommend that you use encoders to control velocity, as potentiometers deal more with position. However, if you would still like to use potentiometers, Post again and I can walk you through code to do so. Also, for reference, that application of PID is not terribly useful in any real application, although it is fine to test that PID functions. This is because to use a PID loop here is to match joystick output to voltage, which is already perfectly responsive. To add a PID loop only lowers this responsiveness. A more appropriate use of PID would be to match joystick input to velocity output on the motors given by encoders. In this way, you could move the joystick to a position to attain a given velocity, meaning even if there is some resistance against your robot, the PID loop would compensate for it (less driver control). |
Re: Adams Coprocessor Solution
Thank you for the tip about the encoders.
We decided to match the joystick to the voltage only temporarily to test the PID loop, and until we had a way of measuring the velocity of the wheels. Our main problem is this: Once we have a set velocity based on the joystick, by how much do we increment the pwm to each motor to reach this velocity? The PID loop will tell us the error in the velocity and the correction value in terms of velocity right? How do we translate this in terms of change in pwm to each motor? |
| All times are GMT -5. The time now is 23:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi