-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Wrenjs
This page explains how to compile Wrenjs and test locally the streaming viewer and the animation player.
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.
On Linux there are two solutions. In both cases you need to restart the terminal after installing the dependencies but before compiling Wrenjs.
- Install the dependencies automatically with
sudo ./scripts/install/linux_optional_compilation_dependencies.sh
from webots home. - Install them manually. To do so, follow these instructions:
Enter the following command in a terminal: pip install pyclibrary
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
.
Follow the instructions in the Optional Dependencies for Windows.
Follow the instructions in the Optional Dependencies for MacOS.
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
.
- Only for streaming viewer: Launch webots with the --stream option
- Change the link to
https://cyberbotics.com/wwi/R2022b/WebotsView.js
inwebots/resources/web/streaming_viewer/index.html
(for testing the streaming viewer) or inanimation_file_name.html
(to test an animation) to point towards the local file. This file is located inwebots/resources/web/wwi/
. - If you made some changes in the css, change the link
https://cyberbotics.com/wwi/R2022b/css/toolbar.css
inwebots/resources/web/wwi/WebotsView.js
to point toward the local file inwebots/resources/web/wwi/css
- If you made some changes in
wrenjs.js
(so in the WebAssembly part), change the links inwebots/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
andhttps://cyberbotics.com/wwi/R2022b/enum.js
. Those files are located inwebots/resources/web/wwi/
. - Create a local http server with these instructions. The server should be able to reach
webots/resources/web/wwi/
andwebots/resources/web/streaming_viewer
or your animation files. - Open
webots/resources/web/streaming_viewer/index.html
or youranimation_file_name.html
in the local server.