Introduction to Webots 2005.08.24. Outlines Introduction Introduction World Description World Description Controller Programming Controller Programming.

Post on 20-Jan-2016

224 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Introduction to WebotsIntroduction to Webots

2005.08.242005.08.24

OutlinesOutlines

• IntroductionIntroduction

• World DescriptionWorld Description

• Controller ProgrammingController Programming

• A Kiki ExampleA Kiki Example

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

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

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.

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

IntroductionIntroduction

IntroductionIntroduction

IntroductionIntroduction

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).

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)

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)

World DescriptionWorld Description

• Construction ToolsConstruction Tools– Scene Tree WindowScene Tree Window

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;

}

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

Kiki ExampleKiki Example

Kiki ExampleKiki Example

• World ConstructionWorld Construction

– PointLight InsertionPointLight Insertion

– Wall BuildingWall Building

– Robot ModelingRobot ModelingWorld Scene

Background PointLight 4

DifferentialWheel (robot)

Solid (wall)

Kiki ExampleKiki Example

• World ConstructionWorld Construction– PointLight InsertionPointLight Insertion

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Wall BuildingWall Building

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

Kiki ExampleKiki Example

• World ConstructionWorld Construction– Robot ModelingRobot Modeling

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

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

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

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)

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 */

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 */

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”

ReferenceReference

• Webots User GuideWebots User Guide

• Webots Reference ManualWebots Reference Manual

top related