Systems Control
Clawbot
Students were assigned to construct the basic frame and working functionality of a VEX clawbot chassis (lightheartedly labeled “Chef Ravioli” by the group in the code). Students would then program it to complete a series of elementary courses in regards to movement: a maze and a ladder.
The wheels on each side is operated by a gear train and motor that is hooked into the cortex, the “brain” of the robot. The cortex collects the inputs of devices, such as the small red plastic attached to the rear right wheel in the second picture called an encoder. It allowed programmers to set the amount of rotation on a motor before it stopped or changed speeds.
The specific programming language used to move this robot was RobotC, an excellent language to introduce code to inexperienced programmers. You will find the written programs below.
Both programs were debugged by testing the bot out on the courses, making the iterative process extremely long and drawn out. Compounded by the issues that are elaborated on in the sections below, this project was extremely informative in regards to proper programming techniques.
The Maze
Using RobotC, this excerpt of code successfully navigated a “maze” which required the bot to make one left turn and two right turns. Each time one motor stops without the other starting indicates a turn while time is used to dictate the amount turned.
Foolishly, the primary variable used in this code was time. Rather than using the encoder which measured the amount an axle, and by extension a wheel, turns, the program utilized time to dictate how far the robot would travel before executing the next command. While time is not inherently a poor variable, it is inadvisable in this case since the bot runs on battery power and as the power in the battery decreases, the bot itself will begin to slow down. Therefore once the power is low enough, the given time intervals are no longer adequate to avoid the walls of the maze.
the ladder
The nature of the ladder challenge allowed for a greater margin of error. The course consisted of the outline of a “ladder” on the floor where the bot must reach the first peg, return to the original peg, reach the next peg above the first, and return, repeating the process until it reaches the final peg and returns successfully.
This is an excerpt of the code as it is originally almost 100 lines. Learning from the mistakes of the Maze, this iteration used the encoder as its main data input so no issues of battery life affected the bot now. However, the friction the encoder would cause was not accounted for so different values of the encoder were necessary for the bot to travel the proper distances and turn the proper amount.
The other problem encountered was the sheer size and complexity of the code. As state above, the entire program was pushing upwards of 100 lines. This could have easily been solved by creating abstractions and functions to decrease the total amount of lines used. While this idea was not even considered, it was apparent even if it did, the group was unsure of how to code a function like that in RobotC and if it was even possible to.