Alexis and Noah are back again with another Student POV! This time, sharing how they programmed a robovacuum in ROBOTC Graphical Language for the VEX IQ platform.
In this challenge, we programmed the Vex IQ robot to perform a task that was based off of the robotic vacuums that vacuum autonomously while avoiding obstacles. Our challenge was to program a robot that would perform like a robotic vacuum. Therefore it would be able to move autonomously while avoiding obstacles.
We started our program by putting in a repeat forever loop. This means that our program will continuously run until we stop it with the exit button on the Vex IQ brain.
We then made a plan on what we needed our robot to do. Within the repeat loop, we had to put an “if else” statement. An if else statement is a command that makes a decision based on a condition. With our program, our condition is the bumper sensor. The robot checks the condition of whether or not the bumper sensor is depressed. If the bumper sensor is not depressed, it will run the command inside the curly braces of the if statement. If the bumper sensor is depressed, it will run the commands inside the brackets of the else statement. We had to put this statement inside a repeat forever loop because without it, it would only make this decision once.
We then had to decide what task the robot was to perform when the sensor was depressed. So we set up commands within the curly braces of the else statement shown here.
Below is an image of the final program.
Now our robot is able to move around autonomously while avoiding different obstacles!
- Alexis and Noah