Have you ever wondered how a robot vacuum cleaner detects and avoids obstacles? This was a question our girls sought to answer when they began exploring the role of sensors in aiding robot navigation.
The first sensor we worked with was the touch sensor, which is ‘activated’ by a ‘push’, being ‘released’, or with a ‘bump’. As the girls discovered, this sensor can be extremely useful for detecting obstacles in front of the robot.
The first challenge required the girls to work out the difference between the ‘push’ and ‘bump’ sensor states. They had to program their robot to move forward until a team member ‘bumped’ the sensor with their hand. The resulting code looked something like this:
Move Forward –> Wait Until Touch Sensor is ‘bumped” –> Play “Sorry” —> Move Back 1 rotation.
Robots and Walls don’t Mix!
The next challenge proved to be rather entertaining. The girls were asked to program their robot to move until it detected a wall, reverse 20cm or so, and then turn 90 degrees. Then after adding a loop, they had to create a physical obstacle course for the robot to navigate through. Judging by the number of robots trying to drive through (and climb) walls, this wasn’t an easy challenge. 🙂
The key to success relies on understanding the difference between the ‘bump’ and the ‘push’ states when using the touch sensor. A bump could be likened to a quick tap; however, the ‘push’ is activated when the sensor detects a firm pushing force (e.g. what happens when you hit a wall).
And, in one of the funniest pre-season moments to date …
- Student: “Mr Graffin, our touch sensor doesn’t work! Our robot is stupid!”
- Teammate: “Have you tried plugging it in …?”
They had to pick me up off the floor after that one, 🙂