Skip to content

Commit f3cfa3b

Browse files
committed
reworking architecture, want a simplet handshake between devices
1 parent 5bfaac8 commit f3cfa3b

17 files changed

+1044
-348
lines changed

.clang-format

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 2
3+
TabWidth: 2
4+
UseTab: Never
5+
ColumnLimit: 100
6+
AllowShortFunctionsOnASingleLine: Inline
7+
BreakBeforeBraces: Allman
8+
SpacesInParentheses: false
9+
SpaceAfterCStyleCast: true
10+
SpaceBeforeParens: ControlStatements
11+
PointerAlignment: Left
12+
AlignConsecutiveAssignments: true
13+
AlignConsecutiveDeclarations: true
14+
AlignTrailingComments: true
15+
SortIncludes: true
16+
IncludeBlocks: Preserve
17+
NamespaceIndentation: All
18+
ReflowComments: true
19+
Cpp11BracedListStyle: true
20+
Standard: Latest

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"files.associations": {
3-
"functional": "cpp"
3+
"functional": "cpp",
4+
"vector": "cpp",
5+
"deque": "cpp",
6+
"list": "cpp",
7+
"string": "cpp",
8+
"unordered_map": "cpp",
9+
"unordered_set": "cpp",
10+
"forward_list": "cpp",
11+
"system_error": "cpp",
12+
"array": "cpp",
13+
"regex": "cpp"
414
},
515
"codium.codeCompletion.enable": false
616
}

CMakeLists.txt

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ project(spaceether LANGUAGES C CXX VERSION 1.0.0)
77
option(SPACEE_BUILD_TOOLS "Build SpaceEther example tools" ON)
88
option(SPACEE_BUILD_TESTS "Build SpaceEther test suite" ON)
99
option(SPACEE_SANITIZE "Enable ASan/UBSan" OFF)
10-
option(SPACEE_ENABLE_AUTH "Enable HMAC footer verification" OFF)
11-
option(SPACEE_WITH_ROS2 "Build ROS 2 bridge and ROS 2 tests" OFF)
10+
11+
# Always compile with authentication enabled. If SPACEE_AUTH_KEY is
12+
# unset at runtime the HMAC will be omitted, but the code remains
13+
# available. This avoids surprise compile‑time omissions.
14+
set(SPACEE_ENABLE_AUTH ON CACHE BOOL "Enable HMAC footer verification" FORCE)
15+
16+
# Enable ROS 2 integration by default. The bridge and tests will be
17+
# built when a ROS 2 installation is present. On systems without
18+
# ROS 2 the CMake script will gracefully skip these targets.
19+
set(SPACEE_WITH_ROS2 ON CACHE BOOL "Build ROS 2 bridge and ROS 2 tests" FORCE)
1220

1321
# -------------------------
1422
# Toolchain / warnings
@@ -45,13 +53,12 @@ set(SPACEE_CORE_SOURCES
4553
src/raw_udp.cpp
4654
)
4755

48-
if(SPACEE_ENABLE_AUTH)
49-
list(APPEND SPACEE_CORE_SOURCES
50-
src/hmac_sha256.c
51-
src/sha256.c
52-
)
53-
add_compile_definitions(SPACEE_ENABLE_AUTH)
54-
endif()
56+
# Always include HMAC support. The code itself will skip HMAC
57+
# generation when SPACEE_AUTH_KEY is unset at runtime.
58+
list(APPEND SPACEE_CORE_SOURCES
59+
src/hmac_sha256.c
60+
src/sha256.c
61+
)
5562

5663
# -------------------------
5764
# Library
@@ -75,29 +82,32 @@ if(SPACEE_BUILD_TOOLS)
7582
target_link_libraries(se_terminal PRIVATE space_ether Threads::Threads)
7683
endif()
7784

78-
# # -------------------------
79-
# # Optional ROS 2 bridge (no ament_target_dependencies; keyword linking only)
80-
# # -------------------------
81-
# if(SPACEE_WITH_ROS2)
82-
# find_package(rclcpp QUIET)
83-
# find_package(std_msgs QUIET)
84-
# if(rclcpp_FOUND AND std_msgs_FOUND)
85-
# if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/ros2_shim.cpp")
86-
# target_sources(space_ether PRIVATE src/ros2_shim.cpp)
87-
# endif()
88-
89-
# add_executable(spaceether_ros2_bridge bridges/spaceether_ros2_bridge.cpp)
90-
# target_link_libraries(spaceether_ros2_bridge
91-
# PRIVATE
92-
# space_ether
93-
# Threads::Threads
94-
# rclcpp::rclcpp
95-
# std_msgs::std_msgs
96-
# )
97-
# else()
98-
# message(STATUS "ROS 2 (rclcpp/std_msgs) not found — skipping spaceether_ros2_bridge.")
99-
# endif()
100-
# endif()
85+
# -------------------------
86+
# Optional ROS 2 bridge (no ament_target_dependencies; keyword linking only)
87+
# -------------------------
88+
if(SPACEE_WITH_ROS2)
89+
find_package(rclcpp QUIET)
90+
find_package(std_msgs QUIET)
91+
if(rclcpp_FOUND AND std_msgs_FOUND)
92+
# Build the RTPS shim into the core library if available
93+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/ros2_shim.cpp")
94+
target_sources(space_ether PRIVATE src/ros2_shim.cpp)
95+
endif()
96+
# Build the example ROS 2 bridge. This executable bridges
97+
# SpaceEther frames to ROS 2 std_msgs/String messages for
98+
# demonstration purposes.
99+
add_executable(spaceether_ros2_bridge bridges/spaceether_ros2_bridge.cpp)
100+
target_link_libraries(spaceether_ros2_bridge
101+
PRIVATE
102+
space_ether
103+
Threads::Threads
104+
rclcpp::rclcpp
105+
std_msgs::std_msgs
106+
)
107+
else()
108+
message(STATUS "ROS 2 (rclcpp/std_msgs) not found — skipping spaceether_ros2_bridge.")
109+
endif()
110+
endif()
101111

102112
# tests/CMakeLists.txt
103113

0 commit comments

Comments
 (0)