introduction to webots 2005.08.24. outlines introduction introduction world description world...

29
Introduction to Webots Introduction to Webots 2005.08.24 2005.08.24

Upload: jewel-pierce

Post on 20-Jan-2016

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Introduction to WebotsIntroduction to Webots

2005.08.242005.08.24

Page 2: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

OutlinesOutlines

• IntroductionIntroduction

• World DescriptionWorld Description

• Controller ProgrammingController Programming

• A Kiki ExampleA Kiki Example

Page 3: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

• InstallationInstallation– Download Webots SoftwareDownload Webots Software

http://http://

www.cyberbotics.com/products/webots/downloawww.cyberbotics.com/products/webots/download.htmld.html

– Double click on the webots-Double click on the webots-

4.0.27_setup.exe4.0.27_setup.exe

– Follow the installation instructionsFollow the installation instructions

Page 4: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

• InstallationInstallation

– Create user directory that contains three Create user directory that contains three

subdirectories where Webots will look subdirectories where Webots will look

for files.for files.

•WorldWorld

•ControllerController

•ObjectsObjects

Page 5: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

• Descriptions of WebotsDescriptions of Webots– FeaturesFeatures

•Webots is a mobile robot simulation softwareWebots is a mobile robot simulation software

•Webots allows users to create 3D virtual worlds Webots allows users to create 3D virtual worlds

with physical properties.with physical properties.

•A number of sensor and actuator devices can be A number of sensor and actuator devices can be

equipped to different robots.equipped to different robots.

•The user can program each robot individually to The user can program each robot individually to

exhibit a desired behavior.exhibit a desired behavior.

Page 6: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

• Descriptions of WebotsDescriptions of Webots

– ApplicationsApplications

•Mobile Robot PrototypingMobile Robot Prototyping

•Multi-agent ResearchMulti-agent Research

•Adaptive Behavior ResearchAdaptive Behavior Research

•Mobile Robotics TeachingMobile Robotics Teaching

Page 7: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

Page 8: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

Page 9: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

Page 10: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

IntroductionIntroduction

• Components of WebotsComponents of Webots– WorldWorld

•A world is a 3D virtual environment where you can A world is a 3D virtual environment where you can

create objects and robots.create objects and robots.

•A world is a hierarchical structureA world is a hierarchical structure

– ControllerController

•Controller is a program to control the robotController is a program to control the robot

•Controller may be executable (.exe) or Java binary Controller may be executable (.exe) or Java binary

files (.class). files (.class).

Page 11: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

World DescriptionWorld Description

• World CoordinateWorld Coordinate

x

y

z

(0.5, 0, 0.5)

(-0.5, 0, -0.5)

(-0.5, 0, 0.5)

(0.5, 0, -0.5)

Page 12: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

World DescriptionWorld Description

• World StructureWorld Structure

– A world is composed of a list of nodes, A world is composed of a list of nodes,

each containing fields.each containing fields.

– Fields can contain values or nodes.Fields can contain values or nodes.

World Scene

Background PointLight 4

DifferentialWheel (robot)

Solid (wall)

Solid(Left Wheel)

Solid(Right Wheel)

DistanceSensor(Left Eye)

DistanceSensor(Right Eye)

Name “ir0”

Translation(-0.02, 0.1, 0.055)

Rotation(0,1,0,1.57)

Page 13: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

World DescriptionWorld Description

• Construction ToolsConstruction Tools– Scene Tree WindowScene Tree Window

Page 14: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Controller ProgrammingController Programming

• Program FrameworkProgram Framework

– int main(void){int main(void){

robot_liverobot_live(reset);(reset);

robot_runrobot_run(run)(run)

} /* End of main-body */} /* End of main-body */

void reset(void){…..

}

int run(int ms){…..;return 64;

}

Page 15: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Controller ProgrammingController Programming

• Programming ToolsProgramming Tools– Dev C++Dev C++– Visual C++Visual C++– Java Development Kit (JDK)Java Development Kit (JDK)

• LibraryLibrary– <install dir>\controller.dll<install dir>\controller.dll

Page 16: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

Page 17: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction

– PointLight InsertionPointLight Insertion

– Wall BuildingWall Building

– Robot ModelingRobot ModelingWorld Scene

Background PointLight 4

DifferentialWheel (robot)

Solid (wall)

Page 18: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– PointLight InsertionPointLight Insertion

Page 19: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Wall BuildingWall Building

Page 20: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Wall BuildingWall Building

Solid (wall)

Shape

Appearance Extrusion

convex

crossSection

convex

diffuseColor

x

z8

9

0: (0.5,0.5)1: (0.5,-0.5)

7

2: (-0.5,-0.5)

0

9: (-0.425,0.5)

65

43

2 1

Page 21: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot ModelingRobot Modeling

Page 22: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot ModelingRobot Modeling

0.1

0.1

0.06

0.02

0.1

0.03

x

y

z

0.02

0.02

0.02

0.02

0.01

Page 23: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot Modeling (Body)Robot Modeling (Body)

DifferentialWheel (robot)

Transform

Translation(0, 0.08, 0)Shape

Box

Size(0.1,0.1,0.1)

Size z

Sizey

0.1

0.1

0.06

0.02

x

y

z

0.02

0.02

0.02

0.02

0.1

0.03

0.01

Page 24: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot Modeling (Wheel)Robot Modeling (Wheel)

Heigh

t

x

y

z

2*RadiusDifferential

Wheel (robot)

Solid

Transform

Translation(-0.06, 0.03, 0)Shape

Cylinder

Radius (0.03)

Height (0.06)

Rotation(0,0,1,1.57)

0.1

0.1

0.06

0.02

x

y

z

0.02

0.02

0.02

0.02

0.1

0.03

0.01

Page 25: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot Modeling (Sensor)Robot Modeling (Sensor)

0.1

0.1

0.06

0.02

x

y

z

0.02

0.02

0.02

0.02

0.1

0.03

0.01

DifferentialWheel (robot)

DistanceSensor

Name “ir0”Transform

Translation(-0.02, 0.1, 0.055)Shape

Cylinder

Radius (0.01)

Height (0.01)

Rotation(0,1,0,1.57)

Rotation(0,0,1,1.57)

lookupTable

MeasuredValue

Distanceto Wall

1024

00.05 0.15

(0, 1024, 0)(0.05, 1024, 0)

(0.15, 0, 0)

Page 26: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• Controller ProgrammingController Programming– static static DeviceTagDeviceTag ir0, ir1; ir0, ir1; – void reset (void){void reset (void){

ir0 = ir0 = robot_get_devicerobot_get_device(“ir0”);(“ir0”);

ir1 = ir1 = robot_get_devicerobot_get_device(“ir1”);(“ir1”);

distance_sensor_enabledistance_sensor_enable(ir0, 64);(ir0, 64);

distance_sensor_enabledistance_sensor_enable(ir1, 64);(ir1, 64);

}/* End of reset */}/* End of reset */

Page 27: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• Controller ProgrammingController Programming– int run (int ms){int run (int ms){

short leftspeed, rightspeed;short leftspeed, rightspeed;

int value0, value1; int value0, value1;

value0 = value0 = distance_sensor_get_valuedistance_sensor_get_value(ir0);(ir0);

value1 = value1 = distance_sensor_get_valuedistance_sensor_get_value(ir1); (ir1);

leftspeed = …….;leftspeed = …….;

Rightspeed = …..;Rightspeed = …..;

differential_wheels_set_speeddifferential_wheels_set_speed(leftspeed, (leftspeed, rightspeed);rightspeed);

return 64; return 64;

}/* End of run */}/* End of run */

Page 28: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

Kiki ExampleKiki Example

• Control SettingControl Setting– Compile the programCompile the program

– Save the kiki.exe to control directorySave the kiki.exe to control directory

– Set controller to “kiki”Set controller to “kiki”

DifferentialWheel (robot)

controller“kiki”

Page 29: Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming

ReferenceReference

• Webots User GuideWebots User Guide

• Webots Reference ManualWebots Reference Manual