I am trying to control a robot which has 3 dc motors fitted to it's base (Triangular base). I am controlling it through a ps3 controller.
The problem with the robot is that it does not move properly when given the command through ps3. I have tried to apply the pid algorithm to all the motors but i am having trouble in code as it does not work properly. The motor are not moving according to the command given through ps3. Also note that i have tuned the parameters of the motors individually so the problem is in the code itself and not in the constants of pid.
the motors are equipped with optical encoders and i am using arduino mega for my project.
can someone please correct my code as am having so much trouble in correcting it.
i have attached 2 files (i have called one function in another so as to make the code more readable).
Motor.ino (8.83 KB)
Motor_PID_Enc.ino (2.96 KB)