We are really excited to introduce a new blog series called Student POV! This series will feature students giving their perspective and advice for programming in ROBOTC. If you’re a student who would like to contribute to the blog, let us know at firstname.lastname@example.org. Welcome our first student bloggers, Danica and Jake!
Hi it’s Danica and Jake, and we just completed the Labyrinth Challenge. We are both 8th grade students attending Hopewell Memorial Junior High. We both used VEX IQ Graphical Programming Language to complete this challenge since it is a new software recently released by ROBOTC. The first challenge we had to accomplish was the labyrinth challenge. The labyrinth is a square, where the robot has to travel from the starting point, to the ending point by doing a series of basic commands.
Our first task was to make our robot move forward.
This block is telling the robot to go forward at 50% power for 5 rotations, but you can also set the robot to move for degrees, milliseconds, seconds, and minutes.
Our second task was to make the robot turn left.
When turning left, you can use multiple commands such as degrees, rotations, milliseconds, seconds, and minutes. You can also use this for turning right.
One problem while programming for this challenge was making 90 degree turns. To get a perfect 90 degree turn, with timing, you had to go through a lot of trial and error. After figuring out the perfect turns, based on timing, the time for moving forward, and the stops to prevent drifts, we had to string all the commands together to form the program for the challenge. This what the finished program looks like:
An easier way to perform more accurate turns, is with the use of the gyro sensor. The gyro sensor allows you to count how many degrees you turn. This simply means that you can actually tell the robot to make an accurate turn. You also have to remember to reset the gyro after every use, and it will make this program a lot easier.
To reset the gyro you have to use this block:
The finished program with the gyro sensor looks like this:
In this program we used the setMotor command instead of turnLeft or turnRight. This command is better to use in the while loop since you only have to set the speed of the motor. The condition in the while loop determines how long the robot turns. As a result, we just need to set the motor speed with the setMotor command.
A cool feature you can use in RobotC is commenting out your code. You can also do this in the VEX IQ Graphical Organizer. It is much easier though since you only have to click the number on the block of code you want to comment out.
Commenting looks like this:
These comments allow you to test only one turn out of the whole code, which is very useful during the trial and error stage.
Now it is time to go try the Labyrinth challenge on your own, either with or without the gyro sensor. Have fun!