CS 372: Artificial Intelligence
Robot Building Lab
Session 3
Resource Kit
Outfitting A Robot Laboratory
Sample Syllabus for an
AI Course
Robot Laboratory Handout
Session 2
Session 4
Last week, you learned how to wire up motors to the handy board. You also learned
how to write and download IC programs from your computer to the handy board. This
week, you will give demonstrations of the results of your exercises from last week:
Touch Sensors
Today you will be handed two touch sensors. These are simple momentary switches The switches remain closed/opened only while the latch is pushed down. These can be wired across the digital ports (between 5V and ground) so that reading the value on the port will return a 0 or a 1 depending on if the default configuration is open or close and the latch being pushed or not. With an extended assembly (made out of LEGO beams or other similar objects) you can mount these on your robots so that they act as touch sensors. I.e., they can help detect if the robot has bumped into something.
After your demos today, you should plug the handy board into the computer. Plug
in the switches in the digital ports (ports numbered 7 through 15). The IC command
returns a 1 or a zero depending on the inputs to the port numbered PORTNUMBER. Issue the command several times to determine the values returned when the respective switches are open, as well as closed.
Exercise
Imagine your robot in an environment that has a 1.5 ft corridor going around a 2 ft by 2 ft square box. Write a program that will enable the robot to go around this box. This time, as opposed to the exercise from last week, the robot will go in a straight line until it bumps into a wall. After a bump it will proceed to make a 90 degree turn (you may need to have it go backwards a little to enable turning room) and then continue again in a straight line.
This task can ideally be accomplished using one touch sensor. But it will rely on being able to make perfect turns.
Can you circumvent the problem of perfect turns by using more than one touch sensor?
An alternative to the solution above would be to continuously touch the inner wall and follow it all the way around. Again a touch sensor could be used.
Other Possible Behaviors
Think of some other behaviors that could now be accomplished by using the touch
sensors. Can you use it so that it detects the edge of a table, in order to avoid
a fall?