Volts over Percentage and questions with PID's?

Just two simple questions

  1. Is it better to use volts over percentage for motors, if so, why?
  2. When programming a PID, what sensors should I use to measure the motor error? Do I use a gyro for turn PIDs and something different for drive PIDs?
    Also, any other help/tips for building/programming/tuning a PID loop would be greatly appreciated.

Sincerely,
The Average Joes

I can only answer the first question. It is better to use voltage than a percentage velocity for motors if you want that motor to run at maximum speed. This is because using voltage will ensure the motor is always running at maximum power, whereas the velocity will use the motor’s built-in PID to hover around a maximum velocity.

Otherwise, I have an additional question that fits under this topic:

In VEXCode Blocks, the “Spin at Voltage” command only takes values between -10V and 10V. If I am not mistaken, the maximum voltage an 11W motor is capable of running is 12V. Therefore, does using “Set Motor Velocity” at 100% and “Spin” allow the motor to go faster than “Spin at Voltage” at 10V?

2 Likes

To answer question 2:
The motors have functions in the API that can tell you the current angle and desired angle (the one it’s spinning towards). You can use the current angle - the starting angle (current angle before the robot moves) to figure out how far it’s gone, and use that for a PID.

For turning, use a gyro, or even better, an inertial sensor.

3 Likes

Thank you for the help on voltage. I believe that the 100% provided by percentage in blocks would probably provide the same as 10V, it is probably a safety barrier vex puts on the code so you don’t burn out the motors.

3 Likes

For question two, you could use some rotation sensors to calculate distance traveled and error.

3 Likes

At max input speed (ie what you program) you will get more output speed using volts for sure. This is generally only about 10% for a motor by itself so the question is whether that really makes a difference to you or not. The rest of the picture is more complicated:

  • what you get a lower speeds will either be above or below the speed you request
  • each motor will be different

e.g. here is a motor sitting on my desk by itself with a quick test that runs at 50% voltage (100% would be 10.9v) for a few seconds and then ramps up to 100% voltage and back down to zero (blue line is what im’ telling the motor to do and orange line is what its doing)

Hope this helps …

3 Likes