3.4 How ToThis part of the chapter contains examples of how to use various Webots devices in order to achieve more 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 for the behaviour they are an example of. 3.4.1 binocular.wbtKeywords: DifferentialWheels, Camera, stereoscopy, MyBot ![]() Figure 3.24: binocular.wbt In this example a robot moves in the world while avoiding the obstacles. It uses two Camera devices in order to perform stereoscopy. In this example, the robot does not analyse the images it receives from the two cameras. The source code for this controller is in the binocular directory. 3.4.2 biped.wbtKeywords: Robot node, legged robot, servo_motor_off, active joint ![]() Figure 3.25: biped.wbt In this example a biped robot stands on its feet while turning its head. After a few seconds, all of its Servo devices are turned off and it falls to the ground. This example is good for illustrating how to build your own Robot. The source code for this controller is in the biped directory. 3.4.3 force_control.wbtKeywords: force control, linear Servo, Robot node, spring and damper ![]() Figure 3.26: force_control.wbt This example shows two Box nodes connected by a linear Servo. This demonstrates how to use the wb_servo_set_force() function in order to control a Servo's motion by torque or force. A simple spring and damping behaviour is achieved. The source code for this example can be found in: projects/samples/howto/controllers/force_control/force_control.c. For more information about this function, please refer to Webots Reference Manual. 3.4.4 inverted_pendulum.wbtKeywords: Robot node, inverted pendulum, PID, linear Servo ![]() Figure 3.27: inverted_pendulum.wbt In this example a robot moves from left to right in order to keep its pendulum vertical. This is the Inverted Pendulum problem, and it is solved in our example by using a PID (Proportional Integral Differential) controller. The source code for this controller is in the inverted_pendulum directory. 3.4.5 physics.wbtKeywords: DifferentialWheels, custom ODE plugin, OpenGL drawing, flying robot, MyBot, Emitter, Receiver ![]() Figure 3.28: physics.wbt In this example a robot flies using a custom ODE physics plugin. This plugins is an example of:
The source code for this controller is in the physics directory, and the ODE plugin is in the plugins / physics / flying_mybot directory. 3.4.6 supervisor.wbtKeywords: Supervisor, DifferentialWheels, soccer game, label, import node, restart simulation, screenshot, load controller ![]() Figure 3.29: supervisor.wbt In this example two teams of very simple robots play a soccer game in which the Supervisor is the referee. It is also used to display the scores, restart the game and import another ball in the game. The source code for this controller is in the supervisor directory, and the code for the players is in the soccer directory. 3.4.7 texture_change.wbtKeywords: DifferentialWheels, Supervisor, texture, supervisor_field_set, Camera, MyBot ![]() Figure 3.30: texture_change.wbt In this example a robot moves forward and backward in front of a large textured IndexedFaceSet panel. While the robot is using its Camera device to watch the panel, a Supervisor is alternating the images used as textures on the panel. The source code for the controller of the robot is in the texture_robot directory, and the code for the Supervisor is in texture_change. 3.4.8 town.wbtKeywords: Transform, USE, DEF ![]() Figure 3.31: town.wbt In this example, various Transform nodes are used with some DEF and USE nodes in order to create a complex, attractive "town." ![]() ^ page top ^ |
| E-mail to webmaster | Last updated: | Copyright © 2008 Cyberbotics Ltd. |