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
4 changes: 4 additions & 0 deletions packages-ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
rti-connext-dds-5.3.1:
conda-forge: []

# System service/runtime package used by TurtleBot 4 setup.
network-manager:
robostack: []

# rmw_cyclonedds_cpp:
# conda-forge: []
# rviz_ogre_vendor:
Expand Down
4 changes: 3 additions & 1 deletion patch/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ backward_ros:
# binutils is added only on linux to avoid the -liberty library not found in macos
# see https://github.com/RoboStack/ros-jazzy/pull/95#issuecomment-3113166166
add_host: ["${{ 'binutils' if linux }}", "${{ 'elfutils' if linux }}", "ros-humble-ament-cmake-libraries"]
depthai:
add_host: ["${{ 'elfutils' if linux }}"]
nav2_smac_planner:
add_build: ["${{ 'llvm-openmp' if osx }}"]
add_host: ["${{ 'llvm-openmp' if osx }}", "ompl", "libode"]
Expand Down Expand Up @@ -293,4 +295,4 @@ franka_ign_ros2_control:
add_run: ["ros-humble-urdf", "ros-humble-kdl-parser", "ros-humble-tf2-geometry-msgs", "ros-humble-tf2-eigen"]
lbr_ros2_control:
add_host: ["ros-humble-kinematics-interface"]
add_run: ["ros-humble-kinematics-interface"]
add_run: ["ros-humble-kinematics-interface"]
133 changes: 133 additions & 0 deletions patch/ros-humble-depthai.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Esteve Fernandez <esteve@apache.org>
Date: Tue, 12 May 2026 14:01:42 +0100
Subject: [PATCH] fix(depthai): make conda builds use bundled release sources

Signed-off-by: Esteve Fernandez <esteve@apache.org>

---
CMakeLists.txt | 2 ++
shared/depthai-bootloader-shared.cmake | 37 ++++++++++++++++++----------------
shared/depthai-shared.cmake | 35 +++++++++++++++++---------------
3 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 109d9da..24d9aff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,6 +60,8 @@ else()
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()

+set(HUNTER_ROOT "${CMAKE_BINARY_DIR}/.hunter" CACHE PATH "Hunter package cache")
+set(DEPTHAI_ENABLE_CURL OFF CACHE BOOL "Enable CURL support" FORCE)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
diff --git a/shared/depthai-bootloader-shared.cmake b/shared/depthai-bootloader-shared.cmake
index d0db905..3bdb1b0 100644
--- a/shared/depthai-bootloader-shared.cmake
+++ b/shared/depthai-bootloader-shared.cmake
@@ -29,25 +29,28 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
OUTPUT_VARIABLE statusCommit
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
- string(SUBSTRING ${statusCommit} 0 1 status)
- if("${status}" STREQUAL "-")
- message(FATAL_ERROR "Submodule 'depthai-bootloader-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
+ if(statusCommit)
+ string(SUBSTRING "${statusCommit}" 0 1 status)
+ if("${status}" STREQUAL "-")
+ message(FATAL_ERROR "Submodule 'depthai-bootloader-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
+ endif()
endif()
endif()

- # Get depthai-bootloader-shared current commit
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
- WORKING_DIRECTORY ${DEPTHAI_BOOTLOADER_SHARED_FOLDER}
- RESULT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT
- OUTPUT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- if(${DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT} EQUAL 0)
- set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND TRUE)
- else()
- set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND FALSE)
+ set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND FALSE)
+ if(EXISTS "${DEPTHAI_BOOTLOADER_SHARED_FOLDER}/.git")
+ # Release archives include shared sources without a nested Git checkout.
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
+ WORKING_DIRECTORY ${DEPTHAI_BOOTLOADER_SHARED_FOLDER}
+ RESULT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT
+ OUTPUT_VARIABLE DEPTHAI_BOOTLOADER_SHARED_COMMIT_HASH
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(DEPTHAI_BOOTLOADER_SHARED_COMMIT_RESULT EQUAL 0)
+ set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND TRUE)
+ endif()
endif()
endif()

@@ -56,4 +59,4 @@ foreach(source_file ${DEPTHAI_BOOTLOADER_SHARED_SOURCES})
if(NOT EXISTS ${source_file})
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")
endif()
-endforeach()
\ No newline at end of file
+endforeach()
diff --git a/shared/depthai-shared.cmake b/shared/depthai-shared.cmake
index 414e1eb..94a007d 100644
--- a/shared/depthai-shared.cmake
+++ b/shared/depthai-shared.cmake
@@ -35,25 +35,28 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
OUTPUT_VARIABLE statusCommit
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
- string(SUBSTRING ${statusCommit} 0 1 status)
- if("${status}" STREQUAL "-")
- message(FATAL_ERROR "Submodule 'depthai-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
+ if(statusCommit)
+ string(SUBSTRING "${statusCommit}" 0 1 status)
+ if("${status}" STREQUAL "-")
+ message(FATAL_ERROR "Submodule 'depthai-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
+ endif()
endif()
endif()

- # Get depthai-shared current commit
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
- WORKING_DIRECTORY ${DEPTHAI_SHARED_FOLDER}
- RESULT_VARIABLE DEPTHAI_SHARED_COMMIT_RESULT
- OUTPUT_VARIABLE DEPTHAI_SHARED_COMMIT_HASH
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- if(${DEPTHAI_SHARED_COMMIT_RESULT} EQUAL 0)
- set(DEPTHAI_SHARED_COMMIT_FOUND TRUE)
- else()
- set(DEPTHAI_SHARED_COMMIT_FOUND FALSE)
+ set(DEPTHAI_SHARED_COMMIT_FOUND FALSE)
+ if(EXISTS "${DEPTHAI_SHARED_FOLDER}/.git")
+ # Release archives include shared sources without a nested Git checkout.
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
+ WORKING_DIRECTORY ${DEPTHAI_SHARED_FOLDER}
+ RESULT_VARIABLE DEPTHAI_SHARED_COMMIT_RESULT
+ OUTPUT_VARIABLE DEPTHAI_SHARED_COMMIT_HASH
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(DEPTHAI_SHARED_COMMIT_RESULT EQUAL 0)
+ set(DEPTHAI_SHARED_COMMIT_FOUND TRUE)
+ endif()
endif()
endif()

--
2.54.0
28 changes: 28 additions & 0 deletions patch/ros-humble-irobot-create-nodes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Esteve Fernandez <esteve@apache.org>
Date: Wed, 13 May 2026 09:37:28 +0100
Subject: [PATCH] fix(irobot-create-nodes): export symbols on Windows

Signed-off-by: Esteve Fernandez <esteve@apache.org>

---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1bb5609..33c05bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

+if(WIN32)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif()
+
find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(control_msgs REQUIRED)
--
2.54.0
28 changes: 28 additions & 0 deletions patch/ros-humble-irobot-create-toolbox.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Esteve Fernandez <esteve@apache.org>
Date: Wed, 13 May 2026 09:34:52 +0100
Subject: [PATCH] fix(irobot-create-toolbox): export symbols on Windows

Signed-off-by: Esteve Fernandez <esteve@apache.org>

---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 794be2b..91a9a5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

+if(WIN32)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif()
+
find_package(ament_cmake REQUIRED)
find_package(ignition-math6 REQUIRED)
find_package(rclcpp REQUIRED)
--
2.54.0
179 changes: 179 additions & 0 deletions patch/ros-humble-turtlebot4-base.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Esteve Fernandez <esteve@apache.org>
Date: Tue, 12 May 2026 14:02:58 +0100
Subject: [PATCH] fix(turtlebot4-base): support both libgpiod 1 and 2

Signed-off-by: Esteve Fernandez <esteve@apache.org>

---
CMakeLists.txt | 7 ++++
include/turtlebot4_base/gpio_interface.hpp | 5 ++-
src/gpio_interface.cpp | 66 ++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6aeeea9..aeb64b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,12 @@ find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(turtlebot4_msgs REQUIRED)
find_package(turtlebot4_node REQUIRED)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GPIOD REQUIRED libgpiod)
+
+if(NOT GPIOD_VERSION VERSION_LESS 2.0)
+ add_definitions(-DTURTLEBOT4_BASE_GPIOD_V2)
+endif()

find_library(gpiod_library NAMES libgpiod.so)

@@ -32,6 +38,7 @@ find_library(gpiod_library NAMES libgpiod.so)

include_directories(
include
+ ${GPIOD_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME}_lib
diff --git a/include/turtlebot4_base/gpio_interface.hpp b/include/turtlebot4_base/gpio_interface.hpp
index c25317e..b1b27a3 100644
--- a/include/turtlebot4_base/gpio_interface.hpp
+++ b/include/turtlebot4_base/gpio_interface.hpp
@@ -19,7 +19,6 @@
#ifndef TURTLEBOT4_BASE__GPIO_INTERFACE_HPP_
#define TURTLEBOT4_BASE__GPIO_INTERFACE_HPP_

-#include <linux/gpio.h>
#include <gpiod.h>

#include <string>
@@ -56,7 +55,11 @@ private:

gpiod_chip * chip_;

+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ std::map<uint8_t, gpiod_line_request *> lines_;
+#else
std::map<uint8_t, gpiod_line *> lines_;
+#endif
};

} // namespace turtlebot4_base
diff --git a/src/gpio_interface.cpp b/src/gpio_interface.cpp
index 3127ba3..a21b977 100644
--- a/src/gpio_interface.cpp
+++ b/src/gpio_interface.cpp
@@ -50,7 +50,16 @@ GpioInterface::GpioInterface(const uint8_t & gpio_chip_number)
*/
void GpioInterface::open_chip()
{
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ std::string gpio_chip_path = gpio_chip_;
+ if (gpio_chip_path.empty() || gpio_chip_path.front() != '/') {
+ gpio_chip_path = "/dev/" + gpio_chip_path;
+ }
+
+ chip_ = gpiod_chip_open(gpio_chip_path.c_str());
+#else
chip_ = gpiod_chip_open_by_name(gpio_chip_.c_str());
+#endif
}

/**
@@ -59,7 +68,11 @@ void GpioInterface::open_chip()
void GpioInterface::close_chip()
{
for (auto line : lines_) {
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ gpiod_line_request_release(line.second);
+#else
gpiod_line_release(line.second);
+#endif
}

gpiod_chip_close(chip_);
@@ -70,6 +83,47 @@ void GpioInterface::close_chip()
*/
void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
{
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ unsigned int offset = line;
+ gpiod_request_config * request_config = gpiod_request_config_new();
+ gpiod_line_config * line_config = gpiod_line_config_new();
+ gpiod_line_settings * line_settings = gpiod_line_settings_new();
+
+ if (request_config == nullptr || line_config == nullptr || line_settings == nullptr) {
+ gpiod_request_config_free(request_config);
+ gpiod_line_config_free(line_config);
+ gpiod_line_settings_free(line_settings);
+ std::cerr << "Failed to configure GPIO Line" << std::endl;
+ return;
+ }
+
+ if (direction != LINE_DIRECTION_INPUT && direction != LINE_DIRECTION_OUTPUT) {
+ gpiod_request_config_free(request_config);
+ gpiod_line_config_free(line_config);
+ gpiod_line_settings_free(line_settings);
+ std::cerr << "Invalid GPIO Line Direction" << std::endl;
+ return;
+ }
+
+ gpiod_request_config_set_consumer(request_config, "Turtlebot4");
+ gpiod_line_settings_set_direction(line_settings, static_cast<gpiod_line_direction>(direction));
+ if (direction == LINE_DIRECTION_OUTPUT) {
+ gpiod_line_settings_set_output_value(line_settings, GPIOD_LINE_VALUE_INACTIVE);
+ }
+ gpiod_line_config_add_line_settings(line_config, &offset, 1, line_settings);
+
+ gpiod_line_request * gpio_line = gpiod_chip_request_lines(chip_, request_config, line_config);
+
+ gpiod_request_config_free(request_config);
+ gpiod_line_config_free(line_config);
+ gpiod_line_settings_free(line_settings);
+
+ if (gpio_line != nullptr) {
+ lines_.insert(std::pair<uint8_t, gpiod_line_request *>(line, gpio_line));
+ } else {
+ std::cerr << "Invalid GPIO Line" << std::endl;
+ }
+#else
gpiod_line * gpio_line = gpiod_chip_get_line(chip_, line);

if (gpio_line != nullptr) {
@@ -86,6 +140,7 @@ void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
} else {
std::cerr << "Invalid GPIO Line Direction" << std::endl;
}
+#endif
}

/**
@@ -93,7 +148,14 @@ void GpioInterface::add_line(uint8_t line, GpioInterfaceLineDirection direction)
*/
void GpioInterface::write(uint8_t line, uint8_t value)
{
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ gpiod_line_request_set_value(
+ lines_[line],
+ line,
+ value ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE);
+#else
gpiod_line_set_value(lines_[line], value);
+#endif
}

/**
@@ -101,5 +163,9 @@ void GpioInterface::write(uint8_t line, uint8_t value)
*/
uint8_t GpioInterface::read(uint8_t line)
{
+#ifdef TURTLEBOT4_BASE_GPIOD_V2
+ return static_cast<uint8_t>(gpiod_line_request_get_value(lines_[line], line));
+#else
return gpiod_line_get_value(lines_[line]);
+#endif
}

--
2.54.0
Loading