3.3 How To
This section gives various examples of complexe behaviours and/or functionalities. The world files are located in the projects/samples/howto/world directory, and their controllers in the projects/samples/howto/controllers directory. For each, the world file and its corresponding controller are named according to the behaviour they exemplify.
3.3.1 binocular.wbt
Keywords: Stereovision, Stereoscopy, Camera

Figure 3.25: binocular.wbt
This example simply shows how to equip a robot with two Cameras for stereovision. The example does not actually perform stereovision or any form of computer vision.
3.3.2 biped.wbt
Keywords: Humanoid robot, biped robot, power off, passive joint

Figure 3.26: biped.wbt
In this example, a biped robot stands up while his head rotates. After a few seconds, all the motors (Servo) are turned off and the robot collapses. This example illustrates how to build a simple articulated robot and also how to turn off motor power.
3.3.3 force_control.wbt
Keywords: Force control, linear Servo, spring and damper

Figure 3.27: force_control.wbt
This world shows two boxes connected by a linear Servo. Here, the purpose is to demonstrate the usage of the wb_servo_set_force() function to control a Servo with a user specified force. In this example, wb_servo_set_force() is used to simulate the effect of a spring and a damper between the two boxes. When the simulation starts, the servo motor force is used to move the boxes apart. Then the motor force is turned off and boxes oscillate for a while now according to the spring and damping equations programmed in the controller.
3.3.4 inverted_pendulum.wbt
Keywords: Inverted pendulum, PID, linear Servo

Figure 3.28: inverted_pendulum.wbt
In this example, a robot moves from left to right in order to keep an inverted pendulum upright. This is known as the "Inverted Pendulum Problem", and it is solved in our example by using a PID (Proportional Integral Differential) controller.
3.3.5 physics.wbt
Keywords: Physics plugin, OpenGL drawing, flying robot, Emitter, Receiver

Figure 3.29: physics.wbt
In this example, a robot flies using a physics plugin. This plugins is an example of:
-
how to access Webots objects in the physics plugin
-
how to exchange information with the controller
-
how to add custom forces
-
how to move objects
-
how to handle collisions
-
how to draw objects using OpenGL
3.3.6 supervisor.wbt
Keywords: Supervisor, DifferentialWheels, soccer, label, import node, restart simulation, screenshot, change controller

Figure 3.30: supervisor.wbt
This shows a simple soccer game with six robots and a referee. The Supervisor code demonstrates the usage of several Supervisor functions. For example, the Supervisor inserts a second ball to the simulation, changes its color, takes a picture of the 3D view, restarts the simulation, etc. In addition the Supervisor also plays the role of a soccer referee: it displays the current score, places the players to their initial position when a goal is scored, etc.
3.3.7 texture_change.wbt
Keywords: Supervisor, texture, wb_supervisor_field_set_*(), Camera

Figure 3.31: texture_change.wbt
In this example, a robot moves forward and backward in front of a large textured panel. The robot watches the panel with its Camera. Meanwhile a Supervisor switches the image displayed on the panel.
3.3.8 town.wbt
Keywords: Transform, USE, DEF

Figure 3.32: town.wbt
This example shows a complex city model built with various Transform nodes. The model makes a intensive use of the DEF and USE VRML keywords.