Spring 2018 AT-ST Line Follower Code

By: Samuel K. Yoo (Electronics & Control – Software)

Verified By: Intiser Kabir (Project Manager)

Approved By: Miguel Garcia (Quality Assurance)

Table of Contents

Introduction

The main objective of this code is to make the robot follow a line. The initial part of the program has two motors turning wheels to move forward. After accomplishing this first part of the code, the next is to create the line follower. There would be four sensors not touching the line, and if the sensor hit the line, the robot would swerve away and continue to head straight. The AT-ST would not use motors for forwarding motion, instead, it uses servos. The four sensors will still be the same for the AT-ST.

Code

Figure 1: Code Screenshot

Figure 2: Code Screenshot cont.

Explanation

The beginning of the code initializes all the pin definitions and the I/O for each pin.  After that part of the program, the main loop contains the movement code. This code allows two motors to spin in opposite directions, attached to the wheels to move the robot forward. However, this movement code will be modified at a later date, as the AT-ST uses servos. The servos do not work like the motors and require a lot more analog pins. These pin requirements will need an analog extension. The sensor reading code, however, can mostly stay the same. The concept of slowing one part and increasing the speed of the other part will stay the same. However, it would not be the torque but the movement of the leg. Another huge difference in the code is the values. If this program would run on a robot right now it would crash or not move straight at all. This is because each motor is made with different values. There is no minimum value for the speed and the delay values might be too long.

Conclusion

So this line code main purpose is to move the robot forward and to follow a line. One of the issues is the AT-ST does not use motors for movement, it instead uses servos, which at the moment of this blog post, there is no research on. Another issue is the values inside the code are not accurate. These values need to be tested in real life to get value for the code. Overall, the general idea of the code in this blog post, however, needs to be updated with servos code and the real values in the final code.