The first prject using LEGO Mindstorm was a "Legway". The functioning criterion is very simple It use two light sensors in order to calculate the distance from the table, creating a controll action on the motor wheels.
Light sensors are provided with basic set of NXT. Their quality and precision is very low, in fact they are heavily affected by the surface of functioning. The robot behaviour is not regular and it should be set for each condictions of work. These bad properties could be avoided using others type of sensor, as gyroscope sensor or accelerometer sensor.
The structure of Legway is simple, it had been made using few pieces in order to find the better compromise between functionality and robusteness, and for evade the problem of play between parts. The two motors are connected directly to the body and the two light sensors are placed to the sides of one motor. There is also a load to balance the weight of the sensors.
Control Software:
The Legway's motion is affected by this parameters:
Inclination against vertical axis
Angular speed of the body
Position on the ground
Speed on the ground
First two terms can be estimate by light sensors, others with motor's encoders. The stability on the vertical position can be reached with a feedback of these parameters.
Here is a video of the project:
The control software has been written in NXC language, details can be found on the thesis or presentation. There is also the sources of the software.
Here is the Matlab-Simulink version of the software, that can be compiled with Embedded code robotot.