-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #389 from knorth55/zdepth
add zdepth and zdepth_image_transport package
- Loading branch information
Showing
14 changed files
with
761 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(zdepth) | ||
|
||
include(ExternalProject) | ||
|
||
if("$ENV{ROS_DISTRO}" STRGREATER "kinetic") | ||
ExternalProject_Add( | ||
zdepth | ||
GIT_REPOSITORY https://github.com/catid/Zdepth.git | ||
GIT_TAG ac7c6d8e944d07be2404e5a1eaa04562595f3756 | ||
GIT_SHALLOW TRUE | ||
PATCH_COMMAND cat ${PROJECT_SOURCE_DIR}/fix_cmakelists.patch | patch -p1 | ||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} | ||
INSTALL_COMMAND echo "install" | ||
) | ||
|
||
install(CODE "execute_process(COMMAND make install WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/zdepth-prefix/src/zdepth-build)") | ||
else() | ||
install(CODE "message(WARNING \"Skipping zdepth install because ROS is too old\")") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index b22b2e7..a4251af 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -61,7 +61,7 @@ include_directories(include) | ||
|
||
# zdepth library | ||
|
||
-add_library(zdepth STATIC ${SOURCE_FILES}) | ||
+add_library(zdepth SHARED ${SOURCE_FILES}) | ||
add_library(zdepth::zdepth ALIAS zdepth) | ||
|
||
target_link_libraries(zdepth PUBLIC zstd) | ||
@@ -80,10 +80,13 @@ target_link_libraries(zdepth_test PRIVATE zdepth) | ||
################################################################################ | ||
# Install | ||
|
||
-install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
-install(FILES README.md DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
-install(DIRECTORY cmake include DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
-install(TARGETS zdepth EXPORT zdepth LIBRARY DESTINATION lib) | ||
+# install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
+# install(FILES README.md DESTINATION ${CMAKE_INSTALL_PREFIX}) | ||
+install(FILES include/zdepth.hpp DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zdepth) | ||
+install(FILES tests/test_vectors.inl DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zdepth/tests) | ||
+install(TARGETS zdepth EXPORT zdepth | ||
+ ARCHIVE DESTINATION lib | ||
+ LIBRARY DESTINATION lib) | ||
|
||
################################################################################ | ||
# Generate zdepthConfig.cmake and zdepthConfigVersion.cmake for cmake projects | ||
diff --git a/zstd/CMakeLists.txt b/zstd/CMakeLists.txt | ||
index 5869d4d..f9339a3 100644 | ||
--- a/zstd/CMakeLists.txt | ||
+++ b/zstd/CMakeLists.txt | ||
@@ -19,10 +19,12 @@ include_directories(include src) | ||
################################################################################ | ||
# Targets | ||
|
||
-add_library(zstd ${ZSTD_SOURCE_FILES}) | ||
+add_library(zstd SHARED ${ZSTD_SOURCE_FILES}) | ||
target_include_directories(zstd PUBLIC | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:include>" | ||
) | ||
|
||
-install(TARGETS zstd EXPORT zdepth LIBRARY DESTINATION lib) | ||
+install(TARGETS zstd EXPORT zdepth | ||
+ ARCHIVE DESTINATION lib | ||
+ LIBRARY DESTINATION lib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>zdepth</name> | ||
<version>0.0.0</version> | ||
<description>The zdepth package</description> | ||
|
||
<maintainer email="[email protected]">Shingo Kitagawa</maintainer> | ||
|
||
<license>BSD</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
|
||
|
||
<export> | ||
<build_type>cmake</build_type> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(zdepth_image_transport) | ||
|
||
find_package(catkin REQUIRED | ||
COMPONENTS | ||
image_transport | ||
message_generation | ||
pluginlib | ||
roscpp | ||
sensor_msgs | ||
std_msgs | ||
) | ||
|
||
if("$ENV{ROS_DISTRO}" STRGREATER "kinetic") | ||
find_library(zdepth_LIB zdepth PATH_SUFFIXES zdepth) | ||
find_library(zstd_LIB zstd PATH_SUFFIXES zdepth) | ||
set(zdepth_LIBRARIES ${zdepth_LIB} ${zstd_LIB}) | ||
find_file(zdepth_INCLUDE zdepth.hpp PATH_SUFFIXES zdepth) | ||
get_filename_component(zdepth_PATH ${zdepth_INCLUDE} DIRECTORY) | ||
get_filename_component(zdepth_INCLUDE_DIRS ${zdepth_PATH} DIRECTORY) | ||
endif() | ||
|
||
add_message_files( | ||
DIRECTORY msg | ||
FILES | ||
ZDepthImage.msg | ||
) | ||
|
||
generate_messages(DEPENDENCIES std_msgs) | ||
|
||
|
||
catkin_package( | ||
INCLUDE_DIRS include | ||
LIBRARIES ${PROJECT_NAME} | ||
CATKIN_DEPENDS | ||
message_runtime | ||
image_transport | ||
pluginlib | ||
roscpp | ||
sensor_msgs | ||
std_msgs | ||
DEPENDS | ||
zdepth | ||
) | ||
|
||
if("$ENV{ROS_DISTRO}" STRGREATER "kinetic") | ||
include_directories(include ${catkin_INCLUDE_DIRS} ${zdepth_INCLUDE_DIRS}) | ||
|
||
add_executable(zdepth_test src/test/zdepth_test.cpp) | ||
target_link_libraries(zdepth_test ${catkin_LIBRARIES} ${zdepth_LIBRARIES}) | ||
|
||
add_library(${PROJECT_NAME} src/manifest.cpp src/zdepth_publisher.cpp src/zdepth_subscriber.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${zdepth_LIBRARIES}) | ||
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_generate_messages_cpp) | ||
|
||
install(TARGETS zdepth_test | ||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} | ||
) | ||
endif() | ||
|
||
install(DIRECTORY include/${PROJECT_NAME}/ | ||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} | ||
) | ||
|
||
install(FILES zdepth_plugins.xml | ||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} | ||
) |
22 changes: 22 additions & 0 deletions
22
zdepth_image_transport/include/zdepth_image_transport/zdepth_publisher.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <image_transport/simple_publisher_plugin.h> | ||
#include "zdepth/zdepth.hpp" | ||
#include "zdepth_image_transport/ZDepthImage.h" | ||
|
||
|
||
namespace zdepth_image_transport | ||
{ | ||
class ZDepthPublisher : public image_transport::SimplePublisherPlugin<zdepth_image_transport::ZDepthImage> | ||
{ | ||
public: | ||
virtual ~ZDepthPublisher() {} | ||
virtual std::string getTransportName() const | ||
{ | ||
return "zdepth"; | ||
} | ||
|
||
protected: | ||
virtual void publish(const sensor_msgs::Image& img_msg, | ||
const PublishFn& publish_fn) const; | ||
}; | ||
|
||
} //namespace zdepth_image_transport |
22 changes: 22 additions & 0 deletions
22
zdepth_image_transport/include/zdepth_image_transport/zdepth_subscriber.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <image_transport/simple_subscriber_plugin.h> | ||
#include "zdepth/zdepth.hpp" | ||
#include "zdepth_image_transport/ZDepthImage.h" | ||
|
||
|
||
namespace zdepth_image_transport | ||
{ | ||
class ZDepthSubscriber : public image_transport::SimpleSubscriberPlugin<zdepth_image_transport::ZDepthImage> | ||
{ | ||
public: | ||
virtual ~ZDepthSubscriber() {} | ||
virtual std::string getTransportName() const | ||
{ | ||
return "zdepth"; | ||
} | ||
|
||
protected: | ||
virtual void internalCallback(const zdepth_image_transport::ZDepthImageConstPtr& zdepth_msg, | ||
const Callback& user_cb); | ||
}; | ||
|
||
} //namespace zdepth_image_transport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This message contains a compressed image | ||
|
||
Header header # Header timestamp should be acquisition time of image | ||
# Header frame_id should be optical frame of camera | ||
# origin of frame should be optical center of camera | ||
# +x should point to the right in the image | ||
# +y should point down in the image | ||
# +z should point into to plane of the image | ||
|
||
string format # Specifies the format of the data | ||
# Acceptable values: | ||
# jpeg, png | ||
uint8[] data # Compressed image buffer | ||
int32 width | ||
int32 height |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>zdepth_image_transport</name> | ||
<version>0.0.0</version> | ||
<description>The zdepth_image_transport package</description> | ||
|
||
<maintainer email="[email protected]">Shingo Kitagawa</maintainer> | ||
|
||
<license>BSD</license> | ||
|
||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<build_depend>image_transport</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
<build_depend>pluginlib</build_depend> | ||
<build_depend>roscpp</build_depend> | ||
<build_depend>sensor_msgs</build_depend> | ||
<build_depend>std_msgs</build_depend> | ||
<build_depend>zdepth</build_depend> | ||
|
||
<exec_depend>image_transport</exec_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
<exec_depend>pluginlib</exec_depend> | ||
<exec_depend>roscpp</exec_depend> | ||
<exec_depend>sensor_msgs</exec_depend> | ||
<exec_depend>std_msgs</exec_depend> | ||
<exec_depend>zdepth</exec_depend> | ||
<export> | ||
<image_transport plugin="${prefix}/zdepth_plugins.xml"/> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <pluginlib/class_list_macros.h> | ||
#include <zdepth_image_transport/zdepth_publisher.h> | ||
#include <zdepth_image_transport/zdepth_subscriber.h> | ||
|
||
PLUGINLIB_EXPORT_CLASS(zdepth_image_transport::ZDepthPublisher, image_transport::PublisherPlugin) | ||
PLUGINLIB_EXPORT_CLASS(zdepth_image_transport::ZDepthSubscriber, image_transport::SubscriberPlugin) |
Oops, something went wrong.