This research explores sensor-based control of a mechanical snake through development of obstacle-avoidance and motion-planning algorithms. The mechanical snake is robot-like mechanism, a prototype of which is now being tested in the laboratory. It consists of a sensorized head link (that detects obstacles) and six identical regular links (that provide motion). As an obstacle is detected, the computer in the head link will be able to recommend a motion of each link so that when that link arrives in the neighborhood of the obstacle it will not collide with it. Developing the algorithms to make this system work is a far more challenging problem than the state-of-the-art, real-time collision avoidance strategies currently in use for mobile robots and robot arms. When completed, the snake will be able to move into areas that people cannot enter (e.g., small cracks in collapsed highway after an earthquake) or are too dangerous for people (e.g., a radioactive environment). At these locations, the will perform surveillance (e.g., look for survivors through remote video, check radioactivity levels) or a task (e.g., bring medicine to survivors).