A gRPC gateway for Webots robot simulation controllers, enabling remote control and integration.
Project description
webots-grpc
This project is a simple gateway convert from gRPC to webots socket IPC API. It follow some rules.
- webots extern controller
- synchronous simulation
graph LR
A[Webots] <-->|API| B[Python extern controller gRPC service gateway]
B <-->|gRPC| D[Python gRPC client app]
B <-->|gRPC| C[CPP gRPC client app]
run gateway (gRPC server)
for the most simple way
export WEBOTS_HOME=/usr/local/webots
uvx --from webots-grpc webots-grpc-gateway --robot-name="{ROBOT_NAME}"
development
gateway (gRPC server)
uv run python -m webots_grpc --robot-name="{ROBOT_NAME}"
uv run webots-grpc-gateway --robot-name="{ROBOT_NAME}"
# pipx run --spec . webots-grpc-gateway --robot-name="{ROBOT_NAME}"
# uvx --from git+https://github.com/existedinnettw/webots-grpc.git webots-grpc-gateway --robot-name="{ROBOT_NAME}"
webots-grpc-gateway is actually a wrapper for script, webots_grpc/server.py. webots-grpc-gateway will find webots controller automatically based on WEBOTS_HOME and execute the script automatically.
For development purpose, you can run the script though webots controller directly.
build
Create service from proto file,
uv run python -m grpc_tools.protoc -I ./protos --python_out=./webots_grpc/generated --pyi_out=./webots_grpc/generated --grpc_python_out=./webots_grpc/generated ./protos/*.proto
or generate document by protoc-gen-doc plugin at the same time
uv run python -m grpc_tools.protoc -I ./protos --python_out=./webots_grpc/generated --pyi_out=./webots_grpc/generated --grpc_python_out=./webots_grpc/generated --doc_out=./doc --doc_opt=html,index.html ./protos/*.proto
Fix python import issue
uv run protol --create-package --in-place --python-out ./webots_grpc/generated protoc --protoc-path "uv run python -m grpc_tools.protoc" --proto-path=./protos ./protos/*.proto
compile executable
And if want to build exe file,
Configure additional module search paths, like PYTHONPATH #9168 option to specify a project root directory to be added to the python path
PYTHONPATH="${WEBOTS_HOME}/lib/controller/python" uv run python -m nuitka --include-module=controller --onefile --assume-yes-for-downloads ./webots_grpc/server.py --jobs=8
execution on linux
Modify your own robot name.
export WEBOTS_HOME=/usr/local/webots
uv run "${WEBOTS_HOME}/webots-controller" --robot-name='robot' ./webots_grpc/server.py
execution on windows
If you use MSYS2 as state, export WEBOTS_HOME=C:\Program Files\Webots
I don't find out way to integrate
WEBOTS_HOMEyet
Or using uv directly config python path,
; .env
PYTHONPATH=C:\Program Files\Webots\lib\controller\python
uv run "C:\Program Files\Webots\msys64\mingw64\bin\webots-controller.exe" --robot-name='robot' .\webots_grpc\server.py
client
There are cpp and python client API support with unittests, plz refer python test tests/README.md for more information.
PYTHON
uv run python -m pytest
CPP
Check cpp client test src/tests
conan build . --build=missing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webots_grpc-0.1.3.tar.gz.
File metadata
- Download URL: webots_grpc-0.1.3.tar.gz
- Upload date:
- Size: 13.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61fa6813fcb73a881e22ae05ec95b56e3596a22d47cb8b56999dc2a96e0c499b
|
|
| MD5 |
f9af1fc9000a4c77ad71133e3b36857f
|
|
| BLAKE2b-256 |
169901a352ad091ed230df80831367f46d696657ddc284497f06c46602897434
|
File details
Details for the file webots_grpc-0.1.3-py3-none-any.whl.
File metadata
- Download URL: webots_grpc-0.1.3-py3-none-any.whl
- Upload date:
- Size: 36.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e6839d4412ff07e4c7400070615faf0dc9d6cad2fb1534f0a8ffddffb96b0a5
|
|
| MD5 |
ea880cc7f0ad9643f792b72986fc49d6
|
|
| BLAKE2b-256 |
85dc92987bcf95b827cfa0a17642687f32f4060c3cfed75339b260f11ab4625a
|