Python starter templates and utilities for URDF robots in Webots. Built to eliminate setup friction so you can focus on simulation.
Note: This repository is the dedicated Python successor to
webots-urdf-initializers, separated from compiled C/C++ controllers. This was in order to run the code as an external controller and integrate libraries.
webots-python/
├── src/
│ ├── IRB4600/
│ ├── Puma560/
│ ├── UR5e/
│ └── UR10e/
├── utils/
├── requirements.txt
└── README.md
Make sure your terminal uses the same Python interpreter set in Webots (Tools > Preferences > General > Python command):
pip install -r requirements.txtUsing VS Code lets you run and debug with F5, and makes it possible to use libraries alongside Webots.
-
Open your
.wbtworld in Webots. -
In the Scene Tree, expand your robot node, select the
controllerfield, and set it to<extern>. -
Save the world (
Ctrl + S) and press Play in Webots. -
Add a
.vscode/launch.jsonconfiguration pointingWEBOTS_HOME,PYTHONPATH, andPATHto your Webots installation (See the snippet below) -
Open any starter template in
src/inside VS Code and pressF5to connect and run immediately. Make sure it is the same robot as the template.
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Webots Extern Controller",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"WEBOTS_HOME": "C:\\Program Files\\Webots",
"PYTHONPATH": "C:\\Program Files\\Webots\\lib\\controller\\python",
"PATH": "${env:PATH};C:\\Program Files\\Webots\\lib\\controller;C:\\Program Files\\Webots\\msys64\\mingw64\\bin;C:\\Program Files\\Webots\\msys64\\mingw64\\bin\\cpp"
}
}
]
}This project is licensed under the MIT License — see the LICENSE file for details.