Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include noetic build in CI #67

Open
wants to merge 9 commits into
base: kinetic-devel
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
matrix: # each line is a job
- ROS_DISTRO="kinetic"
- ROS_DISTRO="melodic"
- ROS_DISTRO="noetic"

# clone and run industrial_ci
install:
Expand Down
17 changes: 2 additions & 15 deletions spinnaker_camera_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ generate_dynamic_reconfigure_options(
)

catkin_package(CATKIN_DEPENDS
image_exposure_msgs nodelet roscpp sensor_msgs wfov_camera_msgs
image_exposure_msgs nodelet roscpp sensor_msgs wfov_camera_msgs dynamic_reconfigure
)


# If Spinnacker is already present, use the found version. If not, download it.
# If Spinnaker is already present, use the found version. If not, download it.
# We can't resolve this dependency using the usual rosdep means because
# the Point Grey EULA prohibits redistributing the headers or the packages which
# contains them. We work around this by downloading the archive directly from
Expand Down Expand Up @@ -101,19 +101,6 @@ install(TARGETS
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

# Redistributing the flycapture .so file is permitted by the SDK EULA:
# http://www.ptgrey.com/support/kb/data/PGR-FlyCap-SDK-LA.pdf
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/usr/lib)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/usr/lib/ DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're not bundling the sdk anymore. Do we not need this for the deb?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that license agreement is outdated (there is no flycapture / pointgrey anymore, it's Spinnaker / FLIR now) and I think it is better to let the users install the SDK by themselves. We could try to make a separate ROS package that just catkinizes the Spinnaker SDK but I won't have time for that. The official way of installing the SDK also includes an explicit manual confirmation of the license.

So my suggestion is to use the download script just for CI and encourage the user to use this package from source.
Any better ideas?

PATTERN libQt* EXCLUDE)
else()
get_filename_component(Spinnaker_LIB_DIR ${Spinnaker_LIBRARIES} DIRECTORY)
file(READ ${PROJECT_SOURCE_DIR}/cmake/install_files filenames)
foreach(filename ${filenames})
install(FILES ${Spinnaker_LIB_DIR}/${filename} DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
endforeach()
endif()

install(FILES nodelet_plugins.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} )

install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
Expand Down
23 changes: 17 additions & 6 deletions spinnaker_camera_driver/cmake/DownloadSpinnaker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,24 @@ function(download_spinnaker FLIR_LIB_VAR FLIR_INCLUDE_DIR_VAR)
OUTPUT_STRIP_TRAILING_WHITESPACE)

include(cmake/TargetArch.cmake)
target_architecture(FLIR_ARCH)
set(FLIR_DIR ${CMAKE_CURRENT_BINARY_DIR}/usr/lib)
target_architecture(TARGET_ARCH)
set(DOWNLOAD_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/download_spinnaker")

message(STATUS "Running download_spinnaker script with arguments: ${FLIR_ARCH} ${FLIR_DIR} ${OS_CODE_NAME}")
set(SPINNAKER_SDK_DIR ${CMAKE_CURRENT_BINARY_DIR}/spinnaker-sdk)

message(STATUS "Running download_spinnaker script with arguments: ${TARGET_ARCH} ${OS_CODE_NAME} ${SPINNAKER_SDK_DIR}")
execute_process(
COMMAND ${DOWNLOAD_SCRIPT} ${FLIR_ARCH} "${FLIR_DIR}" ${OS_CODE_NAME})
set(${FLIR_LIB_VAR} "${FLIR_DIR}/libSpinnaker.so" PARENT_SCOPE)
set(${FLIR_INCLUDE_DIR_VAR} "${CMAKE_CURRENT_BINARY_DIR}/usr/include/spinnaker" PARENT_SCOPE)
COMMAND ${DOWNLOAD_SCRIPT} ${TARGET_ARCH} ${FLIR_DIR} ${OS_CODE_NAME} ${SPINNAKER_SDK_DIR}
RESULT_VARIABLE DOWNLOAD_EXIT_CODE)
if(NOT DOWNLOAD_EXIT_CODE EQUAL "0")
message(FATAL_ERROR "Could not download Spinnaker SDK!")
endif()

set(SPINNAKER_SEARCH_PATHS ${SPINNAKER_SDK_DIR}/usr ${SPINNAKER_SDK_DIR}/opt/spinnaker)

find_path(_Spinnaker_INCLUDE_DIR NAMES Spinnaker.h PATHS ${SPINNAKER_SEARCH_PATHS} NO_DEFAULT_PATH PATH_SUFFIXES include include/spinnaker REQUIRED)
find_library(_Spinnaker_LIBRARY NAMES Spinnaker PATHS ${SPINNAKER_SEARCH_PATHS} NO_DEFAULT_PATH PATH_SUFFIXES lib REQUIRED)

set(${FLIR_INCLUDE_DIR_VAR} "${_Spinnaker_INCLUDE_DIR}" PARENT_SCOPE)
set(${FLIR_LIB_VAR} "${_Spinnaker_LIBRARY}" PARENT_SCOPE)
endfunction()
200 changes: 57 additions & 143 deletions spinnaker_camera_driver/cmake/download_spinnaker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Software License Agreement (BSD)
#
Expand Down Expand Up @@ -26,172 +26,86 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import cookielib
import cStringIO
import argparse
import http.cookiejar
import io
import logging
import shutil
import subprocess
import sys
import tarfile
import urllib
import urllib2
import urllib.request, urllib.parse, urllib.error
import os
import glob

logging.basicConfig(level=logging.INFO)

URL_TEMPLATE = URL_TEMPLATES = {
'deb': 'https://packages.clearpathrobotics.com/stable/flir/Spinnaker/Ubuntu{version}/spinnaker-1.27.0.48-Ubuntu{version}-{arch}-pkg.tar.gz',
'src': None # if we ever have non-deb archives that require manual extraction, those package URLS will go here.
}
URL_TEMPLATE = 'https://packages.clearpathrobotics.com/stable/flir/Spinnaker/Ubuntu{os_version}/spinnaker-{spinnaker_version}-Ubuntu{os_version}-{arch}-pkg.tar.gz'

ARCHS = {
'i386': {
'linux_arch': 'i386',
'current': '16.04',
'type': 'deb',
'folder_name': 'spinnaker-1.27.0.48-i386',
'shared_library': 'usr/lib/libSpinnaker.so.1.27.0.48',
'debs': [
'libspinnaker-1.27.0.48_i386.deb',
'libspinnaker-1.27.0.48_i386-dev.deb',
'libspinnaker-c-1.27.0.48_i386.deb',
'libspinnaker-c-1.27.0.48_i386-dev.deb',
'libspinvideo-1.27.0.48_i386.deb',
'libspinvideo-1.27.0.48_i386-dev.deb',
'libspinvideo-c-1.27.0.48_i386.deb',
'libspinvideo-c-1.27.0.48_i386-dev.deb',
'spinnaker-1.27.0.48_i386.deb',
'spinnaker-doc-1.27.0.48_i386.deb',
'spinupdate-1.27.0.48_i386.deb',
'spinupdate-1.27.0.48_i386-dev.deb',
'spinview-qt-1.27.0.48_i386.deb',
'spinview-qt-1.27.0.48_i386-dev.deb'
]
},
'x86_64': {
'linux_arch': 'amd64',
'current': '16.04',
'future': '18.04',
'type': 'deb',
'folder_name': 'spinnaker-1.27.0.48-amd64',
'shared_library': 'usr/lib/libSpinnaker.so.1.27.0.48',
'debs': [
'libspinnaker-1.27.0.48_amd64.deb',
'libspinnaker-1.27.0.48_amd64-dev.deb',
'libspinnaker-c-1.27.0.48_amd64.deb',
'libspinnaker-c-1.27.0.48_amd64-dev.deb',
'libspinvideo-1.27.0.48_amd64.deb',
'libspinvideo-1.27.0.48_amd64-dev.deb',
'libspinvideo-c-1.27.0.48_amd64.deb',
'libspinvideo-c-1.27.0.48_amd64-dev.deb',
'spinnaker-1.27.0.48_amd64.deb',
'spinnaker-doc-1.27.0.48_amd64.deb',
'spinupdate-1.27.0.48_amd64.deb',
'spinupdate-1.27.0.48_amd64-dev.deb',
'spinview-qt-1.27.0.48_amd64.deb',
'spinview-qt-1.27.0.48_amd64-dev.deb'
]
},
'armv7': {
'linux_arch': 'armhf',
'current': '16.04',
'type': 'deb',
'shared_library': 'usr/lib/libSpinnaker.so.1.27.0.48',
'folder_name': 'spinnaker-1.27.0.48_armhf',
'debs': [
'libspinnaker-1.27.0.48_armhf.deb',
'libspinnaker-1.27.0.48_armhf-dev.deb',
'libspinnaker-c-1.27.0.48_armhf.deb',
'libspinnaker-c-1.27.0.48_armhf-dev.deb',
'libspinvideo-1.27.0.48_armhf.deb',
'libspinvideo-1.27.0.48_armhf-dev.deb',
'libspinvideo-c-1.27.0.48_armhf.deb',
'libspinvideo-c-1.27.0.48_armhf-dev.deb',
'spinnaker-1.27.0.48_armhf.deb',
'spinnaker-doc-1.27.0.48_armhf.deb',
'spinupdate-1.27.0.48_armhf.deb',
'spinupdate-1.27.0.48_armhf-dev.deb',
'spinview-qt-1.27.0.48_armhf.deb',
'spinview-qt-1.27.0.48_armhf-dev.deb'
]
},
'armv8': {
'linux_arch': 'armh64',
'current': '16.04',
'future': '18.04',
'type': 'deb',
'shared_library': 'usr/lib/libSpinnaker.so.1.27.0.48',
'folder_name': 'spinnaker-1.27.0.48_arm64',
'debs': [
'libspinnaker-1.27.0.48_arm64.deb',
'libspinnaker-1.27.0.48_arm64-dev.deb',
'libspinnaker-c-1.27.0.48_arm64.deb',
'libspinnaker-c-1.27.0.48_arm64-dev.deb',
'libspinvideo-1.27.0.48_arm64.deb',
'libspinvideo-1.27.0.48_arm64-dev.deb',
'libspinvideo-c-1.27.0.48_arm64.deb',
'libspinvideo-c-1.27.0.48_arm64-dev.deb',
'spinnaker-1.27.0.48_arm64.deb',
'spinnaker-doc-1.27.0.48_arm64.deb',
'spinupdate-1.27.0.48_arm64.deb',
'spinupdate-1.27.0.48_arm64-dev.deb',
'spinview-qt-1.27.0.48_arm64.deb',
'spinview-qt-1.27.0.48_arm64-dev.deb'
]
}
ARCH_MAPPINGS = {
'i386' : 'i386',
'x86_64': 'amd64',
'armv7' : 'armhf',
'armv8' : 'armh64'
}


OS_LIBRARY_VERSION = {
'jessie': 'current',
'xenial': 'current',
'bionic': 'future'
'jessie': '16.04',
'xenial': '16.04',
'bionic': '18.04',
'focal' : '20.04'
}

SPINNAKER_SDK_VERSIONS = {
'jessie': '1.27.0.48',
'xenial': '1.27.0.48',
'bionic': '1.27.0.48',
'focal' : '2.2.0.48'
}

arch = sys.argv[1]
destination_folder = sys.argv[2]
os_code_name = sys.argv[3]
parser = argparse.ArgumentParser()
parser.add_argument('arch', choices=ARCH_MAPPINGS.keys())
parser.add_argument('os', choices=OS_LIBRARY_VERSION.keys())
parser.add_argument('target_folder')
args = parser.parse_args()
arch = args.arch
os_code_name = args.os
target_folder = args.target_folder

os_version = OS_LIBRARY_VERSION[os_code_name]
archive_url = URL_TEMPLATES[ARCHS[arch]['type']].format(
arch=ARCHS[arch]['linux_arch'],
version=ARCHS[arch][os_version])
folder_name = ARCHS[arch]['folder_name']
shared_library = ARCHS[arch]['shared_library']

spinnaker_version = SPINNAKER_SDK_VERSIONS[os_code_name]
archive_url = URL_TEMPLATE.format(
arch=ARCH_MAPPINGS[arch],
os_version=os_version,
spinnaker_version=spinnaker_version)

logging.info("CPU architecture is %s", arch)
logging.info("OS code name is %s", os_code_name)
logging.info("Destination folder is %s", destination_folder)

if not os.path.exists(os.path.join(os.getcwd(), "usr/lib/")):
if not os.path.exists(os.path.join(os.getcwd(), folder_name)):
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [
('User-agent', 'Mozilla/5.0'),
('Referer', 'https://www.ptgrey.com')]
if not os.path.exists(target_folder):
os.makedirs(target_folder)
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
opener.addheaders = [
('User-agent', 'Mozilla/5.0'),
('Referer', 'https://www.ptgrey.com')]

logging.info("Downloading SDK archive from {0}...".format(archive_url))
resp = opener.open(archive_url)
logging.info("Downloading SDK archive from {0}...".format(archive_url))
resp = opener.open(archive_url)

logging.info("Unpacking tarball.")
with tarfile.open(mode="r:gz", fileobj=cStringIO.StringIO(resp.read())) as tar:
tar.extractall()
with tarfile.open(mode="r:gz", fileobj=io.BytesIO(resp.read())) as tar:
tar.extractall()

logging.info("Unpacking debs.")
debs = glob.glob(os.path.join(os.getcwd(), folder_name, "*spinnaker-*.deb"))
unpack_dir = os.path.join(os.getcwd())
if not os.path.exists(unpack_dir):
os.makedirs(unpack_dir)
debs = glob.glob(os.path.join(os.getcwd(), "*", "*spinnaker*.deb"))
logging.info('Unpacking debs to {}.'.format(target_folder))
for deb in debs:
logging.info('Extracting {0}'.format(deb))
subprocess.call(['dpkg', '--extract', deb, unpack_dir])

# finally, copy the shared libraries into the output folder
src_file = os.path.join(unpack_dir, ARCHS[arch]['shared_library'])
logging.info('Copying shared library to {0}'.format(destination_folder))
if not os.path.exists(destination_folder):
os.makedirs(destination_folder)
shutil.copyfile(src_file, os.path.join(destination_folder, 'libSpinnaker.so'))
subprocess.call(['dpkg', '--extract', deb, target_folder])
# SDK version 1.27.0.48 has broken symlinks
if spinnaker_version == '1.27.0.48':
logging.info('Patching broken symlink.')
lib_path = os.path.join(target_folder, 'usr', 'lib')
os.unlink(os.path.join(lib_path, 'libspinnaker.so.1'))
os.symlink(os.path.join(lib_path, 'libSpinnaker.so.1.27.0.48'), os.path.join(lib_path, 'libSpinnaker.so.1'))
else:
logging.info('Download folder {} already exists. Skipping.'.format(target_folder))
1 change: 0 additions & 1 deletion spinnaker_camera_driver/cmake/install_files

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sstream>
#include <mutex>
#include <string>
#include <memory>

// Header generated by dynamic_reconfigure
#include <spinnaker_camera_driver/SpinnakerConfig.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <utility>
#include <string>
#include <vector>
#include <memory>

namespace spinnaker_camera_driver
{
Expand Down
1 change: 1 addition & 0 deletions spinnaker_camera_driver/src/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <utility>
#include <string>
#include <memory>

namespace spinnaker_camera_driver
{
Expand Down
2 changes: 2 additions & 0 deletions spinnaker_camera_driver/src/nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <fstream>
#include <string>
#include <memory>
#include <utility>

namespace spinnaker_camera_driver
{
Expand Down