Skip to content
Draft
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
27 changes: 23 additions & 4 deletions ed_sensor_integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

# ------------------------------------------------------------------------------------------------
Expand All @@ -42,6 +55,7 @@ include_directories(
include
SYSTEM
${OpenCV_INCLUDE_DIRS}
${TORCH_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)

Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -168,6 +188,8 @@ install(
ed_fitter_live
ed_image_saver
ed_segmenter
test_torch
test_yolo
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Expand All @@ -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 ()



4 changes: 4 additions & 0 deletions ed_sensor_integration/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<depend>tue_config</depend>
<depend>visualization_msgs</depend>

<build_depend>python3</build_depend>

<build_depend>geometry_msgs</build_depend>
<exec_depend>geometry_msgs</exec_depend>
<build_depend>rosconsole_bridge</build_depend>
Expand All @@ -36,6 +38,8 @@
<build_depend>tue_filesystem</build_depend>
<exec_depend>tue_filesystem</exec_depend>

<exec_depend>python3-pytorch-pip</exec_depend>

<test_depend>catkin_lint_cmake</test_depend>

<doc_depend>doxygen</doc_depend>
Expand Down
7 changes: 7 additions & 0 deletions ed_sensor_integration/tools/test_torch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <torch/torch.h>
#include <iostream>

int main() {
torch::Tensor tensor = torch::eye(3);
std::cout << tensor << std::endl;
}
7 changes: 7 additions & 0 deletions ed_sensor_integration/tools/test_yolo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <torch/torch.h>
#include <iostream>

int main() {
torch::Tensor tensor = torch::eye(3);
std::cout << tensor << std::endl;
}