DescriptionSo you've made your robot respond to its environment in the previous activity. But how does your robot do something repeatedly? Or how does your robot respond to the environment actively? Now you will learn how to use loops.
This activity will get you started with RoboMind. In this activity, you will:
- program the robot to respond to the environment actively
- make the robot perform repeated steps
- learn how to use counted and conditional loops: repeat, repeat(n), repeatWhile(condition)
- learn how to use break and end
Here are the steps:
- Open RoboMind.
- Learn about loops and what you can do with them. Go to this section. You will learn:
- counted/infinite loops
- conditional loops
- how to break out of loops
- Learn about the command end. This brief section shows you how to terminate your robot.
- Learn by example. We can learn lots by running and studying sample programs.
- Take a look at example 2.
- Read the code explanations With loops, you can locate certain positions on a map.
- Run the sample code. You'll need the findSpot1.map which came with RoboMind.
- Take away or add in some code to see how the robot does.
- Your Assignment: WallTrackerBot
- Download and load the map for this activity. Activity_3.map
- Write a robot so that it follows the wall until it encounters a beacon. Then have your robot pick it up. (See this video for an example.) Activity_3_Follow_Wall.swf
- Hint: Use what you've learned and the sample code we studied.
- Write some comments to document your work!
- Test to see if it works!
- Save the code (File > Save As..)
- Upload your code as a submission.