Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- name: Run util/ubuntu-setup as sudo
run: "./util/ubuntu-setup -y"
run: "./util/ubuntu-setup -y --no-submodules"

- name: Build
run: source /opt/ros/humble/setup.bash && colcon build --parallel-workers 4
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[submodule "external/style-configs"]
path = external/style-configs
url = https://github.com/robojackets/style-configs
[submodule "src/rj_protos/ssl-game-controller"]
path = src/rj_protos/ssl-game-controller
url = https://github.com/RoboCup-SSL/ssl-game-controller.git
[submodule "src/rj_protos/ssl-simulation-protocol"]
path = src/rj_protos/ssl-simulation-protocol
url = https://github.com/RoboCup-SSL/ssl-simulation-protocol.git
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,6 @@ checktidy-lines:
@echo "Removing GCC precompiled headers from compile_commands.json so that clang-tidy will work"
@sed -i 's/-include [^ ]*cmake_pch\.hxx//' $(COMPILE_COMMANDS_DIR)/compile_commands.json
@git diff -U0 --no-color $(DIFFBASE) | python3 util/clang-tidy-diff.py -clang-tidy-binary $(CLANG_TIDY_BINARY) -p1 -path $(COMPILE_COMMANDS_DIR) -j$(CORES) -checks=-google-runtime-references

update-submodules:
git submodule update --init --recursive
2 changes: 1 addition & 1 deletion src/rj_common/include/rj_common/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <memory>
#include <set>

#include <rj_protos/referee.pb.h>
#include <rj_protos/state/ssl_gc_referee_message.pb.h>

#include "rj_common/control/motion_setpoint.hpp"
#include "rj_common/debug_drawer.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/rj_common/include/rj_common/referee_enums.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <rj_protos/referee.pb.h>

#include <string>

#include <rj_protos/state/ssl_gc_referee_message.pb.h>

namespace referee_module_enums {

using Stage = Referee_Stage;
Expand Down
6 changes: 3 additions & 3 deletions src/rj_common/include/rj_common/team_info.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include <rj_protos/referee.pb.h>
#include <string>
#include <vector>

#include <rj_common/time.hpp>
#include <rj_msgs/msg/team_info.hpp>
#include <string>
#include <vector>
#include <rj_protos/state/ssl_gc_referee_message.pb.h>

// Information about a single team.
class TeamInfo {
Expand Down
2 changes: 0 additions & 2 deletions src/rj_geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ find_package(Eigen3 REQUIRED)
find_package(eigen3_cmake_module REQUIRED)
find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(fmt REQUIRED)
find_package(rj_protos REQUIRED)
find_package(rj_convert REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)
Expand All @@ -23,7 +22,6 @@ find_package(rj_geometry_msgs REQUIRED)
set(RJ_GEOMETRY_DEPS
Eigen3
fmt
rj_protos
rj_convert
rj_geometry_msgs
)
Expand Down
1 change: 0 additions & 1 deletion src/rj_geometry/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<depend>eigen3</depend>
<depend>std_msgs</depend>

<depend>rj_protos</depend>
<depend>rj_convert</depend>
<depend>rj_geometry_msgs</depend>

Expand Down
124 changes: 95 additions & 29 deletions src/rj_protos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.20)
project(rj_protos LANGUAGES CXX)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand All @@ -8,50 +8,115 @@ endif()
find_package(ament_cmake REQUIRED)
find_package(Protobuf REQUIRED)

protobuf_generate_cpp(
PROTOBUF_SRCS
PROTOBUF_HDRS
protos/grSim_Commands.proto
protos/grSim_Packet.proto
protos/grSim_Replacement.proto
protos/referee.proto
protos/ssl_gc_common.proto
protos/ssl_gc_geometry.proto
protos/ssl_gc_game_event.proto
protos/ssl_simulation_config.proto
protos/ssl_simulation_control.proto
protos/ssl_simulation_error.proto
protos/ssl_simulation_robot_control.proto
protos/ssl_simulation_robot_feedback.proto
protos/ssl_simulation_synchronous.proto
protos/ssl_vision_detection.proto
protos/ssl_vision_geometry.proto
protos/ssl_vision_wrapper.proto
set(GC_PROTO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/ssl-game-controller/proto)
set(SIM_PROTO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/ssl-simulation-protocol/proto)
set(SIM_PROTO_ROOT ${CMAKE_CURRENT_BINARY_DIR}/sim_proto)
set(GEN_ROOT ${CMAKE_CURRENT_BINARY_DIR}/gen)
set(GEN_DIR ${GEN_ROOT}/rj_protos)

set(GC_PROTOS
state/ssl_gc_common.proto
state/ssl_gc_game_event.proto
state/ssl_gc_referee_message.proto
geom/ssl_gc_geometry.proto
vision/ssl_vision_detection.proto
vision/ssl_vision_geometry.proto
vision/ssl_vision_wrapper.proto
)

set(SIM_PROTOS
ssl_simulation_config.proto
ssl_simulation_control.proto
ssl_simulation_error.proto
ssl_simulation_robot_control.proto
ssl_simulation_robot_feedback.proto
ssl_simulation_synchronous.proto
)

# There are duplicate protos in ssl-game-controller and ssl-simulation-protocol.
# In order to avoid duplicates, we rename the imports in ssl-simulation-protocol
# to point to the ssl-game-controller ones instead.
set(SIM_IMPORT_REWRITES
"ssl_gc_common.proto" "state/ssl_gc_common.proto"
"ssl_vision_detection.proto" "vision/ssl_vision_detection.proto"
"ssl_vision_geometry.proto" "vision/ssl_vision_geometry.proto"
)

if(NOT EXISTS ${SIM_PROTO_SRC} OR NOT EXISTS ${GC_PROTO_ROOT})
message(FATAL_ERROR
"Proto submodule is missing. "
"From the repo root, run: make update-submodules")
endif()

foreach(proto ${SIM_PROTOS})
file(READ ${SIM_PROTO_SRC}/${proto} content)
set(rewrites ${SIM_IMPORT_REWRITES})
while(rewrites)
list(POP_FRONT rewrites from to)
string(REPLACE "import \"${from}\";" "import \"${to}\";" content "${content}")
endwhile()
file(CONFIGURE OUTPUT ${SIM_PROTO_ROOT}/${proto} CONTENT "${content}" @ONLY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SIM_PROTO_SRC}/${proto})
endforeach()

set(PROTO_FILES)
foreach(proto ${GC_PROTOS})
list(APPEND PROTO_FILES ${GC_PROTO_ROOT}/${proto})
endforeach()
foreach(proto ${SIM_PROTOS})
list(APPEND PROTO_FILES ${SIM_PROTO_ROOT}/${proto})
endforeach()

set(PROTO_SRCS)
set(PROTO_HDRS)
foreach(proto ${GC_PROTOS} ${SIM_PROTOS})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIM_PROTO_SRC is src/rj_protos/ssl-simulation-protocol/proto, set on line 12. file(READ) opens ssl_simulation_config.proto and the rest of SIM_PROTOS. If the submodule was never checked out, CMake stops with its own vague message, along the lines of file failed to open for reading plus that path. Nothing in that message says the submodule is missing or what command to run, so maybe add a check + a fatal error message indicating an easy fix for any user who encounters this:

if(NOT EXISTS ${proto_root})
message(FATAL_ERROR
"Proto submodule is missing at ${proto_root}. "
"From the repo root, run: make update-submodules")

string(REGEX REPLACE "\\.proto$" "" proto_base ${proto})
set(proto_src ${GEN_DIR}/${proto_base}.pb.cc)
set(proto_hdr ${GEN_DIR}/${proto_base}.pb.h)
if(proto IN_LIST GC_PROTOS)
set(proto_file ${GC_PROTO_ROOT}/${proto})
else()
set(proto_file ${SIM_PROTO_ROOT}/${proto})
endif()
add_custom_command(
OUTPUT ${proto_src} ${proto_hdr}
COMMAND ${CMAKE_COMMAND} -E make_directory ${GEN_DIR}
COMMAND protobuf::protoc
--cpp_out=${GEN_DIR}
-I ${GC_PROTO_ROOT}
-I ${SIM_PROTO_ROOT}
${proto_file}
DEPENDS ${PROTO_FILES} protobuf::protoc
COMMENT "Running C++ protocol buffer compiler on ${proto}"
VERBATIM
)
list(APPEND PROTO_SRCS ${proto_src})
list(APPEND PROTO_HDRS ${proto_hdr})
endforeach()

add_library(${PROJECT_NAME} SHARED
${PROTOBUF_HDRS}
${PROTOBUF_SRCS}
${PROTO_SRCS}
${PROTO_HDRS}
)

target_link_libraries(${PROJECT_NAME}
protobuf::libprotobuf
)

target_include_directories(${PROJECT_NAME}
INTERFACE
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
PUBLIC
$<BUILD_INTERFACE:${GEN_ROOT}>
$<BUILD_INTERFACE:${GEN_DIR}>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include/rj_protos>
)

target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated-declarations)

ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(Protobuf)

install(
DIRECTORY ${CMAKE_BINARY_DIR}
DIRECTORY ${GEN_DIR}
DESTINATION include
FILES_MATCHING PATTERN "*.pb.h"
)

install(
Expand All @@ -63,5 +128,6 @@ install(
INCLUDES DESTINATION include
)

ament_export_targets(${PROJECT_NAME})
ament_export_targets(${PROJECT_NAME} HAS_LIBRARY_TARGET)
ament_export_dependencies(Protobuf)
ament_package()
30 changes: 15 additions & 15 deletions src/rj_protos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Reusable assessment, refactor, and verification template.

| Package Details | Entry |
| --- | --- |
| **Package name** | |
| **Assigned owner(s)** | |
| **Reviewer(s)** | |
| **Date started revision** | |
| **Package name** | `rj_protos` |
| **Assigned owner(s)** | Sanat Dhanyamraju |
| **Reviewer(s)** | Cameron Lyon, Nate Wert |
| **Date started revision** | 9/1/2026 |

## 1. Package Identity and Tier

Define the package's purpose and fixed architectural classification before work starts.

| Field | Details |
| --- | --- |
| **Plain-language purpose** | _Explain what the package does so a new contributor can understand it._ |
| **Current responsibilities** | _List the responsibilities currently owned by this package._ |
| **Out of scope** | _State what this package must not own or attempt to solve._ |
| **Plain-language purpose** | Contains protobuf files for SSL-owned interfaces such as game controller and vision processor. |
| **Current responsibilities** | Owns the protocol for receiving data from SSL-owned interfaces. |
| **Out of scope** | Does not contain any logic behind how these messages are parsed or how the data is used. |

## 2. Dependency Rules

Expand All @@ -27,24 +27,24 @@ Map package relationships before adding, deleting, or moving code. Dependency di

| Field | Details |
| --- | --- |
| **Depends on** | _Enter the explicit dependency list from `package.xml`._ |
| **Depended on by** | _List packages, executables, or systems that consume this package._ |
| **Depends on** | None |
| **Depended on by** | `rj_common`, `rj_radio`, `rj_referee`, `rj_utils`, `rj_vision_receiver` |


## 3. Operational Expectations

| Field | Details |
| --- | --- |
| **Failure behavior** | _Describe behavior when an upstream input, sensor, network link, radio, or other dependency fails._ |
| **Recovery behavior** | _Describe automatic recovery, retry, fallback, and operator intervention requirements._ |
| **Configuration** | _List required parameters, defaults, validation rules, and configuration files._ |
| **Failure behavior** | If the SSL protos migrate to a different repo, this will no longer stay up-to-date with SSL. |
| **Recovery behavior** | Modify the package to submodule the new repo. |
| **Configuration** | CMakeLists.txt contains the list of protos we build, this needs to be updated when we want to use a new proto from SSL. |

## 4. Testing

### Test Coverage and Runtime Quality

| Field | Details |
| --- | --- |
| **Unit testing** | _Describe what unit tests were used on this package and how._ |
| **Coverage gaps** | _List untested algorithms, branches, failure paths, and outlier cases._ |
| **Observed outliers** | _Record flaky behavior, nondeterminism, timing spikes, or unexpected results._ |
| **Unit testing** | No testing exists as this package contains no code. |
| **Coverage gaps** | N/A |
| **Observed outliers** | N/A |
35 changes: 0 additions & 35 deletions src/rj_protos/protos/RadioTx.proto.legacy

This file was deleted.

22 changes: 0 additions & 22 deletions src/rj_protos/protos/grSim_Commands.proto

This file was deleted.

8 changes: 0 additions & 8 deletions src/rj_protos/protos/grSim_Packet.proto

This file was deleted.

22 changes: 0 additions & 22 deletions src/rj_protos/protos/grSim_Replacement.proto

This file was deleted.

Loading
Loading