## [CNIT 581-SDR / Spring 2019] Week 14 – Navigation Control with PID

First of all, we tried to control the robot by using PID control.

Figure 1: PID Controller

The PID control, which is the proportional-integral-derivative controller is a control loop feedback mechanism. Inside the PID control, there are few controls which depend on the factors that we use. We can use not only all P, I, and D constants but also P and D constants to control the movement. When we tried to move the hamster robot with simply giving move_forward() command, it didn’t go straight. It turned right even there was no any input. Thus, we tried to remove that error by making the acceleration close to 0. For movement and controlling the heading angle, our team tried to decrease the error (fluctuated movement), simply putting PD control. The P and D constants are heuristic data, so we increased the number by 0.001. We found out when the P constant was 0.01, and D constant was 0.02, it showed the best result with our circumstance (friction, pen, surface, etc.). However, there were some random cases because if the hamster robot doesn’t have a lower power compared to full charged battery level, the speed of wheel slowed down and also there could be some error from holding part which is connected by tape unstable. Furthermore, because of unstable sensors, it didn’t show up the regular result.

Because of the random result, we changed the method to put some compensation to the right wheel and map the angles. It showed much more accurate data compared to the result of PID control. We were trying to draw a rectangle; however, the robot drew rounded trajectory when it tried to turn to change its angle. The solutions we found are holding up the pen while it changes the angle and put the pen on the center of the robot. We chose the second method to solve this case. Since we cannot pierce the robot, we tried to build two robots and put the pen in the center of two robots.

## [CNIT 581-SDR / Spring 2019] Week 12 – Navigation Control from coordinate

In the previous blog, we had decided to send a JSON file format to adjust the motors of Hamster robot. However, we found that the structure in the mobile environment is entirely different from our original thought. When a user drew some lines in the display, the object that receives the user’s input takes two coordinates of starting and ending points with curved information.

When we took the coordinates of drawing, it has not only information on starting and ended points but also has ‘quadto’  information which shows us lines has a geometric shape. The picture below is about a JSON file containing coordinates of two paths.

Therefore, we refer to a blog explaining robots’ turning method. To turn right or left accurate, we need to calculate the angular velocity of the left wheel and the angular velocity of the right wheel. We need to control the position of the robot in x coordinate and y coordinate as well as its orientation.

Same speed of both wheels: go straight
The speed of a wheel is smaller: the robot turns in that direction After reading it, we realized that the second assignment of SDR class is similar to our purpose so now we are examining how we will implement the manipulation of robot motors by these two references.