Set Motor velocity

@ tfriez

Does the command “set motor velocity” have a built-in PID loop? or is it simply applying a fixed % of the power to the motor?


It is just a simple speed commands. If you set velocity to 30 percent the motor will spin at 30 percent speed.

1 Like


If you are using Vexcode IQ then it will try to keep the velocity at a certain level, it’s not just motor percentage. It’s not the best pid and you can’t tweak it if you’re using the built in commands, commands, but with my students making double flywheels it works very well to keep both wheels spinning at the same speed when the “%” option failed to do so.

There is a “%” and an “rpm” option.


Thanks @sankeydd adm 9Motor gang.
So you see a better velocity stability with rpm than %?



There are a couple of problems you can overcome by doing it with RPM.

If you have a two flywheel shooter, both of the motors will need to spin at a slightly different % because the two sides will be built slightly differently. Using RPM will overcome those differences.

Also, as you lose battery power, the motors will increase their power to try and keep them at the same RPM.

You might want it to print the actual RPM on the brain screen to make sure that they are actually getting to the desired velocity.

Here is the help menu:


Interesting – that’s not the behavior I would have expected from looking at the blocks or reading the help text.

Intuitively, I would expect a block that reads “set motor velocity to 50%” to set the velocity to 50% of the maximum velocity, rather than 50% power – that is, I would expect “set motor velocity to 50%” to do the same thing as “set motor velocity to 63.5 rpm”. But it sounds like that’s not the case – good to know that you can control the motor power directly!

1 Like

Er, there’s no difference internally between rpm and percent. percent is simply calculated as
motor command = percent / 100 * 127;
where as rpm is sent directly.
motor command = rpm;


Well, I’ll be.

Now that I think about it the students were using a p-loop as well. I thought the command was doing some correction as well, but now I can see it was just the p-loop.

If rpm has no functionality over %, what use does it have? This isn’t like an “in → cm” conversion as % and rpm are two different types of units.

Why would rpm mean two different things?


I am hoping that the second command is actually reading the rpm.

Is the maximum rpm of the motor really 127? Given that 127 is 2^7-1 I never thought that maximum was real, just a convenient Mersenne number outside the range of the motor.

So when you set the motor with % or rpm it’s doing the same thing. Is it setting to a percentage of power or is it using PID?

1 Like

This is correct. 1st command sets it, 2nd command is for reading it and using the velocity value in equations, if statements, etc.