In this tutorial we will go through a solution for three of the missions from 2012 FIRST LEGO League competition using only one attachment. By accomplishing the medicines, strength exercise and cardiovascular missions we earn 55 points. You can download the programs from the link in the Materials tab.
- 13 Jul 2013
We use a robot based on LEGO Mindstorms NXT. For EV3 solutions look at newer episodes.
Here is a list of episodes, that might be useful to watch. The following videos explained things we use in this tutorial:
- Episode 10 - Here you can find more about the programming of the Menu myBlock.
- Episode 11 and Episode 14 -You can find more on calibration of the light sensors in these episodes.
- Episode 13 - Here you can find building instructions for the robot used in the tutorial.
- Episode 29 - In this episode we have explained step by step how to we make the myBlock for alligning with direction
- Episode 31 - You can find an explanation of how to follow a black line using one sensor and five states.
- Medicine mission;
- Click the clock of the Cardiovascular Exercise mission;
- Strength Exercise mission.
Do not forget to calibrate your robot before using the programs bellow.
- Download the ready to use source code of the program used in the tutorial for solving the medicine mission.
- Download the ready to use source code of the program used in the tutorial for solving the strength exercise mission, while clicking the clock from the cardiovascular exercise mission.
In today's video I will show you how to solve the Medicines, Cardiovascular exercise and the Strength exercise missions (view other Senior Solutions mission solutions). All of this I will solve with only one attachment. Again for a base I will use the competition robot I have build in episode 13.
So for solving the Medicine mission again I will use Ultrasonic sensor as in episode 14. But this time I will make a way more simpler attachment. So first let's attach the Ultrasonic sensor. We have got this. And I will put it here, like this. Okay and I will attach the Ultrasonic sensor to port 4.
So I have the Ultrasonic sensor. Then let's make the attachment. First I will attach a 15 bar to the gears, then I will use this part.
And on the other side the same way.
Okay and we will use this one for the Strength exercise mission. For the Medicine I will use these several parts, attach them.
And we are ready to program the robot and hopefully solve the missions. First we will begin with solving the Medicine mission. I have divided it in three parts: First we detect the medicine. Then we take the medicine. And finally we return it back to base. The whole program and the three MyBlocks you can find under this video. So let's begin with the first MyBlock. The idea here is almost the same as the solution in episode 16 of the Medicine missions. First using the MenuMyBlock we have created in the previous tutorials. We chose which medicine the robot should take, the result we store in a variable called 'Result'. And then we go unlimited. First we wait until the Ultrasonic sensor detects an object further than 25 centimeter away. Which actually is the gap between the medicines.
Okay, whatever. And then we wait until we see an object which is less then 20 centimeters away. Which actually is the medicine. When we have detected the medicine we subtract one from our variable. And repeat the process until we reach zero. Then we stop and move back 200 degrees in order to align our attachment with the medicine.
After we have aligned with the medicine we make two consecutive turns with Motor C and Motor B at 45 degrees which is 45 degrees of the robot not 45 degrees of the motors. And with those two turn we have actually taken the medicine, now we move up our attachement in order to not push any of the other medicines. And after this block we have taken the medicine. Now we only have to return the robot back to base this is done by aligning to the black line. With the MyBlock you can find in the previous tutorial. And then we make 90 degrees turn with motor C and move for seven rotations in order to get in base.
So let's see how does the program work. I see that the Green medicine is the second one. So I start the program and choose medicine number two. The robot starts sees the first medicine now the second one, takes the second one and returns back to base.
So let's now continue with the Cardiovascular exercise and the Strength exercise. Again I have divided the solution in three main parts. And again you can download the three MyBlocks under this video. So first we go to the Cardiovascular exercise. This is done with this MyBlock first we move forward for two rotations in order to get out of the base. Then using the Light sensor on port 3 we follow the black line with five states. Which is a really fast algorithm to follow a black line and will be covered in the next tutorial so I won't stop right now on it. But the important thing is that we follow the line until we reach the Green line and we detect it with the Light sensor on port 2. Another important thing is that you must calibrate your sensors before using this program. Because otherwise it won't work. When we reach the Green line we stop and by reaching the Green line we actually have clicked the Cardiovascular exercise. Next we will lift up the Strength exercise. This is done by moving forward for one rotation then we make several turns with motor B and C. And then we move forward with the two motors for 1 second in order to align the robot with the Strength exercise.
We lift up our attachment again for two seconds and with this we have executed the Strength exercise mission. Finally we must return to base, this is done by making a 90 degrees turn with motor C then we align on the black line using the MyBlock from the precious episode. And then we make another 90 degrees turn and finally we move forward for 12 rotations in order to get in base. Now let's run the program. Now let's run the other part of the program. The robot makes two rotations and gets out of base, follows the black line until it reaches the Green line. Meanwhile clicks the clock, aligns to the Strength exercise - raise it, align to the black line. And afterwards gets back base.
Lessons with this tutorial
This tutorial is used in the following lessons
- How to Solve Senior Solutions Medicines, Cardiovascular and Strength exercise missions with one attachment