Skip to content
Benjamin Délèze edited this page May 4, 2022 · 15 revisions

This page explains how to compile Wrenjs and test locally the streaming viewer and the animation player.

Building the dependencies

To compile Wrenjs, you will need:

  • Python 3
  • Emscripten to compile WREN in webassembly.
  • pyclibrary to extract the enumerations and functions' names from the C headers.

Linux

On Linux there are two solutions. In both cases you need to restart the terminal after installing the dependencies but before compiling Wrenjs.

  1. Install the dependencies automatically with sudo ./scripts/install/linux_optional_compilation_dependencies.sh from webots home.
  2. Install them manually. To do so, follow these instructions:

pyclibrary

Enter the following command in a terminal: pip install pyclibrary

Emscripten

Run the following commands in a terminal:

# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

Add the following line in your .bashrc source "path_to_emsdk_folder/emsdk_env.sh" >/dev/null 2>&1.

Windows

Follow the instructions in the Optional Dependencies for Windows.

MacOS

Follow the instructions in the Optional Dependencies for MacOS.

Compiling Wrenjs

Wrenjs is automatically compiled when you execute make either in Webots home or in webots/src/wren if all the dependencies are correctly installed.

Warning: if you already make Webots before installing the dependencies needed for Wrenjs, you will need to make clean either in Webots home or in webots/src/wren in order for Wrenjs to be built the next time you execute make.

Testing locally

  • Only for streaming viewer: Launch webots with the --stream option
  • Change the link to https://cyberbotics.com/wwi/R2022b/WebotsView.js in webots/resources/web/streaming_viewer/index.html (for testing the streaming viewer) or in animation_file_name.html (to test an animation) to point towards the local file. This file is located in webots/resources/web/wwi/.
  • If you made some changes in the css, change the link https://cyberbotics.com/wwi/R2022b/css/toolbar.css in webots/resources/web/wwi/WebotsView.js to point toward the local file in webots/resources/web/wwi/css
  • If you made some changes in wrenjs.js (so in the WebAssembly part), change the links in webots/resources/web/wwi/WebotsView.js to point towards the local files. The links to change are: https://cyberbotics.com/wwi/R2022b/, https://cyberbotics.com/wwi/R2022b/wrenjs.js and https://cyberbotics.com/wwi/R2022b/enum.js. Those files are located in webots/resources/web/wwi/.
  • Create a local http server with these instructions. The server should be able to reach webots/resources/web/wwi/ and webots/resources/web/streaming_viewer or your animation files.
  • Open webots/resources/web/streaming_viewer/index.html or your animation_file_name.html in the local server.
Clone this wiki locally