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

Custom Object Detection #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 15 additions & 2 deletions zed_components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ endif()

#############################################
# Dependencies
find_package(ZED 3 REQUIRED)
find_package(ZED 4 REQUIRED)

exec_program(uname ARGS -p OUTPUT_VARIABLE CMAKE_SYSTEM_NAME2)
if(CMAKE_SYSTEM_NAME2 MATCHES "aarch64") # Jetson TX
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
endif()

find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)

set(DEPENDENCIES
rclcpp
Expand Down Expand Up @@ -150,6 +151,7 @@ add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files})
###############################################################################
# INCLUDES and LIBS
include_directories(
${OpenCV_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${ZED_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src/include
Expand All @@ -160,6 +162,7 @@ include_directories(
# create ament index resource which references the libraries in the binary dir
set(node_plugins "")

link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(${ZED_LIBRARY_DIR})
link_directories(${CUDA_LIBRARY_DIRS})

Expand All @@ -184,13 +187,21 @@ set(SL_TOOLS_SRC
set(ZED_CAMERA_INC
${CMAKE_CURRENT_SOURCE_DIR}/src/include/visibility_control.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/sl_types.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/zed_camera_component.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/zed_camera_component.hpp

${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/yolo.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/cuda_utils.h
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/logging.h
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/include/utils.h
)

set(ZED_CAMERA_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/src/zed_camera_component.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/zed_camera/src/yolo.cpp
)

SET(TRT_LIBS nvinfer nvonnxparser)

###############################################################################
# Bin and Install

Expand All @@ -204,6 +215,8 @@ target_compile_definitions(zed_camera_component
PRIVATE "COMPOSITION_BUILDING_DLL"
)
target_link_libraries(zed_camera_component
${TRT_LIBS}
${OpenCV_LIBS}
${ZED_LIBS}
)
ament_target_dependencies(zed_camera_component
Expand Down
17 changes: 17 additions & 0 deletions zed_components/src/zed_camera/include/cuda_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef TRTX_CUDA_UTILS_H_
#define TRTX_CUDA_UTILS_H_

#include <cuda_runtime_api.h>

#ifndef CUDA_CHECK
#define CUDA_CHECK(callstr)\
{\
cudaError_t error_code = callstr;\
if (error_code != cudaSuccess) {\
std::cerr << "CUDA error " << error_code << " at " << __FILE__ << ":" << __LINE__;\
assert(0);\
}\
}
#endif // CUDA_CHECK

#endif // TRTX_CUDA_UTILS_H_
Loading