Difference between revisions of "Webots"

From RoboWiki
Jump to: navigation, search
(About project)
(About project)
Line 9: Line 9:
 
Webots is used in several online robot programming contests. The Robotstadium[1] competition is a simulation of the RoboCup Standard Platform League. In this simulation two teams of Nao play soccer with rules similar to regular soccer. The robots use simulated cameras, ultrasound and pressure sensors. In the Rat's Life[2] competition two simulated e-puck robots compete for energy resources in a Lego maze. Matches are run on a daily basis and the results can be watched in online videos.
 
Webots is used in several online robot programming contests. The Robotstadium[1] competition is a simulation of the RoboCup Standard Platform League. In this simulation two teams of Nao play soccer with rules similar to regular soccer. The robots use simulated cameras, ultrasound and pressure sensors. In the Rat's Life[2] competition two simulated e-puck robots compete for energy resources in a Lego maze. Matches are run on a daily basis and the results can be watched in online videos.
  
== About project ==
+
== Example of source code ==
  
Webots is a professional robot simulator widely used for educational purposes. The Webots project started in 1996, initially developed by Dr. Olivier Michel at the Swiss Federal Institute of Technology (EPFL) in Lausanne, Switzerland.
+
<source lang="cpp">
Webots uses the ODE (Open Dynamics Engine) for detecting of collisions and simulating rigid body dynamics. The ODE library allows one to accurately simulate physical properties of objects su
+
if (simGetScriptExecutionCount()==0) then
 +
    -- This is executed exactly once, the first time this script is executed
 +
    bubbleRobBase=simGetObjectAssociatedWithScript(sim_handle_self) -- this is bubbleRob's handle
 +
    -- following is the handle of bubbleRob's associated UI (user interface):
 +
    ctrl=simGetUIHandle("bubbleCtrl")
 +
    -- Set the title of the user interface:
 +
    simSetUIButtonLabel(ctrl,0,simGetObjectName(bubbleRobBase).." speed")
 +
    leftMotor=simGetObjectHandle("leftMotor") -- Handle of the left motor
 +
    rightMotor=simGetObjectHandle("rightMotor") -- Handle of the right motor
 +
    noseSensor=simGetObjectHandle("sensingNose") -- Handle of the proximity sensor
 +
    minMaxSpeed={50*math.pi/180,300*math.pi/180} -- Min and max speeds for each motor
 +
    backUntilTime=-1 -- Tells whether bubbleRob is in forward or backward mode
 +
end
 +
 
 +
-- if any child script is attached to the bubbleRob tree, this command will execute it/them:
 +
simHandleChildScript(sim_handle_all_except_explicit)
 +
-- Retrieve the desired speed from the user interface:
 +
speed=minMaxSpeed[1]+(minMaxSpeed[2]-minMaxSpeed[1])*simGetUISlider(ctrl,3)/1000
 +
 
 +
result=simReadProximitySensor(noseSensor) -- Read the proximity sensor
 +
-- If we detected something, we set the backward mode:
 +
if (result>0) then backUntilTime=simGetSimulationTime()+4 end
 +
 
 +
if (backUntilTime<simGetSimulationTime()) then
 +
    -- When in forward mode, we simply move forward at the desired speed
 +
    simSetJointTargetVelocity(leftMotor,speed)
 +
    simSetJointTargetVelocity(rightMotor,speed)
 +
else
 +
    -- When in backward mode, we simply backup in a curve at reduced speed
 +
    simSetJointTargetVelocity(leftMotor,-speed/2)
 +
    simSetJointTargetVelocity(rightMotor,-speed/8)
 +
end
 +
</source>

Revision as of 12:41, 19 June 2012

About project

Webots is a professional robot simulator widely used for educational purposes. The Webots project started in 1996, initially developed by Dr. Olivier Michel at the Swiss Federal Institute of Technology (EPFL) in Lausanne, Switzerland. Webots uses the ODE (Open Dynamics Engine) for detecting of collisions and simulating rigid body dynamics. The ODE library allows one to accurately simulate physical properties of objects such as velocity, inertia and friction. A large collection of freely modifiable robot models comes in the software distribution. In addition, it is also possible to build new models from scratch. When designing a robot model, the user specifies both the graphical and the physical properties of the objects. The graphical properties include the shape, dimensions, position and orientation, colors, and texture of the object. The physical properties include the mass, friction factor, as well as the spring and damping constants. Webots includes a set of sensors and actuators frequently used in robotic experiments, e.g. proximity sensors, light sensors, touch sensors, GPS, accelerometers, cameras, emitters and receivers, servo motors (rotational & linear), position and force sensor, LEDs, grippers, gyros and compass. The robot controller programs can be written in C, C++, Java, Python and MATLAB. The AIBO, Nao and E-puck robot models can also be programmed with the URBI language (URBI license required). Webots offers the possibility to take PNG screen shots and to record the simulations as MPEG (Mac/Linux) and AVI (Windows) movies. Webots worlds are stored in cross-platform .wbt files which format is based on the VRML language. It is also possible to import and export Webots worlds or objects in the VRML format. Another useful feature is that the user can interact with a running simulation at any time, i.e. it possible to move the robots and other object with the mouse. Webots is used in several online robot programming contests. The Robotstadium[1] competition is a simulation of the RoboCup Standard Platform League. In this simulation two teams of Nao play soccer with rules similar to regular soccer. The robots use simulated cameras, ultrasound and pressure sensors. In the Rat's Life[2] competition two simulated e-puck robots compete for energy resources in a Lego maze. Matches are run on a daily basis and the results can be watched in online videos.

Example of source code

if (simGetScriptExecutionCount()==0) then
    -- This is executed exactly once, the first time this script is executed
    bubbleRobBase=simGetObjectAssociatedWithScript(sim_handle_self) -- this is bubbleRob's handle
    -- following is the handle of bubbleRob's associated UI (user interface):
    ctrl=simGetUIHandle("bubbleCtrl")
    -- Set the title of the user interface: 
    simSetUIButtonLabel(ctrl,0,simGetObjectName(bubbleRobBase).." speed") 
    leftMotor=simGetObjectHandle("leftMotor") -- Handle of the left motor
    rightMotor=simGetObjectHandle("rightMotor") -- Handle of the right motor
    noseSensor=simGetObjectHandle("sensingNose") -- Handle of the proximity sensor
    minMaxSpeed={50*math.pi/180,300*math.pi/180} -- Min and max speeds for each motor
    backUntilTime=-1 -- Tells whether bubbleRob is in forward or backward mode
end

-- if any child script is attached to the bubbleRob tree, this command will execute it/them:
simHandleChildScript(sim_handle_all_except_explicit)
-- Retrieve the desired speed from the user interface: 
speed=minMaxSpeed[1]+(minMaxSpeed[2]-minMaxSpeed[1])*simGetUISlider(ctrl,3)/1000 

result=simReadProximitySensor(noseSensor) -- Read the proximity sensor
-- If we detected something, we set the backward mode:
if (result>0) then backUntilTime=simGetSimulationTime()+4 end 

if (backUntilTime<simGetSimulationTime()) then
    -- When in forward mode, we simply move forward at the desired speed
    simSetJointTargetVelocity(leftMotor,speed)
    simSetJointTargetVelocity(rightMotor,speed)
else
    -- When in backward mode, we simply backup in a curve at reduced speed
    simSetJointTargetVelocity(leftMotor,-speed/2)
    simSetJointTargetVelocity(rightMotor,-speed/8)
end