Skip to content
Merged
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
244 changes: 37 additions & 207 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 2.8.3)
project(spinnaker_sdk_camera_driver)

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

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

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


## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
cv_bridge
image_transport
sensor_msgs
# tf
)

#find_package(PCL REQUIRED)
Expand All @@ -37,228 +31,64 @@ find_package(catkin REQUIRED COMPONENTS
###
# Find Packages
find_package(OpenCV REQUIRED)
find_package(LibUnwind REQUIRED)

find_package(Boost)
find_package(Boost REQUIRED)
if(Boost_FOUND)
find_package ( Boost COMPONENTS filesystem system serialization REQUIRED )
set(Boost_GENERAL ${Boost_LIBRARIES})
elseif(NOT Boost_FOUND)
message("Boost not found!")
endif()

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
add_message_files(
FILES
spinnaker_image_names.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
)

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )



################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed
add_message_files(
FILES
SpinnakerImageNames.msg
)

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )
generate_messages(
DEPENDENCIES
std_msgs
)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
#LIBRARIES datacollection_neu
CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
# DEPENDS system_lib
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp std_msgs message_runtime
DEPENDS OpenCV LibUnwind
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${PROJECT_INCLUDE_DIR}
${catkin_INCLUDE_DIRS}
# ${PCL_INCLUDE_DIRS}
${SPINNAKER_INCLUDE_DIR}
${OpenCV_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
${LibUnwind_INCLUDE_DIRS}
)
include_directories( ${PROJECT_INCLUDE_DIR} )
include_directories( ${SPINNAKER_INCLUDE_DIR} )
include_directories( ${OpenCV_INCLUDE_DIRS} )
include_directories( ${Boost_INCLUDE_DIR} )
#include_directories( ${YAML_CPP_INCLUDE_DIR} )

## Declare a C++ library
add_library (acquilib SHARED
# ${PROJECT_SOURCE_DIR}/src/utils.cpp
src/capture.cpp
src/camera.cpp)

link_directories( ${SPINNAKER_LIB_DIR} )

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

# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/datacollection_neu.cpp
# )
add_library (acquilib SHARED
src/capture.cpp
src/camera.cpp
)

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

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
#add_executable(${PROJECT_NAME}_node src/datacollection_neu_node.cpp)
add_executable (acquisition_node src/acquisition_node.cpp)


#target_link_libraries (multiAcq_node acquilib ${LIBS} )
#target_link_libraries (acquisition_mt_node acquilib ${LIBS} ${catkin_LIBRARIES})
#target_link_libraries (conversion_node acquilib ${LIBS} )
add_dependencies(acquisition_node acquilib ${catkin_EXPORTED_TARGETS})
target_link_libraries (acquisition_node acquilib ${LIBS} ${catkin_LIBRARIES})
add_dependencies(acquisition_node spinnaker_sdk_camera_driver_generate_messages_cpp)
#add_dependencies(acquisition_mt_node datacollection_neu_generate_messages_cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(acquisition_node ${catkin_EXPORTED_TARGETS})
#add_dependencies(acquisition_mt_node ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_datacollection_neu.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
install(TARGETS acquilib acquisition_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
install(DIRECTORY include
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
42 changes: 42 additions & 0 deletions cmake/FindLibUnwind.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Find the libunwind library
#
# LibUnwind_FOUND - True if libunwind was found.
# LibUnwind_LIBRARIES - The libraries needed to use libunwind
# LibUnwind_INCLUDE_DIRS - Location of unwind.h and libunwind.h

FIND_PATH(LibUnwind_INCLUDE_DIRS libunwind.h)
if(NOT LibUnwind_INCLUDE_DIRS)
message(STATUS "failed to find libunwind.h")
elseif(NOT EXISTS "${LibUnwind_INCLUDE_DIRS}/unwind.h")
message(STATUS "libunwind.h was found, but unwind.h was not found in that directory.")
SET(LibUnwind_INCLUDE_DIRS "")
endif()

FIND_LIBRARY(LibUnwind_GENERIC_LIBRARY "unwind")
if(NOT LibUnwind_GENERIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind generic library")
endif()
SET(LibUnwind_LIBRARIES ${LibUnwind_GENERIC_LIBRARY})

# For some reason, we have to link to two libunwind shared object files:
# one arch-specific and one not.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
SET(LibUnwind_ARCH "arm")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
SET(LibUnwind_ARCH "x86_64")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
SET(LibUnwind_ARCH "x86")
endif()

if(LibUnwind_ARCH)
FIND_LIBRARY(LibUnwind_SPECIFIC_LIBRARY "unwind-${LibUnwind_ARCH}")
if (NOT LibUnwind_SPECIFIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind-${LibUnwind_ARCH}")
endif()
SET(LibUnwind_LIBRARIES ${LibUnwind_LIBRARIES} ${LibUnwind_SPECIFIC_LIBRARY})
endif(LibUnwind_ARCH)

MARK_AS_ADVANCED(LibUnwind_LIBRARIES LibUnwind_INCLUDE_DIRS)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUnwind DEFAULT_MSG
LibUnwind_LIBRARIES LibUnwind_INCLUDE_DIRS)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <boost/filesystem.hpp>

#include "std_msgs/String.h"
#include "spinnaker_sdk_camera_driver/spinnaker_image_names.h"
#include "spinnaker_sdk_camera_driver/SpinnakerImageNames.h"

#include <sstream>

Expand Down Expand Up @@ -84,7 +84,7 @@ namespace acquisition {
double grab_time_, save_time_, toMat_time_, save_mat_time_, export_to_ROS_time_, achieved_time_;

int nframes_;
int init_delay_;
float init_delay_;
int skip_num_;
float master_fps_;
int binning_;
Expand Down Expand Up @@ -128,7 +128,7 @@ namespace acquisition {

vector<sensor_msgs::ImagePtr> img_msgs;
vector<sensor_msgs::CameraInfo> cam_info_msgs;
spinnaker_sdk_camera_driver::spinnaker_image_names mesg;
spinnaker_sdk_camera_driver::SpinnakerImageNames mesg;
boost::mutex queue_mutex_;
};

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading