The RoboMentors will introduce you to a general idea of robot parts or arms which touch a sensor to have the robot reset its state.
What you will learn:
- How to build simple mechanisms with a touch sensor
- How to program and think about these mechanisms to allow more autonomy for the robot
What you need to review:
- Lesson 2 Moving Forward without sensors, the part about passive mechanisms
Suppose we want to scratch the back of our heads. We would then simply put one arm in the back, beyond our head. Then we would move the forearm and hand closer to the head, reach, touch and start scratching. How do we know when we can start scratching ? Of course, when we sense both with the tips of the fingers and with the scalp that we touched.
Or suppose in winter we need to take our hat, or hood off. Again, we move the hand towards our head until the hand touches the top of the hat or hood, then we grab it, and we reverse the motion and pull.
For the robot, we can follow these simple ideas, when we need to build some attachments or arms to have it accomplish some mission.
For instance, in City Shapers, several missions required the robot to move and deposit small houses made of Lego, in certain places. Another mission required pressing on a small paddle. A moveable arm with some hooks and a “palm” could then take care of these tasks, but without sensors, it should be very carefully positioned at the beginning of the game. A touch sensor, however, would allow such self-sensing, and allow the program to stop the movement at the right moment.
One general way to go about this is to place the touch sensor on the robot body in a special position, where the arm would touch it when it should also stop and not go further (because there is no more room to go, for instance). This way:
- At the beginning of the mission, or even before, we run a small dedicated alignment program
- start moving the arm towards the end position, not too fast
- wait until the touch sensor is pressed
- stop the movement of the arm right away
- perhaps move back the arm a little bit, to release the sensor
- During the missions, all movements are then counted and kept track of (for instance in motor rotation degrees) from that touch sensor end-position
- Therefore, we always know how far the arm has traveled either back or forth, and thus we can program the robot accordingly with confidence
Moreover, since sensors, like motors, are limited — only four can be used at a time –, mechanisms can be built to even share a sensor among two arms or moving parts, if each presses on the side of some platform, or wheel mounted on the sensor. The only condition is to not have both arms press at the same time, so only one arm should be moving towards the end position, and then lifted off it, before moving the other one.
Finally, combining passive mechanisms and arms can greatly expand the possibilities, since only two motors are available for the arms (because we need the other two for driving and only four motors can be used). For instance, one arm can press or move a part of a mechanism, in a certain position, and that can in turn trigger another action. Or an even more complex setup: an arm presses on a passive mechanism (with an elastic making it automatically come back to the initial position), and then, while the arm is still pressing on the passive mechanism, the other arm comes into place and then the useful action takes place (such as making something fall), because both the other arm and the passive mechanism are in the right position.
We find these mechanisms in real life, for instance for the elevator doors, which have sensors which then limit their travel, or even inside door handles with locks: for some of them, once locked, pressing on the inside door handle, also unlocks, but of course, only once (until locked again).
To go even further, we can think of the state as effectively describing which positions the arms and mechanisms are in, and then moving arms or pressing on some parts would change the state of the robot. It then can be useful to be orderly, and list states and how the robot can change from one state to another, when possible, somewhat like an action plan for what missions we want the robot to accomplish.