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/dow
nload.html
– Double click on the webots4.0.27_setup.exe
– Follow the installation instructions
Introduction
• 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.
• A number of sensor and actuator devices can
be equipped to different robots.
• The user can program each robot individually
Introduction
• 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
(-0.5, 0, 0.5)
x
(0.5, 0, 0.5)
World Description
• World Structure
World Scene
– A world is composed
of a list of nodes, each
Background
containing
fields.
PointLight 4
Differential
Wheel (robot)
Solid (wall)
– Fields can contain values or nodes.
Solid
(Left Wheel)
DistanceSensor
(Left Eye)
Solid
(Right Wheel)
DistanceSensor
(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
– int main(void){
robot_live(reset);
void reset(void){
…..
}
robot_run(run)
} /* End of main-body */
int run(int ms){
…..;
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
Solid (wall)
PointLight 4
Differential
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
0: (0.5,0.5)
1: (0.5,-0.5)
2: (-0.5,-0.5)
Shape
6
Appearance
Extrusion
diffuseColor
8
x
9: (-0.425,0.5)
crossSection
7
z
3 4
9
convex
0
convex
Kiki Example
• World Construction
– Robot Modeling
Kiki Example
• World Construction
– Robot Modeling
0.1
0.02
0.02
0.1
0.01
0.02
0.02
0.1
0.06
y
x
0.02
z
0.03
0.1
0.02
0.02
0.1
0.01
0.02
0.02
0.06
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Body)
Differential
Wheel (robot)
Transform
Box
Size
(0.1,0.1,0.1)
Size
y
Shape
Translation
(0, 0.08, 0)
Size z
Si
ze
x
0.1
Kiki Example
0.1
0.02
0.02
0.1
0.01
0.02
0.02
0.1
0.06
Kiki Example
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Wheel)
Differential
Wheel (robot)
2*Radius
Solid
Shape
Translation
(-0.06, 0.03, 0)
Cylinder
Rotation
(0,0,1,1.57)
Radius (0.03)
Height (0.06)
Height
Transform
y
x
z
0.1
0.02
0.02
0.1
0.01
0.02
0.02
0.1
0.06
Kiki Example
y
0.03
x
0.02
z
• World Construction
– Robot Modeling (Sensor)
Differential
Wheel (robot)
DistanceSensor
Transform
Shape
Rotation
(0,0,1,1.57)
Name “ir0”
Translation
(-0.02, 0.1, 0.055)
Rotation
(0,1,0,1.57)
Cylinder
lookupTable
Radius (0.01)
Height (0.01)
Measured
Value
1024
(0, 1024, 0)
(0.05, 1024, 0)
(0.15, 0, 0)
0
0.05 0.15 Distance
to Wall
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);
Kiki Example
• Control Setting
– Compile the program
– Save the kiki.exe to control directory
– Set controller to “kiki”
Differential
Wheel (robot)
controller
“kiki”
Reference
• Webots User Guide
• Webots Reference Manual