2.3.2 Open Simulation Interface (OSI) Python Bindings
This section explains how to integrate OSI into your own Python project. The Python bindings are available in the separate osi-python repository.
2.3.2.1 Installing using pip (Recommended)
Currently OSI is not yet published to pypi.org and thus must be installed from the osi-python` repository directly.
- Steps
-
-
Open a terminal.
-
Optionally create and activate a new virtual environment.
Linux Windows python3 -m venv venvsource venv/bin/activatepython -m venv venvvenv\Scripts\activate -
Install Open Simulation Interface:
pip install git+https://github.com/OpenSimulationInterface/osi-python.git
-
Now you can start a python shell or script and import from
osi3andosi3tracee.g.python3 -c "from osi3.osi_sensorview_pb2 import SensorView"
-
You can of course specify
osi-pythonas dependency in yourpyproject.toml[project] # ... dependencies = [ "osi-python @ git+https://github.com/OpenSimulationInterface/osi-python.git" ]
-
2.3.2.2 Installing from source
- Prerequisites
-
-
Python 3.10 or later.
-
pip.
-
- Steps
-
-
Open a terminal.
-
Clone the osi-python repository:
git clone --recurse-submodules https://github.com/OpenSimulationInterface/osi-python.git
-
Switch to the repository directory:
cd osi-python
-
Optionally create and activate a new virtual environment (see table above).
-
Install Open Simulation Interface:
pip install .
-