Skip to content

How to adapt your world or PROTO to Webots R2022a

joachimhgg edited this page Dec 17, 2021 · 3 revisions

New axis system for geometries, devices, and PROTOs

Starting from the R2022a version, all geometries, devices, and PROTOs that come with Webots use the FLU axis orientation (x-Forward, y-Left, and z-Up, see #3073). We introduced the update to be consistent with ROS (see REP 103) and other robotics systems. If your Webots world uses Webots geometries, devices, and PROTOs then you will probably need to adapt your world.

spot2021b.png spot2022a.png
spot.wbt in 2021b: spot is RUB and the world is NUE. spot.wbt in 2022a: spot is FLU and the world is ENU.

How to adapt your world or PROTO to Webots R2022a

Backward compatibility mechanism

We introduced a backward compatibility mechanism (see #3619) to adapt worlds automatically. This mechanism will be launched when you open a world in the R2022a version. It will keep the same axis orientation and objects axis system you had before but it will rotate the geometries and devices to retrieve the old behavior. Nevertheless, the mechanism has limited capabilities and it is likely you will need to assist the world adaptation.

  • If your world or PROTO does not contain too many objects, you should simply adapt them as wanted using the interface and save it.

  • If your world or PROTO is too complex to be handled by hand, you should directly use the script to convert it to ENU/FLU (see automatic conversion to ENU FLU). Instead of the backward compatibility algorithm, this script can perform children nodes conversion and takes in charge some of the Webots PROTOs which can be useful to avoid to rotate them by hand.

In any case, it is important to understand how Webots nodes are affected by the update and how they should be rotated to preserve the old behavior:

Node Required rotation to preserve the old behavior Strategy code
Cylinder B1
Capsule B1
ElevationGrid B1
Cone B1
Plane B1
Camera A2
Lidar A2
Radar A2
Viewpoint A1
Track A2
Pen A2
Emitter A2
Receiver A2
Connector A2
TouchSensor A2
Webots PROTOs , but there are numerous exceptions to this rule as we haven't followed any specific convention C

Automatic conversion to ENU FLU

This script convert_nue_to_enu_rub_to_flu.py intends to help you to adapt your world or PROTOs from an old version to the new version of Webots. You can find detailed explanations into the script (dependencies, usage, limitations and conversion process).

village_realistic.png village_realistic_converted.png
Example of a complex world (village_realistic.wbt) after backward compatibility algorithm. Example of a complex world after the execution of the script.

This script will convert your world from NUE to ENU and the objects contained in the world from RUB to FLU. It could be needed to rotate some parts by hand.

Simple usage:

python3 convert_nue_to_enu_rub_to_flu.py /your_path_to_your_projects/worlds/my_world.wbt

If your PROTO is RUB (x-Right, y-Up, z-Back) and does not contain JavaScript or Lua code, you can convert it to FLU using the same script. You may have to rotate some parts of your PROTOs by hand.

Notes: check that the conversion went successfully by displaying the different renderings View/Optional rendering. In addition, we advise you to check the differences of your .wbt or .proto before and after the script with a text comparator.

Convert forest to FLU

To meet the Forest.proto R2022a version, you need to convert your .forest files. you can use the script convert_forest_flu.py:

python convert_forest_flu.py /path/to/forest/file.forest

New axis system recommendations (Optional)

Once the world and PROTOs have the desired behavior in Webots R2022a, you can change the object axis system to FLU and the world axis system to ENU. Indeed, as of Webots R2022a, we recommend the FLU (x-Forward, y-Left, and z-Up) axis orientation for objects and ENU (x-East, y-North, and z-Up, see Axes conventions ) for worlds.

Convert PROTOs to FLU

If your PROTO file does not contain JavaScript or Lua code and it follows the RUB axis system (x-Right, y-Up, z-Back) then you can use the script convert_proto.py:

python scripts/converter/convert_proto.py /path/to/PROTO/file.PROTO

Convert worlds to ENU

You can use the script convert_nue_to_enu.py to convert NUE worlds to ENU axis system:

python scripts/converter/convert_nue_to_enu.py /path/to/world/file.wbt
Clone this wiki locally