Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for ROS Index #45

Merged
merged 7 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
26 changes: 0 additions & 26 deletions .github/workflows/industrial_ci.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/ros_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ROS2 Build

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
ros2_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: psdk_ros2
- uses: ros-tooling/[email protected]
with:
required-ros-distributions: humble
- uses: ros-tooling/[email protected]
with:
package-name: psdk_interfaces psdk_wrapper
target-ros2-distro: humble
skip-tests: true
8 changes: 3 additions & 5 deletions debian/create_debians.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null


apt update
apt install -y --no-install-recommends python3-pip python3-bloom python3-catkin-pkg dpkg-dev debhelper dh-python libopus-dev ffmpeg libavcodec-dev libavformat-dev libavfilter-dev libusb-1.0-0-dev
ln -snf /usr/lib/x86_64-linux-gnu/libopus.a /usr/local/lib
apt install -y --no-install-recommends python3-pip python3-bloom python3-catkin-pkg dpkg-dev debhelper dh-python
pip3 install rosdep
rosdep init
mv psdk_ros2/debian/50-my-packages.list /etc/ros/rosdep/sources.list.d
mv psdk_ros2/debian/rosdep.yaml /
cp psdk_ros2/debian/50-my-packages.list /etc/ros/rosdep/sources.list.d
cp psdk_ros2/debian/rosdep.yaml /

# store the current dir
CUR_DIR=$(pwd)
Expand Down
35 changes: 27 additions & 8 deletions psdk_wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14)
project(psdk_wrapper)

SET(BUILD_SHARED_LIBS ON)
Expand Down Expand Up @@ -31,10 +31,29 @@ find_package(tf2_ros REQUIRED)
find_package(psdk_interfaces REQUIRED)
find_package(std_srvs REQUIRED)

# FetchContent module
include(FetchContent)

# Declare the content to fetch
FetchContent_Declare(
Payload_SDK
GIT_REPOSITORY https://github.com/dji-sdk/Payload-SDK.git
GIT_TAG 3.5
)

FetchContent_GetProperties(Payload_SDK)
if(NOT Payload_SDK_POPULATED)
FetchContent_Populate(Payload_SDK)
message(STATUS "Payload_SDK_SOURCE_DIR: ${payload_sdk_SOURCE_DIR}")
endif()

# Set the path to the fetched content
set(PSDK_PATH ${payload_sdk_SOURCE_DIR})

message(STATUS "PSDK_PATH: ${PSDK_PATH}")

# Add path to FindFFMPEG.cmake and FindLIBUSB.cmake files
set(PSDK_PATH ${PROJECT_SOURCE_DIR}/../../Payload-SDK)
set(CMAKE_MODULE_PATH
${PSDK_PATH}/samples/sample_c++/platform/linux/common/3rdparty)
set(CMAKE_MODULE_PATH ${PSDK_PATH}/samples/sample_c++/platform/linux/common/3rdparty)

find_package(FFMPEG REQUIRED)
find_package(LIBUSB REQUIRED)
Expand Down Expand Up @@ -75,9 +94,9 @@ if (FFMPEG_FOUND)
OUTPUT_VARIABLE ffmpeg_version_psdk_libput
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line ${ffmpeg_version_psdk_libput})
string(REGEX MATCH " .* " ffmpeg_version ${ffmpeg_version_line})
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version ${ffmpeg_version})
string(REGEX MATCH "version.*Copyright" ffmpeg_version_line "${ffmpeg_version_psdk_libput}")
string(REGEX MATCH " .* " ffmpeg_version "${ffmpeg_version_line}")
string(REGEX MATCH "^ 5.*$" ffmpeg_major_version "${ffmpeg_version}")

if (HEAD${ffmpeg_major_version} STREQUAL "HEAD")
message(STATUS " - Version: ${ffmpeg_version}")
Expand Down Expand Up @@ -108,7 +127,7 @@ include_directories(${FFMPEG_INCLUDE_DIR})
include_directories(${DJI_OSAL_PATH})
include_directories(${DJI_HAL_PATH})
include_directories(${DJI_STREAMING_PATH})
include_directories(${PROJECT_SOURCE_DIR}/../../Payload-SDK/psdk_lib/include)
include_directories(${PSDK_PATH}/psdk_lib/include)
include_directories(include)
include_directories(src/3rdparty)

Expand Down
3 changes: 3 additions & 0 deletions psdk_wrapper/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<depend>ffmpeg-dev</depend>
<depend>libusb-1.0-dev</depend>
<depend>libopus-dev</depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>tf2</depend>
Expand Down
Loading