diff --git a/ed_sensor_integration/CMakeLists.txt b/ed_sensor_integration/CMakeLists.txt
index 67934c20..020b1dbc 100644
--- a/ed_sensor_integration/CMakeLists.txt
+++ b/ed_sensor_integration/CMakeLists.txt
@@ -4,8 +4,21 @@ project(ed_sensor_integration)
add_compile_options(-Wall -Werror=all)
add_compile_options(-Wextra -Werror=extra)
+find_package (Python COMPONENTS Interpreter REQUIRED)
+message(WARNING "Python_EXECUTABLE: ${Python_EXECUTABLE}")
+execute_process(
+ COMMAND ${Python_EXECUTABLE} -c "import torch; from sys import stderr; print(torch.__path__[0]); print(f'{torch.__path__[0]}=', file=stderr)"
+ OUTPUT_VARIABLE TORCH_LIBRARY_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+message(WARNING "TORCH_LIBRARY_PATH: ${TORCH_LIBRARY_PATH}")
+
find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED COMPONENTS common kdtree)
+find_package(Torch 1.10 REQUIRED
+ PATHS "${TORCH_LIBRARY_PATH}/share/cmake"
+)
+message(WARNING "TORCH_INCLUDE_DIRS: ${TORCH_INCLUDE_DIRS}")
find_package(catkin REQUIRED COMPONENTS
code_profiler
ed
@@ -31,7 +44,7 @@ catkin_package(
INCLUDE_DIRS include
LIBRARIES ed_kinect
CATKIN_DEPENDS code_profiler ed ${PROJECT_NAME}_msgs geolib2 image_geometry rgbd rgbd_image_buffer roscpp tue_config visualization_msgs
- DEPENDS OpenCV PCL
+ DEPENDS OpenCV PCL Torch
)
# ------------------------------------------------------------------------------------------------
@@ -42,6 +55,7 @@ include_directories(
include
SYSTEM
${OpenCV_INCLUDE_DIRS}
+ ${TORCH_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
@@ -121,6 +135,12 @@ target_link_libraries(ed_clearer_plugin ${catkin_LIBRARIES})
# TOOLS
# ------------------------------------------------------------------------------------------------
+add_executable(test_torch tools/test_torch.cpp)
+target_link_libraries(test_torch ${TORCH_LIBRARIES})
+
+add_executable(test_yolo tools/test_yolo.cpp)
+target_link_libraries(test_yolo ${TORCH_LIBRARIES})
+
add_executable(ed_image_saver tools/image_saver.cpp)
target_link_libraries(ed_image_saver ${catkin_LIBRARIES})
add_dependencies(ed_image_saver ${catkin_EXPORTED_TARGETS})
@@ -168,6 +188,8 @@ install(
ed_fitter_live
ed_image_saver
ed_segmenter
+ test_torch
+ test_yolo
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
@@ -184,6 +206,3 @@ if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(test_laser_fitting test/test_laser_segmenter.cpp)
target_link_libraries(test_laser_fitting ${PROJECT_NAME}_console_bridge ed_laser ${OpenCV_LIBRARIES} ${catkin_LIBRARIES})
endif ()
-
-
-
diff --git a/ed_sensor_integration/package.xml b/ed_sensor_integration/package.xml
index 7cddbf8c..fff5e3df 100644
--- a/ed_sensor_integration/package.xml
+++ b/ed_sensor_integration/package.xml
@@ -27,6 +27,8 @@
tue_config
visualization_msgs
+ python3
+
geometry_msgs
geometry_msgs
rosconsole_bridge
@@ -36,6 +38,8 @@
tue_filesystem
tue_filesystem
+ python3-pytorch-pip
+
catkin_lint_cmake
doxygen
diff --git a/ed_sensor_integration/tools/test_torch.cpp b/ed_sensor_integration/tools/test_torch.cpp
new file mode 100644
index 00000000..5537724c
--- /dev/null
+++ b/ed_sensor_integration/tools/test_torch.cpp
@@ -0,0 +1,7 @@
+#include
+#include
+
+int main() {
+ torch::Tensor tensor = torch::eye(3);
+ std::cout << tensor << std::endl;
+}
diff --git a/ed_sensor_integration/tools/test_yolo.cpp b/ed_sensor_integration/tools/test_yolo.cpp
new file mode 100644
index 00000000..5537724c
--- /dev/null
+++ b/ed_sensor_integration/tools/test_yolo.cpp
@@ -0,0 +1,7 @@
+#include
+#include
+
+int main() {
+ torch::Tensor tensor = torch::eye(3);
+ std::cout << tensor << std::endl;
+}