Educational purposes Robot :Webots

Webots is a professional robot simulator widely used for educational purposes. The Webots project started in 1996, initially developed by Dr. Olivier Michel at the Swiss Federal Institute of Technology (EPFL) in Lausanne, Switzerland.

Webots uses the ODE (Open Dynamics Engine) for detecting of collisions and simulating rigid body dynamics. The ODE library allows one to accurately simulate physical properties of objects such as velocity, inertia and friction.

A large collection of freely modifiable robot models comes in the software distribution. In addition, it is also possible to build new models from scratch. When designing a robot model, the user specifies both the graphical and the physical properties of the objects. The graphical properties include the shape, dimensions, position and orientation, colors, and texture of the object. The physical properties include the mass, friction factor, as well as the spring and damping constants.

Webots includes a set of sensors and actuators frequently used in robotic experiments, e.g. proximity sensors, light sensors, touch sensors, GPS, accelerometers, cameras, emitters and receivers, servo motors (rotational & linear), position and force sensor, LEDs, grippers, gyros and compass.

The robot controller programs can be written in C, C++, Java, Python and MATLAB. The AIBO, Nao and E-puck robot models can also be programmed with the URBI language (URBI license required).

Webots offers the possibility to take PNG screen shots and to record the simulations as MPEG (Mac/Linux) and AVI (Windows) movies. Webots worlds are stored in .wbt files which have a format very similar to VRML. It is also possible to import and export Webots worlds or objects in the VRML format. Another useful feature is that the user can interact with a running simulation at any time, i.e. it possible to move the robots and other object with the mouse.

Webots is used in several online robot programming contests. The Robotstadium[1] competition is a simulation of the RoboCup Standard Platform League. In this simulation two teams of Nao play soccer with rules similar to regular soccer. The robots use simulated cameras, ultrasound and pressure sensors. In the Rat's Life[2] competition two simulated e-puck robots compete for energy resources in a Lego maze. Matches are run on a daily basis and the results can be watched in online videos.

Light Sensor VIRTUAL FLOWER ROBOT





In this project we build a robot that has two optical light sensors and turns its head in the direction of light. The head is the only moving part of the robot and it is controlled by a gearbox manufactured by Tamiya. The light sensors are formed by two CdS photoresistors available from RadioShack. I used two smallest ones from the package of 5 photoresistors available there. The cell diameter is about 5mm, the maximum dark resistance is about 14M and the minimum light resistance is about 0.5K. The daylight resistance in my room is about 50K.Light sensor Motor and gear


The first prototype

The photoresistors are mounted on the robot head which in turn is attached to the gear axe.  I used a paper strip separating the photoresistors and its optimal length in my setting is 1in measured from the photoresistors. The separator is needed to shadow one of the photoresistors when the light source is moving. For simplicity, the head can move in a 2-dim horizontal plain only, thus making a difference with a real sunflower. The head is formed by a small breadboard ,which for now has just the photoresistors and the paper separator mounted on it.

The light sensors (L and R on the schematic) are connected to the PIC which periodically measures their resistance and controls the motor accordingly. To measure the resistance of the photocells I use a classic RC-chain and measure the time of charging a capacitor, which for a fixed C is proportional to R. The direction of the motor rotation is controlled by the classic H-bridge composed entirely from NPN Darlington transistors TIP120. These transistor structures contain the diodes protecting them from the high voltage caused by inductive load. The bases of the bridge transistors are connected to PIC. If the RB6 and RB7 outputs are both 0, the motor is not rotating. If one of them is 0 and the other one is 1, the motor is rotating in the corresponding direction. The situation when both outputs are 1 is prevented by the software, since in this case the 3V battery would be short cut.Schematic Layout


This is just the first prototype of the design and I use LCD for tuning and debugging. The LCD displays the numbers coming out of the resistance measurement. The larger numbers correspond to a darker resistance. The built-in PIC program does not allow the numbers to exceed 255. The minimum numbers corresponding to lighting the device with a desktop 60W lamp is about 30, so we have almost the full range of the light intensity measurements of 30 - 255. The motor starts to move if the absolute difference between the numbers is larger than 15, which is defined experimentally. This constant defines how much the light source can move before the robot starts following it. The larger is the constant, the less is the accuracy of following the light. The sensor resistance is measured approximately every 80msec, which is also near optimal for the gear ratio 719:1 and the motor voltage in the range 3 - 5V. Increasing the measurement time up to 250msec causes the head moving back and force several times before it finally stabilizes.
The embedded program source for the first prototype is photo1.asm
The Second prototype

The LCD is actually not needed in a real device and can be excluded. This decreases the number of interface pins down to 6. Hence, a smaller PIC can be used as it is shown on the updated schematics. This PIC 12F675 has built-in 4MHz RC-oscillator which further simplifies the circuit. Also, smaller transistors can be used to drive the motor. However, they do require the diodes protecting them from the high voltage peaks caused by the motor.

Excluding the LCD significantly simplifies the program. One needs, however, to rename th output ports and other registers according to the PIC specs. The 12F675 has built-in comparators and ADC that are not used in this design and must be turned off. Also, all I/O ports must be setup for the digital mode. Finally, the PIC configuration fuses have some extra bits.
The embedded program source for the second prototype is photo2.asm
The Final Design

The robot electronics is assembled on a small board available form RadioShack. To simplify the power supply I added 3 silicon diodes 1N4003 that drop the 5V voltage down to about 3V for the motor. This way the entire unit can be powered up from a single 5V source. The maximum current consumption is about 200ma when the motor is on and just a couple of milliamperes when it is off.


The code is practically the save as the one for the second prototype with just a few changes. Two procedures that measure the light intensity are merged into one and I set up manually all PIC control registers instead of relying on their default values after power reset.
The embedded program source for the final design is photo3.asm
Things to consider

The used way for measuring the resistance if not optimal. It takes 2 pins of PIC - one for charging/discharging the cap and one for actually measuring a voltage. This can be accomplished with just one PIC pin. For this disconnect the right (on schematic) end of the cap and attach it to +5V. Rising up the voltage on PIN GP3 (in this case it should be configured for output) will discharge the cap. Now, configure this pin for input, and measure the voltage as described above.

For more details,ckts and help Contact
report4all@gmail.com