Skip to content

Commit d9a0527

Browse files
author
Vikrant Shah
authored
Merge pull request #16 from JWhitleyAStuff/master
package.xml to version 2. Cleaning up CMakeLists. Fixing ROS_INFO calls.
2 parents a32d2fa + e09dd69 commit d9a0527

File tree

13 files changed

+100
-238
lines changed

13 files changed

+100
-238
lines changed

CMakeLists.txt

Lines changed: 37 additions & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmake_minimum_required(VERSION 2.8.3)
22
project(spinnaker_sdk_camera_driver)
33

4-
## Compile as C++11, supported in ROS Kinetic and newer
5-
# add_compile_options(-std=c++11)
4+
add_compile_options(-std=c++11)
65

6+
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
77

88
###
99
# camera Acquisition specific
@@ -15,19 +15,13 @@ set(SPINNAKER_LIB_DIR "/usr/lib" CACHE PATH "Spinnaker Libs Directory")
1515
# set(yaml-cpp_DIR "~/apps/yaml-cpp" CACHE PATH "yaml-cpp Directory")
1616
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
1717

18-
19-
## Find catkin macros and libraries
20-
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
21-
## is used, also find other catkin packages
2218
find_package(catkin REQUIRED COMPONENTS
2319
roscpp
24-
rospy
2520
std_msgs
2621
message_generation
2722
cv_bridge
2823
image_transport
2924
sensor_msgs
30-
# tf
3125
)
3226

3327
#find_package(PCL REQUIRED)
@@ -37,228 +31,64 @@ find_package(catkin REQUIRED COMPONENTS
3731
###
3832
# Find Packages
3933
find_package(OpenCV REQUIRED)
34+
find_package(LibUnwind REQUIRED)
4035

41-
find_package(Boost)
36+
find_package(Boost REQUIRED)
4237
if(Boost_FOUND)
4338
find_package ( Boost COMPONENTS filesystem system serialization REQUIRED )
4439
set(Boost_GENERAL ${Boost_LIBRARIES})
4540
elseif(NOT Boost_FOUND)
4641
message("Boost not found!")
4742
endif()
4843

49-
## System dependencies are found with CMake's conventions
50-
# find_package(Boost REQUIRED COMPONENTS system)
51-
52-
53-
## Uncomment this if the package has a setup.py. This macro ensures
54-
## modules and global scripts declared therein get installed
55-
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
56-
# catkin_python_setup()
57-
58-
################################################
59-
## Declare ROS messages, services and actions ##
60-
################################################
61-
62-
## To declare and build messages, services or actions from within this
63-
## package, follow these steps:
64-
## * Let MSG_DEP_SET be the set of packages whose message types you use in
65-
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
66-
## * In the file package.xml:
67-
## * add a build_depend tag for "message_generation"
68-
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
69-
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
70-
## but can be declared for certainty nonetheless:
71-
## * add a run_depend tag for "message_runtime"
72-
## * In this file (CMakeLists.txt):
73-
## * add "message_generation" and every package in MSG_DEP_SET to
74-
## find_package(catkin REQUIRED COMPONENTS ...)
75-
## * add "message_runtime" and every package in MSG_DEP_SET to
76-
## catkin_package(CATKIN_DEPENDS ...)
77-
## * uncomment the add_*_files sections below as needed
78-
## and list every .msg/.srv/.action file to be processed
79-
## * uncomment the generate_messages entry below
80-
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
81-
82-
## Generate messages in the 'msg' folder
83-
add_message_files(
84-
FILES
85-
spinnaker_image_names.msg
86-
)
87-
88-
## Generate added messages and services with any dependencies listed here
89-
generate_messages(
90-
DEPENDENCIES
91-
std_msgs
92-
)
93-
94-
## Generate services in the 'srv' folder
95-
# add_service_files(
96-
# FILES
97-
# Service1.srv
98-
# Service2.srv
99-
# )
100-
101-
## Generate actions in the 'action' folder
102-
# add_action_files(
103-
# FILES
104-
# Action1.action
105-
# Action2.action
106-
# )
107-
108-
109-
110-
################################################
111-
## Declare ROS dynamic reconfigure parameters ##
112-
################################################
113-
114-
## To declare and build dynamic reconfigure parameters within this
115-
## package, follow these steps:
116-
## * In the file package.xml:
117-
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
118-
## * In this file (CMakeLists.txt):
119-
## * add "dynamic_reconfigure" to
120-
## find_package(catkin REQUIRED COMPONENTS ...)
121-
## * uncomment the "generate_dynamic_reconfigure_options" section below
122-
## and list every .cfg file to be processed
44+
add_message_files(
45+
FILES
46+
SpinnakerImageNames.msg
47+
)
12348

124-
## Generate dynamic reconfigure parameters in the 'cfg' folder
125-
# generate_dynamic_reconfigure_options(
126-
# cfg/DynReconf1.cfg
127-
# cfg/DynReconf2.cfg
128-
# )
49+
generate_messages(
50+
DEPENDENCIES
51+
std_msgs
52+
)
12953

130-
###################################
131-
## catkin specific configuration ##
132-
###################################
133-
## The catkin_package macro generates cmake config files for your package
134-
## Declare things to be passed to dependent projects
135-
## INCLUDE_DIRS: uncomment this if you package contains header files
136-
## LIBRARIES: libraries you create in this project that dependent projects also need
137-
## CATKIN_DEPENDS: catkin_packages dependent projects also need
138-
## DEPENDS: system dependencies of this project that dependent projects also need
13954
catkin_package(
140-
INCLUDE_DIRS include
141-
#LIBRARIES datacollection_neu
142-
CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
143-
# DEPENDS system_lib
55+
INCLUDE_DIRS include
56+
CATKIN_DEPENDS roscpp std_msgs message_runtime
57+
DEPENDS OpenCV LibUnwind
14458
)
14559

146-
###########
147-
## Build ##
148-
###########
149-
150-
## Specify additional locations of header files
151-
## Your package locations should be listed before other locations
15260
include_directories(
153-
# include
61+
${PROJECT_INCLUDE_DIR}
15462
${catkin_INCLUDE_DIRS}
155-
# ${PCL_INCLUDE_DIRS}
63+
${SPINNAKER_INCLUDE_DIR}
64+
${OpenCV_INCLUDE_DIRS}
65+
${Boost_INCLUDE_DIR}
66+
${LibUnwind_INCLUDE_DIRS}
15667
)
157-
include_directories( ${PROJECT_INCLUDE_DIR} )
158-
include_directories( ${SPINNAKER_INCLUDE_DIR} )
159-
include_directories( ${OpenCV_INCLUDE_DIRS} )
160-
include_directories( ${Boost_INCLUDE_DIR} )
161-
#include_directories( ${YAML_CPP_INCLUDE_DIR} )
162-
163-
## Declare a C++ library
164-
add_library (acquilib SHARED
165-
# ${PROJECT_SOURCE_DIR}/src/utils.cpp
166-
src/capture.cpp
167-
src/camera.cpp)
16868

16969
link_directories( ${SPINNAKER_LIB_DIR} )
17070

171-
# Settings libraries to link to
172-
# set (ROS_LIBS ${cv_bridge_LIBRARIES} ${image_transport_LIBRARIES})
173-
#set (LIBS glog gflags gomp unwind Spinnaker yaml-cpp ${OpenCV_LIBS} ${Boost_GENERAL}) # ${ROS_LIBS} profiler
174-
set (LIBS gomp unwind Spinnaker ${OpenCV_LIBS} ${Boost_GENERAL}) # ${ROS_LIBS} profiler
175-
# Custom compiler flags
176-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -std=c++11")
71+
set (LIBS ${LibUnwind_LIBRARIES} Spinnaker ${OpenCV_LIBS} ${Boost_GENERAL})
17772

178-
# add_library(${PROJECT_NAME}
179-
# src/${PROJECT_NAME}/datacollection_neu.cpp
180-
# )
73+
add_library (acquilib SHARED
74+
src/capture.cpp
75+
src/camera.cpp
76+
)
18177

182-
## Add cmake target dependencies of the library
183-
## as an example, code may need to be generated before libraries
184-
## either from message generation or dynamic reconfigure
185-
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
78+
add_dependencies(acquilib ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
79+
target_link_libraries(acquilib ${LIBS} ${catkin_LIBRARIES})
18680

187-
## Declare a C++ executable
188-
## With catkin_make all packages are built within a single CMake context
189-
## The recommended prefix ensures that target names across packages don't collide
190-
#add_executable(${PROJECT_NAME}_node src/datacollection_neu_node.cpp)
19181
add_executable (acquisition_node src/acquisition_node.cpp)
192-
193-
194-
#target_link_libraries (multiAcq_node acquilib ${LIBS} )
195-
#target_link_libraries (acquisition_mt_node acquilib ${LIBS} ${catkin_LIBRARIES})
196-
#target_link_libraries (conversion_node acquilib ${LIBS} )
82+
add_dependencies(acquisition_node acquilib ${catkin_EXPORTED_TARGETS})
19783
target_link_libraries (acquisition_node acquilib ${LIBS} ${catkin_LIBRARIES})
198-
add_dependencies(acquisition_node spinnaker_sdk_camera_driver_generate_messages_cpp)
199-
#add_dependencies(acquisition_mt_node datacollection_neu_generate_messages_cpp)
200-
201-
## Rename C++ executable without prefix
202-
## The above recommended prefix causes long target names, the following renames the
203-
## target back to the shorter version for ease of user use
204-
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
205-
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
206-
207-
## Add cmake target dependencies of the executable
208-
## same as for the library above
209-
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
210-
add_dependencies(acquisition_node ${catkin_EXPORTED_TARGETS})
211-
#add_dependencies(acquisition_mt_node ${catkin_EXPORTED_TARGETS})
212-
213-
## Specify libraries to link a library or executable target against
214-
# target_link_libraries(${PROJECT_NAME}_node
215-
# ${catkin_LIBRARIES}
216-
# )
21784

218-
#############
219-
## Install ##
220-
#############
221-
222-
# all install targets should use catkin DESTINATION variables
223-
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
224-
225-
## Mark executable scripts (Python etc.) for installation
226-
## in contrast to setup.py, you can choose the destination
227-
# install(PROGRAMS
228-
# scripts/my_python_script
229-
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
230-
# )
231-
232-
## Mark executables and/or libraries for installation
233-
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
234-
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
235-
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
236-
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
237-
# )
238-
239-
## Mark cpp header files for installation
240-
# install(DIRECTORY include/${PROJECT_NAME}/
241-
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
242-
# FILES_MATCHING PATTERN "*.h"
243-
# PATTERN ".svn" EXCLUDE
244-
# )
245-
246-
## Mark other files for installation (e.g. launch and bag files, etc.)
247-
# install(FILES
248-
# # myfile1
249-
# # myfile2
250-
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
251-
# )
252-
253-
#############
254-
## Testing ##
255-
#############
256-
257-
## Add gtest based cpp test target and link libraries
258-
# catkin_add_gtest(${PROJECT_NAME}-test test/test_datacollection_neu.cpp)
259-
# if(TARGET ${PROJECT_NAME}-test)
260-
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
261-
# endif()
85+
install(TARGETS acquilib acquisition_node
86+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
87+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
88+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
89+
)
26290

263-
## Add folders to be run by python nosetests
264-
# catkin_add_nosetests(test)
91+
install(DIRECTORY include
92+
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
93+
FILES_MATCHING PATTERN "*.h"
94+
)

cmake/FindLibUnwind.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Find the libunwind library
2+
#
3+
# LibUnwind_FOUND - True if libunwind was found.
4+
# LibUnwind_LIBRARIES - The libraries needed to use libunwind
5+
# LibUnwind_INCLUDE_DIRS - Location of unwind.h and libunwind.h
6+
7+
FIND_PATH(LibUnwind_INCLUDE_DIRS libunwind.h)
8+
if(NOT LibUnwind_INCLUDE_DIRS)
9+
message(STATUS "failed to find libunwind.h")
10+
elseif(NOT EXISTS "${LibUnwind_INCLUDE_DIRS}/unwind.h")
11+
message(STATUS "libunwind.h was found, but unwind.h was not found in that directory.")
12+
SET(LibUnwind_INCLUDE_DIRS "")
13+
endif()
14+
15+
FIND_LIBRARY(LibUnwind_GENERIC_LIBRARY "unwind")
16+
if(NOT LibUnwind_GENERIC_LIBRARY)
17+
MESSAGE(STATUS "failed to find unwind generic library")
18+
endif()
19+
SET(LibUnwind_LIBRARIES ${LibUnwind_GENERIC_LIBRARY})
20+
21+
# For some reason, we have to link to two libunwind shared object files:
22+
# one arch-specific and one not.
23+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
24+
SET(LibUnwind_ARCH "arm")
25+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
26+
SET(LibUnwind_ARCH "x86_64")
27+
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
28+
SET(LibUnwind_ARCH "x86")
29+
endif()
30+
31+
if(LibUnwind_ARCH)
32+
FIND_LIBRARY(LibUnwind_SPECIFIC_LIBRARY "unwind-${LibUnwind_ARCH}")
33+
if (NOT LibUnwind_SPECIFIC_LIBRARY)
34+
MESSAGE(STATUS "failed to find unwind-${LibUnwind_ARCH}")
35+
endif()
36+
SET(LibUnwind_LIBRARIES ${LibUnwind_LIBRARIES} ${LibUnwind_SPECIFIC_LIBRARY})
37+
endif(LibUnwind_ARCH)
38+
39+
MARK_AS_ADVANCED(LibUnwind_LIBRARIES LibUnwind_INCLUDE_DIRS)
40+
41+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUnwind DEFAULT_MSG
42+
LibUnwind_LIBRARIES LibUnwind_INCLUDE_DIRS)
File renamed without changes.

include/capture.h renamed to include/spinnaker_sdk_camera_driver/capture.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <boost/filesystem.hpp>
1010

1111
#include "std_msgs/String.h"
12-
#include "spinnaker_sdk_camera_driver/spinnaker_image_names.h"
12+
#include "spinnaker_sdk_camera_driver/SpinnakerImageNames.h"
1313

1414
#include <sstream>
1515

@@ -84,7 +84,7 @@ namespace acquisition {
8484
double grab_time_, save_time_, toMat_time_, save_mat_time_, export_to_ROS_time_, achieved_time_;
8585

8686
int nframes_;
87-
int init_delay_;
87+
float init_delay_;
8888
int skip_num_;
8989
float master_fps_;
9090
int binning_;
@@ -128,7 +128,7 @@ namespace acquisition {
128128

129129
vector<sensor_msgs::ImagePtr> img_msgs;
130130
vector<sensor_msgs::CameraInfo> cam_info_msgs;
131-
spinnaker_sdk_camera_driver::spinnaker_image_names mesg;
131+
spinnaker_sdk_camera_driver::SpinnakerImageNames mesg;
132132
boost::mutex queue_mutex_;
133133
};
134134

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)