For our final project, we use the myRIO and MSP430 to create a car with line following capabilities, speed controls, and TCP/IP controls. The car can recognize 3 colors' lines and show different speeds when following different colors. TCP/IP protocol is used to control the car from the computer. From the computer, we can speed up, slow down, start/stop line following, and manual turning. The MSP430 is fitted with LEDs that have the same color as the lines. When the car starts following a different color, that colored LED would light up.
The line following feature is designed in LabView. Using NI Vision with the webcam, we are able to capture an image with all three of the colored lines. From there, the vision assistant is used to processing each line. We set up a case structure with 3 cases, one for each color. When the area of the color is larger than a threshold, the system will be kept in this case and do line following. If the area is smaller than the threshold, the program will start searching for other colors until one of them matches. Also, each case is set up with a different speed value to give different control speed. When it is in one of the cases, it will try to keep the center of the colored area in the center of the image by changing the turning value. Then the car is able to do line following.
Within LabView, we implemented the TCP/IP protocol to control the car remotely from the desktop computer. Actually, we are sending different numbers by pressing different buttons and activate different events. The first two event structures controlled speed. This allowed the car to speed up or slow down. When the car was in line following, the car would still speed up or slow down based on the color it was following, but the speed controls from the computer would either increase or decrease all of the color speeds. The computer controls could also take the car out of line following mode with a simple button press. Once outside of line following mode, the car could be turned left or right with the click of a button. Also when out of line following mode, the car could be sped up or slowed down with the same speed control buttons. Lastly, a button could be pressed to send the car back into line following mode, and the car would search for the line track and return to the line following process with the speed controls set by the different colors.
There are several optimizations we use in the project. First, we find the turning value should be different when at different speeds. With high speed, the turning speed should be faster to handle those sharp corners. So we set an algorithm to calculate the turning value based on the speed. Second, we slow down the TCP/IP transfer speed and this will give better control by avoiding data accumulation.
Comments