Spring 2018 AT-ST Turning Code

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

Verified By: Intiser Kabit (Project Manager)

Approved By: Miguel Garcia (Quality Assurance)

Table of Contents

Introduction

The objective is to focus on the different methods of turning for the robot. The first method is timing turning which tells the robot to turn for a certain amount of time. The other is an infinite state machine which uses the outer sensors to tell the bot which state it is in. This turning sequence used for the robot has wheels, which the AT-ST does not. The concept of turning can be used for the AT-ST.  

Code

CHANGE CODE TO <code> type

Figure 1: Screenshot of code

Figure 2: Continuation of Screenshots of code

Figure 3: Last part of code screenshot

Explanation

The code, in the beginning, initializes certain variables and sets them as inputs and outputs. After this the code contains a line follower code which makes the robot follow the line. There are then the subroutines for the time turning. The subroutine near the end of the code allows the bot to make a left, right and turn around. Time turning is a method of spinning the wheels in the same rotation until it points in another direction.  Each turn must be tested to find the desired direction. The values in the code are placeholders until real values are obtained. This code however only works with motors, not servos and needs to be updated at a later date. The finite state machine code is not in the list above, however, I can explain the logic and some pseudocode.

The logic behind the finite state machine is to switch from one state to another state. These states will tell the robot it needs to continue, turn, or not until it reaches another state. If all sensors read black, it is at an intersection and will either start turning left right. Next, it would jump to the next state and see if the sensors outer sensor read the white part of the maze if so it would continue to turn until it sees all black. After that, it would proceed to move forward.

Conclusion

This whole entire blog post is to make the turning code. The time turning is in the code, however, it does not suit the AT-ST because of the difference in components. The finite state machine is not implemented yet. This post will require further updates for both the inclusion of the state machine turning and the servos.