- The script creates a snapshot of all the running ROS topics and services available at the moment,
- then generates a standalone package in your catkin workspace, which implements the gRPC server as a ROS node.
- Protobuf has no equivalent for constants in ROS messages, so they are added as comments to the proto message definitions.
uint8[]
andchar[]
ROS array types are represented asbytes
in Protobuf (like in the python msg generator)- Only ROS Noetic is supported (because it needs python3)
- The whole generator is implemented as a Jupyter notebook and a cookiecutter template, so feel free to try changes and suggest modifications :)
Clone the repo into a catkin workspace:
# in your_catkit_ws/src
git clone https://github.com/azazdeaz/ros-grpc-bridge-generator.git
install dependencies and build
# in your_catkit_ws
rosdep update
rosdep install --from-paths src --ignore-src -r -y
catkin_make
roslaunch grpc_bridge_generator generate.launch pkg_name:=grpc_bridge
# now, the new pkg should be in your workspace
# install its deps and build it:
rosdep install --from-paths src --ignore-src -r -y
catkin_make
- see the available arguments in generate.launch
roslaunch grpc_bridge server.launch
- see the available arguments in server.launch
You can find an example catkin workspace at https://github.com/azazdeaz/ros-grpc-bridge-generator-example
The script is implemented as a Jupyter Notebook, so it's easy to poke around and tailor the generator for your project.
To launch the editor, just run:
rosrun grpc_bridge_generator notebook
Executing this notebook is equivalent to running generate.launch
.
The end-to-end tests are a bunch of snapshot files in the test/snapshots folder and their pre-generated packages in the test/expected folder.
Running rostest grpc_bridge_generator generate.test
will regenerate these packages in the test/result folder and compare them with the expected folder. It will fail for any changes. To update the tests, override the files in the test/expected folder.
To add a new test, copy a snapshot file in test/snapshots, run the tests, and move the generated pkg from the result to the expected folder.
There are also some doctests in the generate.ipynb but only to make the development easier. They will run with the notebook.
- It's an ini file (python configparse format) used as the only source for the gRPC server generator
- Generated by default but can be edited manually
- You can tell the generate script to use an edited snapshot instead of generating a new one (see options)
- Has three sections:
TOPICS
,SERVICES
, andMESSAGE_DEFINITIONS
- Keys are ordered alphabetically for easier editing/diffing
- Nested message definitions are normalized (flattened)