Introduction To Webots
Introduction To Webots
2005.08.24
Outlines
• Introduction
• World Description
• Controller Programming
• A Kiki Example
Introduction
• Installation
– Download Webots Software
http://
www.cyberbotics.com/products/webots/download.ht
ml
• Installation
– Create user directory that contains three
subdirectories where Webots will look for files.
• World
• Controller
• Objects
Introduction
• Descriptions of Webots
– Features
• Webots is a mobile robot simulation software
• Webots allows users to create 3D virtual worlds with
physical properties.
• Descriptions of Webots
– Applications
• Mobile Robot Prototyping
• Multi-agent Research
• Adaptive Behavior Research
• Mobile Robotics Teaching
Introduction
Introduction
Introduction
Introduction
• Components of Webots
– World
• A world is a 3D virtual environment where you can create
objects and robots.
• A world is a hierarchical structure
– Controller
• Controller is a program to control the robot
• Controller may be executable (.exe) or Java binary files
(.class).
World Description
• World Coordinate
(-0.5, 0, -0.5) (0.5, 0, -0.5)
y
z x
• World Structure
– A world is composed of a list of nodes, each
World Scene
Background PointLight 4
containing fields.
Differential
Solid (wall)
– Fields can contain values or nodes.
Wheel (robot)
Solid Solid
(Left Wheel) (Right Wheel)
DistanceSensor DistanceSensor
(Left Eye) (Right Eye)
Name “ir0”
Translation
(-0.02, 0.1, 0.055)
Rotation
(0,1,0,1.57)
World Description
• Construction Tools
– Scene Tree Window
Controller Programming
• Program Framework
void reset(void){
– int main(void){ …..
robot_live(reset); }
robot_run(run)
int run(int ms){
} /* End of main-body */ …..;
return 64;
}
Controller Programming
• Programming Tools
– Dev C++
– Visual C++
– Java Development Kit (JDK)
• Library
– <install dir>\controller.dll
Kiki Example
Kiki Example
• World Construction
– PointLight Insertion
– Wall Building
– Robot Modeling
World Scene
Background PointLight 4
Differential
Solid (wall)
Wheel (robot)
Kiki Example
• World Construction
– PointLight Insertion
Kiki Example
• World Construction
– Wall Building
Kiki Example
• World Construction
– Wall Building
Solid (wall)
2 1
5 6 Shape
0: (0.5,0.5)
1: (0.5,-0.5)
Appearance Extrusion
2: (-0.5,-0.5)
diffuseColor convex
9: (-0.425,0.5)
x
8 7 crossSection
z
9 convex
3 4 0
Kiki Example
• World Construction
– Robot Modeling
Kiki Example
• World Construction
– Robot Modeling
0.1 0.1
0.02
0.01
0.02 0.02
0.1
0.02
0.03
0.06
x
0.02
z
0.1 0.1
0.02
0.01
0.02 0.02
0.1
0.02
Kiki Example
0.06
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Body)
Differential
Wheel (robot)
Transform
Translation
Size
Shape (0, 0.08, 0)
y
Box
Size z
Size
(0.1,0.1,0.1)
0.1 0.1
0.02
0.01
0.02 0.02
0.1
0.02
Kiki Example
0.06
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Wheel)
Differential
Wheel (robot)
2*Radius
Solid
Height
Transform
y
Translation
Shape (-0.06, 0.03, 0)
Rotation x
Cylinder (0,0,1,1.57)
Radius (0.03) z
Height (0.06)
0.1 0.1
0.02
0.01
0.02 0.02
0.1
0.02
Kiki Example
0.06
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Sensor)
Differential
Wheel (robot)
DistanceSensor Measured
Value
Name “ir0” (0, 1024, 0)
Transform 1024
(0.05, 1024, 0)
Translation (0.15, 0, 0)
Rotation
Shape (-0.02, 0.1, 0.055)
(0,0,1,1.57)
Rotation
0
(0,1,0,1.57) 0.05 0.15 Distance
Cylinder to Wall
lookupTable
Radius (0.01)
Height (0.01)
Kiki Example
• Controller Programming
– static DeviceTag ir0, ir1;
– void reset (void){
ir0 = robot_get_device(“ir0”);
ir1 = robot_get_device(“ir1”);
distance_sensor_enable(ir0, 64);
distance_sensor_enable(ir1, 64);
}/* End of reset */
Kiki Example
• Controller Programming
– int run (int ms){
short leftspeed, rightspeed;
int value0, value1;
value0 = distance_sensor_get_value(ir0);
value1 = distance_sensor_get_value(ir1);
leftspeed = …….;
Rightspeed = …..;
differential_wheels_set_speed(leftspeed, rightspeed);
return 64;
}/* End of run */
Kiki Example
• Control Setting
– Compile the program
– Save the kiki.exe to control directory
– Set controller to “kiki”
Differential
Wheel (robot)
controller
“kiki”
Reference