This repository contains a library with the protobuf messages used in the communication between the teams, VSSSReferee and TraveSim/TraveSim Adapters (or FIRASim).
There is a CMakeLists.txt
file in the root of this repository to make it easier to generate de header and source files for each .proto
file.
Note: for now the CMakeLists.txt
only supports generating for C++.
To be able to use the protobuf messages, make sure to have the Google Protocol Buffers installed. Besides that, in order to use the CMakeLists.txt
file, it is required to have cmake installed as well.
This library functions may be added to your projetc as a subtree or a submodule. In this way it allows its development in parallel.
The difference between submodule and subtree, in a simplified explanation, is that using subtree you will have a copy of this library inside your project's repository, whille using submodules the files in this library will not be saved inside your project's repository, there will just be a referance to a specific commit of this library inside your project's repository and you will have to initialize the submodule as described below.
To add this library as a subtree follow the steps below.
Add the subtree by doing in the root of your repository:
git subtree add --prefix proto https://github.com/ThundeRatz/vsss_sim_pb_msgs.git main --squash
To add this library as a submodule follow the steps below.
Add the submodule by doing in the root of your repository:
- With HTTPS:
git submodule add --name vsss_sim_pb_msgs https://github.com/ThundeRatz/vsss_sim_pb_msgs.git proto
- With SSH:
git submodule add --name vsss_sim_pb_msgs [email protected]:ThundeRatz/vsss_sim_pb_msgs.git proto
When cloning a repository that already has submodules, it is necessary to clone the repositories of that submodule. This can be done in two ways, by cloning together with the project repository or after you have already cloned.
Example:
To clone together, run the following command, switching to the repository link of your project:
git clone --recurse-submodules [email protected]:ThundeRatz/travesim_adapters.git
To clone having already cloned the project repository, within it, you should do:
git submodule update --init
To use this library, add as a subdirectory it in the top-level CMakeLists.txt
of your project, like this:
add_subdirectory(proto)
Then simply link your executable with the library by doing:
target_link_libraries(<your executable name>
pb_msgs_lib
)
Lastly, in order to include the protobuf header in your executable, it is possible to include as below:
#include "protobuf_file_name.pb.h"
For example, for the vssref_placement.proto
message, you would do:
#include "vssref_placement.pb.h"