Motor Control
The motor control subsystem is designed for a better performance in the movement of the robot, as the rollers on the mecanum wheels can produce slipping and skidding that causes the robot to drift away from the path. This subsystem involves manipulating the speed of the wheels to control the four motors that actuate the mecanum wheels. Initially, when the robot is travelling in a straight line the movement tended to drift towards the right side. This is undesirable for further development of the SLAM algorithm, thus it was essential to ensure the robot can follow a desired track without much distortion in the route.
To achieve a better control and eliminate the chances of the robot drifting off course, we relied heavily on the gyroscope on the MPU, as the yaw angle gives us an indication of the direction of drift. A P-controller was implemented in conjunction with the gyroscope reading to adjust the robot’s orientation when drift occurs. The implementation of the P-controller is in such we input a desired angle and obtain the error between the desired angle and the yaw angle from the gyroscope. We then multiply the error with a constant gain value P, to convert it into voltage which is injected into the robot’s motors. The yaw angle acquired from the robots movement is fed back to obtain the new error value. This is done repetitively to constantly monitor the angle of the robot close to a desired angle, thus eliminating the problem of drifting off course.

