RTZ shows how to use a NXT motor as a rotation sensor that always returns to a fixed orientation after being rotated. The technique is pretty useless, but the behavior of the robot is interesting to watch. The technique also shows some interesting and non-obvious aspects of the behavior of the NXT motors.
I wanted to build a vehicle that would be able to sense that it is hitting a wall on the left or right side, back up a little, and turn, to avoid a collition with the wall. David Baum's book shows how to do this with the RCX kits, using two touch sensors. Each sensor is pressed by an antenna-like structure. When one (or both) of the antenna hits the wall, it releases the sensor, and the robot knows that a wall is coming on that side.
The NXT kit only comes with one tough sensor, so I could not use this simple strategy.
I decided to try to use a long rotating bumber that will be mounted horizontally on a vertical axle connected to a NXT motor. If the bumper rotates clockwise, the robot knows that it hit something on the right side. If the bumper rotates counter clockwise, the robot hit something on the left. The robot won't detect frontal collisions with this bumper, since the bumber won't rotate, but we can use the single touch sensor to detect such collisions. The pictures below show the physical structure of the robot.
To be useful, the rotating bumper must return to the original position after it bumps into something. The obvious solution is to use rubber bands to do that. But what I decided to do (mostly because I didn't think of the rubber-band solution) is to use motor action to return the bumper to the original solution. This turned out to be quite challenging.
You may want to try to solve the design challenge in this vehicle before you read how I solved it.
Here is the definition of the challenge. Connect a single motor to the NXT. Put an axle through the motor, and connect a perpendicular axle to the first one. The second axle acts like a hand of a clock: the motor can rotate it around, and when the motor coasts, you can also rotate it. Write a program that will allow you to rorate the hand, but which will return it to the original position every time you rorate it more than, say, 20 degrees. After it returns to the original position, it must be set to "coast", not to "brake", to allow it to sense future rorations.
This movie (3MB) shows how this mechanism should behave.
Solving this challenge will allow us to use the motor as a rotation sensor that springs back to its original position.
© 2006, Sivan Toledo