Skip to content

How to adapt your world or PROTO to Webots R2022b

ad-daniel edited this page Jul 5, 2022 · 13 revisions

What are EXTERNPROTO

PROTO nodes are a powerful way of describing complex objects or robots. From R2022b, all PROTO files used by a world need to be declared using the EXTERNPROTO keyword. Similarly, every PROTO inserted during the execution of the simulation by a supervisor needs to be declared an Ephemeral EXTERNPROTO prior to import it.

How are EXTERNPROTO declared

Under the hood, EXTERNPROTO and Ephemeral EXTERNPROTO are treated in the same manner, the distinction is useful for the user. When opening a world in R2022b, declared PROTO will look like:

#VRML_SIM R2022b utf8

EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/backgrounds/protos/TexturedBackground.proto"

WorldInfo {
  basicTimeStep 16
}
Viewpoint {
}
TexturedBackground {
}

In this case, the PROTO TexturedBackground will be retrieved from the corresponding url. The url can be defined multiple ways:

# remote PROTO
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/backgrounds/protos/TexturedBackground.proto"

# local PROTO (absolute path)
EXTERNPROTO "/home/user/Documents/my_project/protos/TexturedBackground.proto"

# local PROTO (relative path)
EXTERNPROTO "../protos/TexturedBackground.proto"

Preparing your worlds for R2022b

If your world was created before R2022a, generally speaking it should be sufficient for you to load it with Webots R2022b and click the save button. Doing so the backwards compatibility mechanism will do the declaration for you. In short, unless the PROTO used by the world is local (i.e., is defined in your protos folder) it will assume you are using the official Webots PROTO.

Clone this wiki locally