# EV3 motor control proportional to another motor when more than two motors

From what I understand, in EV3-g you can use "move steering" or "move tank" blocks to regulate two motors proportionally to each other as they have a built-in PID controller to do that. If one motor falls behind, the faster motor will be slowed down and vice versa...

My question is how to realize this with 3 or more motors? E.g.: I have motor A which I want to run at full speed. Motor B which I want to run at 30% of the speed of motor A. Motor C which I want to run at 50% of the speed of motor A. I also want that if any motor is slowed down (e.g. because of friction), this is compensated by slowing the other motors down.

Will I need to code extensive PID loops myself? Does anyone have any references or examples in that case? Or is there a simpler way ?

The application I have in mind is an omni platform. This is a robot that has three wheels on axes that are 120 degrees separated. By correctly setting the speeds of the three motors, one should be able to get the robot to drive in any direction without it having to turn (although it can turn in place if needed).

I've implemented 3-motor triangular holonomic drive with NXT-G but not ev3-g so I can help with strategy but not tactics.

To accelerate in any direction you need to constantly re-calculate the power levels for each of the 3 independent motors. By constantly I mean some reasonable number of times per second - 4, or something like that. EV3 is considerably more powerful than NXT-G but you won't want to tax it too much with this, if the 'bot does anything else at the same time.

The built-in PID stuff won't help with this at all - in fact, you'll want to do everything you can to ensure only your code is controlling the power levels of each motor, that nothing else is affecting them. Anything that's smoothing out the power level or similar should be disabled as best as you can.

Trigonometry is what you need - Arctan() to be specific. I have the math jotted down on paper somewhere but odds aren't good I'll find it anytime soon. If I can, I'll extract the logic from existing NXT-G programs and update this answer sometime.

inputs: desired bot direction, desired power level, motor angle (0, 120,240)

output: power level goal for that motor

You might wrap that all up in a PID loop to get 'actual' numbers closer and closer to 'desired' numbers.

Hope this is helpful. Happy to field any follow-on questions you might have. I'll update this answer with additional details if I'm able to pull them from the actual code, or if I find the notebook where I wrote down the math, about a decade ago.