Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing global coordinate frame in webots

Tags:

I just started with webots and are faced with the following problem:

Webots global coordinate frame defines its y-axis to show upwards (gravity vectory with negative y-component). However I would like to build a world around a coordinate frame in which the z-axis shows upwards.

Is it possibly to change this globally?

Thank you for your replies.

like image 325
Jan-Felix Klein Avatar asked Feb 06 '19 15:02

Jan-Felix Klein


2 Answers

Yes, this is possible following these steps:

  • The objects (Webots PROTOs or "level-0" Transform) should be rotated so that their bottom points towards the Z axis (negative). You can do this using the gizmo of the 3D view after selecting an object.
  • The WorldInfo.gravity field should be changed to 0 0 -9.81. In addition to change the gravity, this parameter also affects the way that the viewpoint move using the mouse.
  • WorldInfo.north should be modified if you plan to use Compass sensors in the simulation.
  • The cubic textures released in Webots for the background sky cube are oriented along the y-axis. Rotating them is not straight-forward. Removing the Background.cubmap is a quick solution, but it would avoid to have a good-looking rendering (PBR materials won't work well without a textured background). To go further, you have to create a custom set of textures for your world ($YOUR_PROJECT/worlds/textures/cubic/*.png). Probably that switching/rotating/renaming the textures is sufficient.

Note that in Webots, the global y-axis is upwards because of the VRML and X3D legacy. Lot of X3D exporters like Blender allow to change the down axis during the export. => It's not a bad idea to use the y-axis down :-)

like image 82
FabienRohrer Avatar answered Oct 09 '22 22:10

FabienRohrer


Since Webots R2020b, gravity is not a vector anymore. Instead, you can set the value of coordinateSystem field to ENU in the WorldInfo node:
https://cyberbotics.com/doc/reference/worldinfo

However, note that the coordinateSystem field will not affect the axis system of the objects. If you want to change an object's axis system to e.g. FLU (x-Forward, y-Left, z-Up) then you have to modify the object manually.

like image 43
Darko Lukić Avatar answered Oct 09 '22 22:10

Darko Lukić