Developer Installation#

This installation type is intended for those that want to contribute to the development of the project. Compared to Stable and Nightly, this installation type provides a simplified setup for development, VCS integration, and debugging.

Depending on whether you want to target the Stable or Nightly channels, you have to clone respectively the master or devel branch. Check our support policy to select the right distribution of Gz to install.

Dependencies#

The developer installation requires finding in the system other dependencies not required by the other installation types. In those cases, we rely on setuptools to download, install, and find all the necessary third-party dependencies.

  1. iDynTree: gym_gz provides helper classes to manipulate the kinematics and the dynamics of rigid-bodies. Among the many existing solutions, we selected the algorithms implemented in iDynTree.

    Follow the official installation instructions and make sure that you also enable and install the Python bindings.

    You can verify that the installation succeeded and your system is properly configured if you can import idyntree.bindings in a Python interpreter.

C++ Project#

From the root of the repository and from the branch you are interested, you can configure, compile, and install the CMake project as follows:

cd scenario/
cmake -S . -B build
cmake --build build/
cmake --build build/ --target install

Note

The default install prefix of the CMake project is /usr/local. If you want to use a different folder, pass -DCMAKE_INSTALL_PREFIX=/new/install/prefix to the first cmake command.

Attention

The SWIG bindings are installed in the site-packages folder of the active Python interpreter. If you have an active virtual environment, it will be automatically detected. We rely on CMake’s logic for detecting Python, visit FindPython3 for more details.

Virtual Environment (optional)#

This step is optional but highly recommended. Visit the virtual environments documentation for more details.

sudo apt install virtualenv
virtualenv -p python3.8 $HOME/venv
source $HOME/venv/bin/activate

Note that the activation is temporary and it is valid only in the same terminal. Make sure to execute the next steps in a terminal where the virtual environment is active.

Editable Python Installation#

Install the Python package in editable mode. From the root of the repository:

pip install -e scenario/
pip install -e .

The editable installation only symlinks the resources of the repository into the active Python installation. It allows to develop directly operating on the files of the repository and use the updated package without requiring to install it again.

Note

The scenario editable installation is just a placeholder. It is necessary to prevent the editable installation of gym-gz to override the resources installed by the manual CMake execution. Otherwise, the scenario package from PyPI would be pulled, resulting with a wrong version.

System Configuration#

This section applies only to the installations that require building Gz from sources.

If you installed Gz from sources, you likely used colcon and therefore the entire suite was installed in a custom folder called workspace. The workspace contains all the shared libraries and executables of Gz, including the plugins loaded during runtime. Since we cannot know in advance where you created the workspace, gym-gz is not able to find the physics plugins.

After you enabled the workspace by sourcing its bash script, you may need to also export the following variable:

export GZ_SIM_PHYSICS_ENGINE_PATH=${GZ_SIM_PHYSICS_ENGINE_PATH}:${COLCON_PREFIX_PATH}/lib/ign-physics-3/engine-plugins/

Make sure to select the folder corresponding to the correct version of ign-physics, otherwise the wrong plugins are found.