Close

Corrected Direction of Motors and PID

A project log for Remote Control Differential Drive Robot Car

A remote control differential drive robot car where the linear & angular velocities of the are controlled using a PID control system.

ghani-lawalGhani Lawal 02/07/2022 at 22:580 Comments

Switched power terminals of Motor B and Motor A to test if Motor B was defective as it was unstable for a lot of the PID values.

Then commented out Direction = true/false in setMotor(A/B)(Reverse/Forward).  This removed the instability issue.  This is because Direction is a state of the motor, not a command.  Instructing the motor to reverse or rotate forward doesn't mean it will do so instantaneously, it needs to slow down first.  

Function logic for wheel(A/B) direction of the motor didn't reflect the true direction of the motor and/or conditions for changing direction.  Therefore Direction(A/B) didn't change accordingly, leading to errors in the number of pulses counted, as they weren't incrementing/decrementing correctly.

Discussions