Skip to content

Commit ac42594

Browse files
authored
Merge pull request #214 from esteve/jazzy-turtlebot4-packages
chore: add TurtleBot 4 packages
2 parents c7482d2 + e62d5fe commit ac42594

6 files changed

Lines changed: 348 additions & 0 deletions

File tree

packages-ignore.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
rti-connext-dds-5.3.1:
33
conda-forge: []
44

5+
# System service/runtime package used by TurtleBot 4 setup.
6+
network-manager:
7+
robostack: []
8+
59
# rmw_cyclonedds_cpp:
610
# conda-forge: []
711
# rviz_ogre_vendor:

patch/dependencies.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ backward_ros:
9292
# binutils is added only on linux to avoid the -liberty library not found in macos
9393
# see https://github.com/RoboStack/ros-jazzy/pull/95#issuecomment-3113166166
9494
add_host: ["${{ 'binutils' if linux }}", "${{ 'elfutils' if linux }}", "ros-jazzy-ament-cmake-libraries"]
95+
depthai:
96+
add_host: ["${{ 'elfutils' if linux }}"]
9597
nav2_smac_planner:
9698
add_build: ["${{ 'llvm-openmp' if osx }}"]
9799
add_host: ["${{ 'llvm-openmp' if osx }}", "ompl", "libode"]

patch/ros-jazzy-depthai.patch

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Esteve Fernandez <esteve@apache.org>
3+
Date: Tue, 12 May 2026 14:01:42 +0100
4+
Subject: [PATCH] fix(depthai): make conda builds use bundled release sources
5+
6+
Signed-off-by: Esteve Fernandez <esteve@apache.org>
7+
8+
---
9+
CMakeLists.txt | 2 ++
10+
shared/depthai-bootloader-shared.cmake | 37 ++++++++++++++++++----------------
11+
shared/depthai-shared.cmake | 35 +++++++++++++++++---------------
12+
3 files changed, 41 insertions(+), 33 deletions(-)
13+
14+
diff --git a/CMakeLists.txt b/CMakeLists.txt
15+
index 109d9da..24d9aff 100644
16+
--- a/CMakeLists.txt
17+
+++ b/CMakeLists.txt
18+
@@ -60,6 +60,8 @@ else()
19+
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
20+
endif()
21+
22+
+set(HUNTER_ROOT "${CMAKE_BINARY_DIR}/.hunter" CACHE PATH "Hunter package cache")
23+
+set(DEPTHAI_ENABLE_CURL OFF CACHE BOOL "Enable CURL support" FORCE)
24+
include("cmake/HunterGate.cmake")
25+
HunterGate(
26+
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
27+
diff --git a/shared/depthai-bootloader-shared.cmake b/shared/depthai-bootloader-shared.cmake
28+
index d0db905..3bdb1b0 100644
29+
--- a/shared/depthai-bootloader-shared.cmake
30+
+++ b/shared/depthai-bootloader-shared.cmake
31+
@@ -29,25 +29,28 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
32+
OUTPUT_VARIABLE statusCommit
33+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
34+
)
35+
- string(SUBSTRING ${statusCommit} 0 1 status)
36+
- if("${status}" STREQUAL "-")
37+
- message(FATAL_ERROR "Submodule 'depthai-bootloader-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
38+
+ if(statusCommit)
39+
+ string(SUBSTRING "${statusCommit}" 0 1 status)
40+
+ if("${status}" STREQUAL "-")
41+
+ message(FATAL_ERROR "Submodule 'depthai-bootloader-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
42+
+ endif()
43+
endif()
44+
endif()
45+
46+
- # Get depthai-bootloader-shared current commit
47+
- execute_process(
48+
- COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
49+
- WORKING_DIRECTORY ${DEPTHAI_BOOTLOADER_SHARED_FOLDER}
50+
- RESULT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT
51+
- OUTPUT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH
52+
- ERROR_QUIET
53+
- OUTPUT_STRIP_TRAILING_WHITESPACE
54+
- )
55+
- if(${DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT} EQUAL 0)
56+
- set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND TRUE)
57+
- else()
58+
- set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND FALSE)
59+
+ set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND FALSE)
60+
+ if(EXISTS "${DEPTHAI_BOOTLOADER_SHARED_FOLDER}/.git")
61+
+ # Release archives include shared sources without a nested Git checkout.
62+
+ execute_process(
63+
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
64+
+ WORKING_DIRECTORY ${DEPTHAI_BOOTLOADER_SHARED_FOLDER}
65+
+ RESULT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT
66+
+ OUTPUT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH
67+
+ ERROR_QUIET
68+
+ OUTPUT_STRIP_TRAILING_WHITESPACE
69+
+ )
70+
+ if(DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT EQUAL 0)
71+
+ set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND TRUE)
72+
+ endif()
73+
endif()
74+
endif()
75+
76+
@@ -56,4 +59,4 @@ foreach(source_file ${DEPTHAI_BOOTLOADER_SHARED_SOURCES})
77+
if(NOT EXISTS ${source_file})
78+
message(FATAL_ERROR "depthai-bootloader-shared submodule files missing. Make sure to download prepackaged release instead of \"Source code\" on GitHub. Example: depthai-core-vX.Y.Z.tar.gz")
79+
endif()
80+
-endforeach()
81+
\ No newline at end of file
82+
+endforeach()
83+
diff --git a/shared/depthai-shared.cmake b/shared/depthai-shared.cmake
84+
index 414e1eb..94a007d 100644
85+
--- a/shared/depthai-shared.cmake
86+
+++ b/shared/depthai-shared.cmake
87+
@@ -35,25 +35,28 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
88+
OUTPUT_VARIABLE statusCommit
89+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
90+
)
91+
- string(SUBSTRING ${statusCommit} 0 1 status)
92+
- if("${status}" STREQUAL "-")
93+
- message(FATAL_ERROR "Submodule 'depthai-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
94+
+ if(statusCommit)
95+
+ string(SUBSTRING "${statusCommit}" 0 1 status)
96+
+ if("${status}" STREQUAL "-")
97+
+ message(FATAL_ERROR "Submodule 'depthai-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
98+
+ endif()
99+
endif()
100+
endif()
101+
102+
- # Get depthai-shared current commit
103+
- execute_process(
104+
- COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
105+
- WORKING_DIRECTORY ${DEPTHAI_SHARED_FOLDER}
106+
- RESULT_VARIABLE DEPTHAI_SHARED_COMMIT_RESULT
107+
- OUTPUT_VARIABLE DEPTHAI_SHARED_COMMIT_HASH
108+
- ERROR_QUIET
109+
- OUTPUT_STRIP_TRAILING_WHITESPACE
110+
- )
111+
- if(${DEPTHAI_SHARED_COMMIT_RESULT} EQUAL 0)
112+
- set(DEPTHAI_SHARED_COMMIT_FOUND TRUE)
113+
- else()
114+
- set(DEPTHAI_SHARED_COMMIT_FOUND FALSE)
115+
+ set(DEPTHAI_SHARED_COMMIT_FOUND FALSE)
116+
+ if(EXISTS "${DEPTHAI_SHARED_FOLDER}/.git")
117+
+ # Release archives include shared sources without a nested Git checkout.
118+
+ execute_process(
119+
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
120+
+ WORKING_DIRECTORY ${DEPTHAI_SHARED_FOLDER}
121+
+ RESULT_VARIABLE DEPTHAI_SHARED_COMMIT_RESULT
122+
+ OUTPUT_VARIABLE DEPTHAI_SHARED_COMMIT_HASH
123+
+ ERROR_QUIET
124+
+ OUTPUT_STRIP_TRAILING_WHITESPACE
125+
+ )
126+
+ if(DEPTHAI_SHARED_COMMIT_RESULT EQUAL 0)
127+
+ set(DEPTHAI_SHARED_COMMIT_FOUND TRUE)
128+
+ endif()
129+
endif()
130+
endif()
131+
132+
--
133+
2.54.0
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Esteve Fernandez <esteve@apache.org>
3+
Date: Tue, 12 May 2026 14:02:58 +0100
4+
Subject: [PATCH] fix(turtlebot4-base): support both libgpiod 1 and 2
5+
6+
Signed-off-by: Esteve Fernandez <esteve@apache.org>
7+
8+
---
9+
CMakeLists.txt | 7 ++++
10+
include/turtlebot4_base/gpio_interface.hpp | 5 ++-
11+
src/gpio_interface.cpp | 66 ++++++++++++++++++++++++++++++
12+
3 files changed, 77 insertions(+), 1 deletion(-)
13+
14+
diff --git a/CMakeLists.txt b/CMakeLists.txt
15+
index 6aeeea9..aeb64b4 100644
16+
--- a/CMakeLists.txt
17+
+++ b/CMakeLists.txt
18+
@@ -25,6 +25,12 @@ find_package(std_msgs REQUIRED)
19+
find_package(sensor_msgs REQUIRED)
20+
find_package(turtlebot4_msgs REQUIRED)
21+
find_package(turtlebot4_node REQUIRED)
22+
+find_package(PkgConfig REQUIRED)
23+
+pkg_check_modules(GPIOD REQUIRED libgpiod)
24+
+
25+
+if(NOT GPIOD_VERSION VERSION_LESS 2.0)
26+
+ add_definitions(-DTURTLEBOT4_BASE_GPIOD_V2)
27+
+endif()
28+
29+
find_library(gpiod_library NAMES libgpiod.so)
30+
31+
@@ -32,6 +38,7 @@ find_library(gpiod_library NAMES libgpiod.so)
32+
33+
include_directories(
34+
include
35+
+ ${GPIOD_INCLUDE_DIRS}
36+
)
37+
38+
add_library(${PROJECT_NAME}_lib
39+
diff --git a/include/turtlebot4_base/gpio_interface.hpp b/include/turtlebot4_base/gpio_interface.hpp
40+
index c25317e..b1b27a3 100644
41+
--- a/include/turtlebot4_base/gpio_interface.hpp
42+
+++ b/include/turtlebot4_base/gpio_interface.hpp
43+
@@ -19,7 +19,6 @@
44+
#ifndef TURTLEBOT4_BASE__GPIO_INTERFACE_HPP_
45+
#define TURTLEBOT4_BASE__GPIO_INTERFACE_HPP_
46+
47+
-#include <linux/gpio.h>
48+
#include <gpiod.h>
49+
50+
#include <string>
51+
@@ -56,7 +55,11 @@ private:
52+
53+
gpiod_chip * chip_;
54+
55+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
56+
+ std::map<uint8_t, gpiod_line_request *> lines_;
57+
+#else
58+
std::map<uint8_t, gpiod_line *> lines_;
59+
+#endif
60+
};
61+
62+
} // namespace turtlebot4_base
63+
diff --git a/src/gpio_interface.cpp b/src/gpio_interface.cpp
64+
index 3127ba3..a21b977 100644
65+
--- a/src/gpio_interface.cpp
66+
+++ b/src/gpio_interface.cpp
67+
@@ -50,7 +50,16 @@ GpioInterface::GpioInterface(const uint8_t & gpio_chip_number)
68+
*/
69+
void GpioInterface::open_chip()
70+
{
71+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
72+
+ std::string gpio_chip_path = gpio_chip_;
73+
+ if (gpio_chip_path.empty() || gpio_chip_path.front() != '/') {
74+
+ gpio_chip_path = "/dev/" + gpio_chip_path;
75+
+ }
76+
+
77+
+ chip_ = gpiod_chip_open(gpio_chip_path.c_str());
78+
+#else
79+
chip_ = gpiod_chip_open_by_name(gpio_chip_.c_str());
80+
+#endif
81+
}
82+
83+
/**
84+
@@ -59,7 +68,11 @@ void GpioInterface::open_chip()
85+
void GpioInterface::close_chip()
86+
{
87+
for (auto line : lines_) {
88+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
89+
+ gpiod_line_request_release(line.second);
90+
+#else
91+
gpiod_line_release(line.second);
92+
+#endif
93+
}
94+
95+
gpiod_chip_close(chip_);
96+
@@ -70,6 +83,47 @@ void GpioInterface::close_chip()
97+
*/
98+
void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
99+
{
100+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
101+
+ unsigned int offset = line;
102+
+ gpiod_request_config * request_config = gpiod_request_config_new();
103+
+ gpiod_line_config * line_config = gpiod_line_config_new();
104+
+ gpiod_line_settings * line_settings = gpiod_line_settings_new();
105+
+
106+
+ if (request_config == nullptr || line_config == nullptr || line_settings == nullptr) {
107+
+ gpiod_request_config_free(request_config);
108+
+ gpiod_line_config_free(line_config);
109+
+ gpiod_line_settings_free(line_settings);
110+
+ std::cerr << "Failed to configure GPIO Line" << std::endl;
111+
+ return;
112+
+ }
113+
+
114+
+ if (direction != LINE_DIRECTION_INPUT && direction != LINE_DIRECTION_OUTPUT) {
115+
+ gpiod_request_config_free(request_config);
116+
+ gpiod_line_config_free(line_config);
117+
+ gpiod_line_settings_free(line_settings);
118+
+ std::cerr << "Invalid GPIO Line Direction" << std::endl;
119+
+ return;
120+
+ }
121+
+
122+
+ gpiod_request_config_set_consumer(request_config, "Turtlebot4");
123+
+ gpiod_line_settings_set_direction(line_settings, static_cast<gpiod_line_direction>(direction));
124+
+ if (direction == LINE_DIRECTION_OUTPUT) {
125+
+ gpiod_line_settings_set_output_value(line_settings, GPIOD_LINE_VALUE_INACTIVE);
126+
+ }
127+
+ gpiod_line_config_add_line_settings(line_config, &offset, 1, line_settings);
128+
+
129+
+ gpiod_line_request * gpio_line = gpiod_chip_request_lines(chip_, request_config, line_config);
130+
+
131+
+ gpiod_request_config_free(request_config);
132+
+ gpiod_line_config_free(line_config);
133+
+ gpiod_line_settings_free(line_settings);
134+
+
135+
+ if (gpio_line != nullptr) {
136+
+ lines_.insert(std::pair<uint8_t, gpiod_line_request *>(line, gpio_line));
137+
+ } else {
138+
+ std::cerr << "Invalid GPIO Line" << std::endl;
139+
+ }
140+
+#else
141+
gpiod_line * gpio_line = gpiod_chip_get_line(chip_, line);
142+
143+
if (gpio_line != nullptr) {
144+
@@ -86,6 +140,7 @@ void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
145+
} else {
146+
std::cerr << "Invalid GPIO Line Direction" << std::endl;
147+
}
148+
+#endif
149+
}
150+
151+
/**
152+
@@ -93,7 +148,14 @@ void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
153+
*/
154+
void GpioInterface::write(uint8_t line, uint8_t value)
155+
{
156+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
157+
+ gpiod_line_request_set_value(
158+
+ lines_[line],
159+
+ line,
160+
+ value ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE);
161+
+#else
162+
gpiod_line_set_value(lines_[line], value);
163+
+#endif
164+
}
165+
166+
/**
167+
@@ -101,5 +163,9 @@ void GpioInterface::write(uint8_t line, uint8_t value)
168+
*/
169+
uint8_t GpioInterface::read(uint8_t line)
170+
{
171+
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
172+
+ return static_cast<uint8_t>(gpiod_line_request_get_value(lines_[line], line));
173+
+#else
174+
return gpiod_line_get_value(lines_[line]);
175+
+#endif
176+
}
177+
178+
--
179+
2.54.0

robostack.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ libgeos++-dev:
321321
robostack: [geos]
322322
libgflags-dev:
323323
robostack: [gflags]
324+
libgpiod-dev:
325+
robostack:
326+
linux: [libgpiod]
327+
osx: []
328+
win64: []
324329
libglew-dev:
325330
robostack: [glew]
326331
libglfw3-dev:
@@ -1015,6 +1020,11 @@ python3-yaml:
10151020
robostack: [pyyaml]
10161021
python3-zmq:
10171022
robostack: [pyzmq]
1023+
qml-module-qtquick-extras:
1024+
robostack:
1025+
linux: [qt-main, libopengl-devel, libgl-devel]
1026+
osx: [qt-main]
1027+
win64: [qt-main]
10181028
qt5-image-formats-plugins:
10191029
robostack:
10201030
linux: [qt-main, libopengl-devel, libgl-devel]

vinca.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,26 @@ packages_select_by_deps:
8282
- turtlebot3
8383
- turtlebot3_simulations
8484

85+
# TurtleBot 4 officially supports Linux only.
86+
- if: linux
87+
then:
88+
- turtlebot4_base
89+
- turtlebot4_bringup
90+
- turtlebot4_description
91+
- turtlebot4_desktop
92+
- turtlebot4_diagnostics
93+
- turtlebot4_gz_bringup
94+
- turtlebot4_gz_gui_plugins
95+
- turtlebot4_gz_toolbox
96+
- turtlebot4_msgs
97+
- turtlebot4_navigation
98+
- turtlebot4_node
99+
- turtlebot4_robot
100+
- turtlebot4_setup
101+
- turtlebot4_simulator
102+
- turtlebot4_tests
103+
- turtlebot4_viz
104+
85105
- ackermann-msgs
86106
- sbg_driver
87107

0 commit comments

Comments
 (0)