# Maximum voltage in PID

So in vexcode I’ve heard the maximum voltage is 12v. Should I set in my pid if the output is greater than 12 the output =12. Is that ok or will it ruin accuracy?

It does not matter if the voltage is too much it will just go down to the default 12V.

1 Like

The thing is that I’m trying to do arcs with pid and for example I have the right volatge at 70 or something and the left at 30 but I think they just both go to 12 and it goes forward. Does it work that way?

You might have to tune your PID better.

2 Likes

yeah, just use numbers from 12 and under, it’s easier to understand and is just better than using numbers bigger than the motors can do.

1 Like

Would dividing the output by a constant do the trick?

Yes it would.

2 Likes

According to PROS motor API docs the voltage parameter must be from -12000 mV to 12000 mV.

However, when you program your autonomous PID, you want to target your nominal driving voltage to less than that, because you want to leave yourself some margin in case if one side encounters more resistance and you need to give it more power.

If you are doing arcs, I would try to target velocity instead of voltage. This will give you more predictable results than voltage. If you have all unlocked omnis on your drivetrain it could drift, which is another reason to go slower. If it drifts too much then don’t do arcs - do separate turns and straight segments.

2 Likes

If you set the motor to go 13 volts the motor will only go 12 volts as the motor itself has clamped values.

You could try to normalize the output of your pid to the voltage scale of the motors (-12000mv to 12000mv) so even if your left and right side outputs are greater than the max, you could maintain the ratio between the outputs. I.E. if your PID is outputting 50000mv for your right and 25000mv for your left side, you can normalize them to output 12000mv for the right and 6000mv for the left side.

3 Likes