Skip to content
This repository was archived by the owner on Jul 26, 2024. It is now read-only.

Commit 9679881

Browse files
author
Stuart Alldritt
authored
Merge pull request #17 from microsoft/master
Create first melodic release
2 parents 5513873 + 046c9d2 commit 9679881

28 files changed

+2798
-7
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug, triage needed
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Before filing a bug
12+
- Ensure the bug reproduces on the latest commit of your release branch.
13+
- Search existing issues and make sure this issue is not already filed.
14+
-->
15+
16+
**Describe the bug**
17+
A clear and concise description of what the bug is.
18+
19+
**To Reproduce**
20+
Steps to reproduce the behavior:
21+
1. Go to '...'
22+
2. Click on '....'
23+
3. Scroll down to '....'
24+
4. See error
25+
26+
**Expected behavior**
27+
A clear and concise description of what you expected to happen.
28+
29+
**Logs**
30+
Please provide relevant logs to help diagnose your issue. To assist in debugging, please enable *info* level logging of the Azure Kinect Sensor SDK and attach any logs you have to this issue.
31+
See [k4atypes.h](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK/blob/feecae0456511ac734287571b101d10fd7292673/include/k4a/k4atypes.h#L184) for how to enable logs.
32+
33+
Please also enable *DEBUG* level logging of the ROS node.
34+
See [roscpp/Overview/Logging](http://wiki.ros.org/roscpp/Overview/Logging) for how to enable ROS DEBUG logs.
35+
36+
**Screenshots**
37+
If applicable, add screenshots to help explain your problem.
38+
39+
**Desktop (please complete the following information):**
40+
- OS: [e.g. Windows 10, Ubuntu]
41+
- Version [e.g. Version 1903, 18.04]
42+
43+
**Additional context**
44+
Add any other context about the problem here.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Feature request (enhancement)
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement, triage needed
6+
assignees: ''
7+
8+
---
9+
10+
<!--
11+
Thanks for submitting an idea for improvement!
12+
13+
This repo is for feedback specific to the Azure Kinect ROS Driver. If you have feedback for the Sensor SDK, please visit https://github.com/microsoft/Azure-Kinect-Sensor-SDK
14+
15+
Feature requests on our GitHub page should be for changes to the driver that will improve functionality for all users.
16+
17+
Tips to submit an enhancement that may be approved:
18+
- The idea should fit with the purpose of the Azure Kinect ROS Driver, which is to expose Azure Kinect sensor data in a ROS-compatible format. Post-processing of the sensor data should be done in external ROS nodes.
19+
- Well thought out ideas considering edge cases and API design will be more likely for someone to pursue.
20+
-->
21+
22+
**Is your feature request related to a problem? Please describe.**
23+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
24+
25+
**Describe the solution you'd like**
26+
A clear and concise description of what you want to happen.
27+
28+
**Describe alternatives you've considered**
29+
A clear and concise description of any alternative solutions or features you've considered.
30+
31+
**Additional context**
32+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
All pull requests should fix a Triage Approved issue. Put that issue # here:
3+
e.g. ## Fixes #300.
4+
-->
5+
## Fixes #
6+
7+
### Description of the changes:
8+
-
9+
-
10+
-
11+
12+
<!-- Please check off the appropriate boxes with [x] before submitting your pull request -->
13+
### Before submitting a Pull Request:
14+
- [ ] I reviewed [CONTRIBUTING.md](https://github.com/microsoft/Azure_Kinect_ROS_Driver/blob/master/CONTRIBUTING.md)
15+
- [ ] I [built my changes](https://github.com/microsoft/Azure_Kinect_ROS_Driver/blob/master/docs/building.md) locally
16+
- [ ] I tested my changes with a device
17+
18+
### I tested changes on: <!-- it's not required to have tested both, just indicate which one you tried -->
19+
- [ ] Windows
20+
- [ ] Linux
21+
22+
23+
<!-- Specify how you tested your changes (i.e. manual/ad-hoc testing, automated testing, new automated tests added)-->
24+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# External SDK Folder
2+
ext/sdk/*
3+
14
# Prerequisites
25
*.d
36

CMakeLists.txt

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
cmake_minimum_required(VERSION 2.8.3)
5+
project(azure_kinect_ros_driver LANGUAGES C CXX)
6+
7+
8+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
9+
add_compile_options(/std:c++latest)
10+
else()
11+
add_compile_options(-std=c++11)
12+
endif()
13+
14+
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}/cmake)
15+
16+
## Find catkin macros and libraries
17+
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
18+
## is used, also find other catkin packages
19+
find_package(catkin REQUIRED COMPONENTS
20+
roscpp
21+
std_msgs
22+
sensor_msgs
23+
image_transport
24+
nodelet
25+
tf2
26+
tf2_ros
27+
tf2_geometry_msgs
28+
geometry_msgs
29+
nodelet
30+
)
31+
32+
###################################
33+
## catkin specific configuration ##
34+
###################################
35+
## The catkin_package macro generates cmake config files for your package
36+
## Declare things to be passed to dependent projects
37+
## INCLUDE_DIRS: uncomment this if your package contains header files
38+
## LIBRARIES: libraries you create in this project that dependent projects also need
39+
## CATKIN_DEPENDS: catkin_packages dependent projects also need
40+
## DEPENDS: system dependencies of this project that dependent projects also need
41+
catkin_package(
42+
# INCLUDE_DIRS include
43+
# LIBRARIES k4a_ros_bridge
44+
# CATKIN_DEPENDS roscpp std_msgs
45+
# DEPENDS system_lib
46+
)
47+
48+
###########
49+
## Build ##
50+
###########
51+
52+
53+
## Declare a C++ executable
54+
## With catkin_make all packages are built within a single CMake context
55+
## The recommended prefix ensures that target names across packages don't collide
56+
add_executable(${PROJECT_NAME}_node
57+
src/k4a_ros_bridge_node.cpp
58+
src/k4a_ros_device.cpp
59+
src/k4a_ros_device_params.cpp
60+
src/k4a_calibration_transform_data.cpp
61+
)
62+
63+
add_library(${PROJECT_NAME}_nodelet
64+
src/k4a_ros_bridge_nodelet.cpp
65+
src/k4a_ros_device.cpp
66+
src/k4a_ros_device_params.cpp
67+
src/k4a_calibration_transform_data.cpp
68+
)
69+
70+
## Rename C++ executable without prefix
71+
## The above recommended prefix causes long target names, the following renames the
72+
## target back to the shorter version for ease of user use
73+
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
74+
set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
75+
76+
############################
77+
#### AZURE KINECT SDK ######
78+
############################
79+
80+
macro(process_ext_sdk)
81+
message(STATUS "K4A SDK found in ext/sdk!")
82+
message(STATUS "!! Not searching for SDK in system path !!")
83+
84+
# mark that the K4A SDK will need to be copied to the output binary folder
85+
# this is needed even on Linux if the SDK is not installed to the system path
86+
set(K4A_INSTALL_NEEDED true)
87+
88+
get_target_property(K4A_INCLUDE_DIRS k4a::k4a INTERFACE_INCLUDE_DIRECTORIES)
89+
get_target_property(K4A_CONFIGS k4a::k4a IMPORTED_CONFIGURATIONS)
90+
message("Configs: ${K4A_CONFIGS}")
91+
92+
# TODO: if we find more than one configuration, we should fail
93+
# TODO: potentially clean this logic up
94+
foreach(imported_config ${K4A_CONFIGS})
95+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
96+
get_target_property(K4A_CONFIG_LIBS k4a::k4a IMPORTED_IMPLIB_${imported_config})
97+
get_target_property(K4A_CONFIG_DLLS k4a::k4a IMPORTED_LOCATION_${imported_config})
98+
list(APPEND K4A_LIBS ${K4A_CONFIG_LIBS})
99+
list(APPEND K4A_DLL_FILES ${K4A_CONFIG_DLLS})
100+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
101+
get_target_property(K4A_CONFIG_LIBS k4a::k4a IMPORTED_LOCATION_${imported_config})
102+
get_target_property(K4A_CONFIG_DLLS k4a::k4a IMPORTED_LOCATION_${imported_config})
103+
list(APPEND K4A_LIBS ${K4A_CONFIG_LIBS})
104+
list(APPEND K4A_DLL_FILES ${K4A_CONFIG_DLLS})
105+
endif()
106+
endforeach()
107+
108+
if(DEFINED DEPTHENGINE_DLL)
109+
## Find the depth engine DLL
110+
file(GLOB_RECURSE DEPTHENGINE_DLL_FILE
111+
"${CMAKE_CURRENT_SOURCE_DIR}/ext/sdk/*/${DEPTHENGINE_DLL}" )
112+
list(APPEND K4A_DLL_FILES ${DEPTHENGINE_DLL_FILE})
113+
endif()
114+
endmacro()
115+
116+
# Define the names of some files that we are going to try and find
117+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
118+
set(DEPTHENGINE_DLL "depthengine_1_0.dll")
119+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
120+
set(DEPTHENGINE_DLL "libdepthengine.so.1.0")
121+
else()
122+
message(FATAL_ERROR "Platform ${CMAKE_SYSTEM_NAME} is not supported")
123+
endif()
124+
125+
message("Finding K4A SDK binaries")
126+
127+
# Disable cached locations for K4A SDK binaries.
128+
# Do this to force the search logic to happen correctly.
129+
# If we don't disable these cached directories, we
130+
# won't be able to tell the difference between the ext/sdk location
131+
# and the system installed version on linux. Since we have to treat these
132+
# differently (one needs install, one doesn't) we must disable the cache
133+
# so that find_package(k4a) will fail in all cases if not installed via the .deb.
134+
unset(k4a_DIR CACHE)
135+
unset(azure-kinect-sensor-sdk_DIR CACHE)
136+
137+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
138+
message("Linux mode: Searching for K4A in system path and ./ext/sdk")
139+
140+
# Test if we can find the k4a library in the system path
141+
find_package(k4a 1.1.0 QUIET)
142+
143+
if (${k4a_FOUND})
144+
message("K4A SDK found in system libraries!")
145+
# For system libraries on linux, we can just append the target name (k4a::k4a)
146+
# to what will be passed into target_link_libraries()
147+
list(APPEND K4A_LIBS k4a::k4a)
148+
else()
149+
message("K4A SDK not found in system libraries. Searching ./ext/sdk...")
150+
find_package(k4a 1.1.0 PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdk")
151+
152+
if(${k4a_FOUND})
153+
set(K4A_INSTALL_NEEDED true)
154+
message("K4A SDK found in ./ext/sdk!")
155+
process_ext_sdk()
156+
else()
157+
message(FATAL_ERROR "K4A SDK not found in system libraries or ./ext/sdk. Please install the Azure Kinect SDK.")
158+
endif()
159+
160+
endif()
161+
162+
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
163+
# Windows will always need K4A install for all targets
164+
set(K4A_INSTALL_NEEDED true)
165+
166+
# Try to find K4A installed to Program Files
167+
find_package(azure-kinect-sensor-sdk 1.1.0 EXACT QUIET PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
168+
169+
if (${azure-kinect-sensor-sdk_FOUND})
170+
message("K4A SDK found in Program Files!")
171+
172+
list(APPEND K4A_LIBS ${azure-kinect-sensor-sdk_LIBRARIES})
173+
list(APPEND K4A_BINS ${azure-kinect-sensor-sdk_BINARIES})
174+
set(K4A_INCLUDE_DIRS ${azure-kinect-sensor-sdk_INCLUDE_DIRS})
175+
176+
# Create a list of all K4A DLLs
177+
list(APPEND K4A_DLLS ${azure-kinect-sensor-sdk_LIBRARIES})
178+
list(APPEND K4A_DLLS ${azure-kinect-sensor-sdk_BINARIES})
179+
180+
foreach(DLL ${K4A_DLLS})
181+
set(prop "PROPERTY-NOTFOUND")
182+
get_property(prop TARGET ${DLL} PROPERTY IMPORTED_LOCATION)
183+
message(STATUS "IMPORTED_LOCATION: ${prop}")
184+
185+
if((NOT prop) OR (prop EQUAL "PROPERTY-NOTFOUND"))
186+
message(FATAL_ERROR "Target '${DLL}' in package azure-kinect-sensor-sdk does not contain an IMPORTED_LOCATION property")
187+
endif()
188+
189+
list(APPEND K4A_DLL_FILES ${prop})
190+
endforeach(DLL)
191+
else()
192+
# Try to find K4A installed to ./ext/sdk
193+
find_package(k4a 1.1.0 QUIET PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ext/sdk")
194+
195+
if (${k4a_FOUND})
196+
message("K4A SDK found in ./ext/sdk!")
197+
process_ext_sdk()
198+
else()
199+
message(FATAL_ERROR "K4A SDK not found in Program Files or ./ext/sdk. Please install the Azure Kinect SDK.")
200+
endif()
201+
endif()
202+
endif()
203+
204+
message("K4A Include Dirs: ${K4A_INCLUDE_DIRS}")
205+
message("K4A Libs: ${K4A_LIBS}")
206+
message("K4A DLLs: ${K4A_DLL_FILES}")
207+
message("K4A Install Needed: ${K4A_INSTALL_NEEDED}")
208+
209+
if (${K4A_INSTALL_NEEDED})
210+
# Tell cmake that we need to reconfigure if any of the DLL files change
211+
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${K4A_DLL_FILES})
212+
213+
# We need to copy the DLLs into the CATKIN_PACKAGE_LIB_DESTINATION so
214+
# the node executable can find them on launch, and CATKIN_PACKAGE_BIN_DESTINATION
215+
# so the nodelet can find them on launch
216+
set(DLL_COPY_DIRECTORY "${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION};${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}")
217+
218+
foreach(DIRECTORY ${DLL_COPY_DIRECTORY})
219+
file(MAKE_DIRECTORY "${DIRECTORY}")
220+
endforeach(DIRECTORY)
221+
222+
foreach(DLL ${K4A_DLL_FILES})
223+
foreach(DIRECTORY ${DLL_COPY_DIRECTORY})
224+
file(COPY "${DLL}" DESTINATION "${DIRECTORY}")
225+
get_filename_component(DLL_NAME ${DLL} NAME)
226+
message(STATUS "Copied dll from ${DLL_NAME} to ${DIRECTORY}")
227+
# Tell cmake that we need to clean up these DLLs on a "make clean"
228+
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${DIRECTORY}/${DLL_NAME}")
229+
endforeach(DIRECTORY)
230+
endforeach(DLL)
231+
232+
endif()
233+
234+
##################################
235+
###### END AZURE KINECT SDK ######
236+
##################################
237+
238+
include_directories(
239+
${catkin_INCLUDE_DIRS}
240+
${K4A_INCLUDE_DIRS}
241+
"include"
242+
)
243+
244+
target_link_libraries(${PROJECT_NAME}_node
245+
${K4A_LIBS}
246+
${catkin_LIBRARIES}
247+
)
248+
249+
target_link_libraries(${PROJECT_NAME}_nodelet
250+
${K4A_LIBS}
251+
${catkin_LIBRARIES}
252+
)
253+
254+
#############
255+
## Install ##
256+
#############
257+
258+
# all install targets should use catkin DESTINATION variables
259+
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
260+
261+
## Mark executables and/or libraries for installation
262+
install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}_nodelet
263+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
264+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
265+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
266+
)
267+
268+
## Mark other files for installation (e.g. launch and bag files, etc.)
269+
install(
270+
DIRECTORY
271+
launch
272+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
273+
)
274+
275+
## Run a custom install script for the K4A components
276+
## Running the two "CODE" blocks populates the cmake_install.cmake script with the information
277+
## about which DLLs to install, and where to install them.
278+
## We then run the more complex script to actually perform the installation.
279+
if (${K4A_INSTALL_NEEDED})
280+
message("Installing K4A SDK to binary output folder")
281+
install(CODE "set(K4A_DLL_FILES \"${K4A_DLL_FILES}\")")
282+
install(CODE "set(DLL_COPY_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}\")")
283+
install(SCRIPT "./cmake/azure-kinect-sensor-sdk-install.cmake")
284+
endif()

0 commit comments

Comments
 (0)