Thanks to visit codestin.com
Credit goes to github.com

Skip to content

STY3131/webots-grpc

 
 

Repository files navigation

webots-grpc

This project is a simple gateway convert from gRPC to webots socket IPC API. It follow some rules.

  • extern control
  • 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]
Loading

tree

If you have no robot description file, descriptions folder offer some basic one.

build

uv run python -m grpc_tools.protoc -I ./protos --python_out=./generated --pyi_out=./generated --grpc_python_out=./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=./generated --pyi_out=./generated --grpc_python_out=./generated --doc_out=./doc --doc_opt=html,index.html ./protos/*.proto

reflection tool to help you list service grpcurl -plaintext localhost:50051 list grpcurl -plaintext localhost:50051 describe device.DeviceService

for linux

export WEBOTS_HOME=/usr/local/webots
uv run "${WEBOTS_HOME}/webots-controller" --robot-name='Picker' ./webots_grpc/server.py

for windows

If you use MSYS2 as state, export WEBOTS_HOME=C:\Program Files\Webots

I don't find out way to integrate WEBOTS_HOME yet

Or using uv directly config python path,

; .env
PYTHONPATH=C:\Program Files\Webots\lib\controller\python

extern controller, e.g.

& "C:\Program Files\Webots\msys64\mingw64\bin\webots-controller.exe" --help

& "C:\Program Files\Webots\msys64\mingw64\bin\webots-controller.exe" --robot-name='IRB 4600/40' xxx.py

& "C:\Program Files\Webots\msys64\mingw64\bin\webots-controller.exe" --robot-name='Picker' picker_cntrl_gateway.py

uv run "C:\Program Files\Webots\msys64\mingw64\bin\webots-controller.exe" --robot-name='Picker' .\webots_grpc\server.py

uv run python -m tests.client

CPP

conan build . --build=missing

Aware that dependencies protobuf, grpc, abseil have to be static link, since protoc require static linked to work properly.

If you encounter validation error, following command will help you explicitly set shared to false.

conan build . --build=missing -o protobuf/*:shared=False -o grpc/*:shared=False -o abseil/*:shared=False

About

webots grpc gateway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 56.5%
  • C++ 38.8%
  • CMake 4.7%