Automatic Protocol Buffers generation tool to link ROS2 and microcontroller. The protocol buffer developed by google is used to provide ros2-independent communication.
- Generate .proto file from ROS2 message
- Generate C++ protocol buffer API from .proto file
- Generate ANSI-C protocol buffer API from .proto file using Nanopb
- Generate function to interconversion between ROS2 message and Protocol Buffers
- ROS2 (humble or latest)
- Python3
Install dependencies
$ sudo apt update
$ sudo apt install protobuf-compiler libpaho-mqtt-dev libpaho-mqttpp-dev cmake ninja-build
Clone repository
$ git clone https://github.com/OUXT-Polaris/protolink.git
$ cd protolink
Note
It is recommended to create an external repository like protolink_drivers and add the protolink and geographic_msgs dependencies there.
When using geographic_msgs/GeoPose
Add denendent packages to package.xml
# <depend> .....
<depend>geographic_msgs</depend>
Add task to CMakeLists.txt
# include(cmake/add_protolink_message.cmake)....
add_protolink_message_from_ros_message("geographic_msgs" "GeoPose")
Generate .proto file and API
$ cmake -S . -B build -G "Ninja"
$ cmake --build build
Path of the generated API file
- C++ API: build/...
- ANSI-C API: build/nanopb-gen/...
- proto file: build/proto_file/...