


Most of the changes I made in this step were to switch from glad headers to pure OpenGL headers
WEBOTS STEP UPDATE
I had to update the headers to support Emscripten. Change headers and exclude problematic functions However, I still wanted to mention it, because I think it can become a major challenge if you have big complicated dependencies, like a physics engine for example. We could add it to the build with the -I option.ĭue to the simplicity, for glm, and built-in support, for OpenGL, there was close to nothing to do with regard to the dependencies. Glad is an OpenGL loading library and is not needed because Emscripten handles this part. Luckily for me, Wren has only three dependencies: OpenGL, glad, and glm.Įmscripten has built-in support for OpenGL, but, logically, only for the WebGL2 compatible subset of OpenGL. Prepare the functions and/or enumerations for exportation.ĭependencies can quickly become a nightmare when you want to export your code with Emscripten.Reduce the number of dependencies if possible.To be able to compile the code with WebAssembly, I first needed to prepare it. In the pictures below you can see the graphical evolution allowed by Wren compiled in WebAssembly.

You will be able to find all the code produced during this project in this pull request from the Webots GitHub repository. To compile the C++ code to WebAssembly, I used Emscripten. Three.js works well but it has some fundamental differences with Wren and so it was really difficult to obtain the same graphical quality both in Webots desktop and on the web.Īfter a thorough analysis, we decided to invest time and port Wren to WebAssembly. Before, we were using Three.js as a rendering engine to display Webots simulations on the web. You can then see the resulting animations or streams in a browser.
WEBOTS STEP MOVIE
However, the public API of Wren is in C, we will see why later, but it is important.Īdditionally, Webots offers the possibility to record animations of simulations (think of a movie but where you are able to navigate the scene during the playback) or to stream simulations. Wren is written in C++ and is relying on OpenGL 3.3. To fit its need, Webots has its own rendering engine: Wren (Webots Rendering Engine). Webots is an open-source robot simulator. In this article, I want to share challenges, solutions to problems I encountered, and the final results. I recently compiled the whole rendering engine of Webots, more than 15’000 lines of code, from C++ to WebAssembly. gedit ~/.Screenshot of a Webots simulation running with a WebAssembly compiled Rendering Engine.
WEBOTS STEP INSTALL
rosdep update rosdep install -from-paths src -ignore-src -rosdistro $ROS_DISTRO colcon buildĪdd the sourcing of the workspace to the bashrc file. cd ~/webots/src git clone -recurse-submodules -b $ROS_DISTRO webots_ros2 Build Either go to the file explorer in Linux and delete the webots_ros2 folder manually, or you can run the following commands to delete the folder. Go to the following directory: cd webots/src/webots_ros2/webots_ros2_importer/webots_ros2_importer git clone cd urdf2webots pip3 install -r requirements.txtĪt this stage, I was having install errors when I tried to build the package. Press CTRL+C in all terminal windows to shutdown the demo.
