Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2e64799
Start overhauling the spinnaker download script so it works with the …
civerachb-cpr Feb 3, 2020
9e0b5f9
Spinnaker driver now successfully downloads & builds
civerachb-cpr Feb 3, 2020
8ae03ff
Remove an unnecessary deb
civerachb-cpr Mar 13, 2020
b3e93f8
Create the directory if it doesn't exist
civerachb-cpr Mar 13, 2020
bdc886e
Merge pull request #42 from civerachb-cpr/rpsw-185
tonybaltovski Apr 6, 2020
fec86c4
Changed the download script to check for destination folder and moved…
tonybaltovski Apr 7, 2020
c484223
Removed opencv as depend. (#46)
tonybaltovski Apr 7, 2020
a43c417
Added Melodic to TravisCI. (#45)
tonybaltovski May 4, 2020
174961f
Fix/frame rate params (#20)
YoshuaNava May 4, 2020
317b34b
Add auto exposure ROI parameters (#52)
xqms Jun 8, 2020
9c00201
Update Spinnaker.cfg (#50)
Benefe Jun 8, 2020
fddc779
Feature: horizontal and vertical image reverse (#41)
fabianschilling Jun 24, 2020
fa1d908
Added support for Grasshopper3. Identical to Chameleon3, split into s…
romleiaj Jul 24, 2020
1a33cef
add option to set queue_size for ros publisher (#54)
furushchev Jul 24, 2020
445d6bc
increase maximum value of exposure_time/auto_exposure_time_upper_limi…
furushchev Jul 24, 2020
bf3b067
Add /opt/spinnaker to spinnaker discovery options (#63)
jccurtis Feb 11, 2021
82e78d9
Fixes SpinnakerCamera teardown (#16)
ebretl Feb 11, 2021
faf7cd6
Add new parameter to apply an offset to image time stamps (#56)
stwirth Feb 11, 2021
da37069
Branch to Support GigE Cameras (#79)
luis-camero Oct 29, 2021
a79c509
URDF Description, Diagnostics, ISP Enable, and Launch Files (#81)
luis-camero Dec 1, 2021
6f16c47
Merge branch 'kinetic-devel' into feature/import_updates_from_forked_…
Jan 20, 2022
dd97643
Delete package
Jan 20, 2022
6ac10dc
Fix build
Jan 20, 2022
db4ae91
Update parameters
Jan 20, 2022
2ddc805
Fix
Jan 20, 2022
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
35 changes: 28 additions & 7 deletions cfg/Spinnaker.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,24 @@ gen = ParameterGenerator()

# Name Type Reconfiguration level Description Default Min Max
gen.add("acquisition_frame_rate", double_t, SensorLevels.RECONFIGURE_RUNNING, "User controlled acquisition frame rate in Hertz (frames per second).", 25, 0, 120)
gen.add("acquisition_frame_rate_enable", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Enables manual (true) and automatic (false) control of the aquisition frame rate", False)
gen.add("acquisition_frame_rate_enable", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Enables manual (True) and automatic (False) control of the aquisition frame rate", False)


# Set Exposure
# Note: For the Auto Exposure feature, gain and/or exposure time must be set to Once or Continuous.
capture_modes = gen.enum([gen.const("AutoOff", str_t, "Off", ""),
gen.const("AutoOnce", str_t, "Once", ""),
gen.const("AutoContinuous", str_t, "Continuous", "")],
"Automatic mode: Off, Once, or Continuous.")
gen.add("exposure_mode", str_t, SensorLevels.RECONFIGURE_STOP, "Sets the operation mode of the Exposure (Timed or TriggerWidth).", "Timed")
gen.add("exposure_auto", str_t, SensorLevels.RECONFIGURE_RUNNING, "Sets the automatic exposure mode to: 'Off', 'Once' or 'Continuous'", "Continuous")
gen.add("exposure_auto", str_t, SensorLevels.RECONFIGURE_RUNNING, "Sets the automatic exposure mode to: 'Off', 'Once' or 'Continuous'", "Continuous", edit_method=capture_modes)
gen.add("exposure_time", double_t, SensorLevels.RECONFIGURE_RUNNING, "Exposure time in microseconds when Exposure Mode is Timed and Exposure Auto is not Continuous.", 5000.0, 100.0, 40000)
gen.add("auto_exposure_time_upper_limit", double_t, SensorLevels.RECONFIGURE_RUNNING, "Upper Limit on Shutter Speed.", 5000.0, 100.0, 40000)


# Gain Settings
gen.add("gain_selector", str_t, SensorLevels.RECONFIGURE_RUNNING, "Selects which gain to control. The All selection is a total amplification across all channels.", "All")
gen.add("auto_gain", str_t, SensorLevels.RECONFIGURE_RUNNING, "Gain state control. (Off, Once, Continuous)", "Continuous")
gen.add("auto_gain", str_t, SensorLevels.RECONFIGURE_RUNNING, "Gain state control. (Off, Once, Continuous)", "Continuous", edit_method=capture_modes)
gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING, "Controls the amplification of the video signal in dB.", 0, -10, 30)

# Pan and Tilt not in Spinnaker Driver
Expand All @@ -113,7 +117,7 @@ gen.add("gamma", double_t, SensorLevels.RECON


# White Balance
gen.add("auto_white_balance", str_t, SensorLevels.RECONFIGURE_RUNNING, "White Balance compensates for color shifts caused by different lighting conditions.", "Continuous")
gen.add("auto_white_balance", str_t, SensorLevels.RECONFIGURE_RUNNING, "White Balance compensates for color shifts caused by different lighting conditions.", "Continuous", edit_method=capture_modes)
gen.add("white_balance_blue_ratio", double_t, SensorLevels.RECONFIGURE_RUNNING, "White balance blue component.", 800, 0, 1023)
gen.add("white_balance_red_ratio", double_t, SensorLevels.RECONFIGURE_RUNNING, "White balance red component.", 550, 0, 1023)

Expand Down Expand Up @@ -173,7 +177,8 @@ codings = gen.enum([gen.const("Mono8", str_t, "Mono8", ""),

"Image Color Coding: Format of the pixel provided by the camera.")

gen.add("image_format_color_coding", str_t, SensorLevels.RECONFIGURE_STOP, "Image Color coding", "Mono8", edit_method = codings)
gen.add("image_format_color_coding", str_t, SensorLevels.RECONFIGURE_STOP, "Image Color coding", "Mono8", edit_method = codings)
gen.add("isp_enable", bool_t, SensorLevels.RECONFIGURE_STOP, "Controls whether the image processing core is used for optional pixel format mode", True)


# Trigger parameters
Expand Down Expand Up @@ -287,8 +292,24 @@ line_modes = gen.enum([gen.const("Input", str_t, "Input", ""),

gen.add("line_mode", str_t, SensorLevels.RECONFIGURE_RUNNING, "Line Mode", "Input", edit_method = line_modes)

gen.add("reverse_x", bool_t, SensorLevels.RECONFIGURE_STOP, "Enables mirroring the image frame around the x axis", False)
gen.add("reverse_y", bool_t, SensorLevels.RECONFIGURE_STOP, "Enables mirroring the image frame around the y axis", False)
gen.add("image_format_x_reverse", bool_t, SensorLevels.RECONFIGURE_STOP, "Enables mirroring the image around the x axis", False)
gen.add("image_format_y_reverse", bool_t, SensorLevels.RECONFIGURE_STOP, "Enables mirroring the image around the y axis", False)

# Auto algorithm parameters
gen.add("auto_exposure_roi_offset_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure ROI X offset.", 0, 0, 65535)
gen.add("auto_exposure_roi_offset_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure ROI Y offset.", 0, 0, 65535)
gen.add("auto_exposure_roi_width", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure ROI width.", 0, 0, 65535)
gen.add("auto_exposure_roi_height", int_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure ROI height.", 0, 0, 65535)

auto_lighting_mode = gen.enum([
gen.const("Normal", str_t, "Normal", "Normal"),
gen.const("Frontlight", str_t, "Frontlight", "Front Lighting"),
gen.const("Backlight", str_t, "Backlight", "Back Lighting")
], "Auto algorithms lighting modes")
gen.add("auto_exposure_lighting_mode", str_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure lighting mode.", "Normal", edit_method=auto_lighting_mode)

# Other
gen.add("time_offset", double_t, SensorLevels.RECONFIGURE_RUNNING, "Time offset to add to image time stamps.", 0.0, -5.0, 5.0)


exit(gen.generate(PACKAGE, "any_spinnaker_camera_driver", "Spinnaker"))
4 changes: 2 additions & 2 deletions cfg/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ spinnaker_camera_nodelet:
image_format_x_binning: 1
image_format_x_decimation: 1
image_format_x_offset: 0
image_format_x_reverse: false
image_format_y_binning: 1
image_format_y_decimation: 1
image_format_y_offset: 0
image_format_y_reverse: false
line_mode: Input
line_selector: Line0
line_source: Off
reverse_x: false
reverse_y: false
saturation: 100.0
saturation_enable: false
serial: 0
Expand Down
14 changes: 10 additions & 4 deletions cmake/DownloadSpinnaker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ function(download_spinnaker FLIR_LIB_VAR FLIR_INCLUDE_DIR_VAR)
message(FATAL_ERROR "Downloading libSpinnaker for non-linux systems not supported")
endif()

execute_process(
COMMAND lsb_release -cs
OUTPUT_VARIABLE OS_CODE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)

include(cmake/TargetArch.cmake)
target_architecture(FLIR_ARCH)
message(STATUS "Running download_spinnaker script with arguments: ${FLIR_ARCH} ${CATKIN_DEVEL_PREFIX}/lib/any_spinnaker_camera_driver/ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}")
set(FLIR_DIR ${CMAKE_CURRENT_BINARY_DIR}/usr/lib)
set(DOWNLOAD_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/download_spinnaker")

message(STATUS "Running download_spinnaker script with arguments: ${FLIR_ARCH} ${FLIR_DIR} ${OS_CODE_NAME}")
execute_process(
COMMAND ${DOWNLOAD_SCRIPT} ${FLIR_ARCH} "${CATKIN_DEVEL_PREFIX}/lib/any_spinnaker_camera_driver/"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(${FLIR_LIB_VAR} "${CMAKE_CURRENT_BINARY_DIR}/usr/lib/libSpinnaker.so" PARENT_SCOPE)
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)
endfunction()
185 changes: 132 additions & 53 deletions cmake/download_spinnaker
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# Software License Agreement (BSD)
#
# @author Mike Purvis <mpurvis@clearpathrobotics.com>
# @author Chris Iverach-Brereton <civerachb@clearpathrobotics.com>
# @copyright (c) 2014, Clearpath Robotics, Inc., All rights reserved.
# @usage download_spinnaker {arch} {dir} {os-code-name}
# e.g. download_spinnaker x86_64 /path/to/somewhere xenial
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that
# the following conditions are met:
Expand Down Expand Up @@ -37,82 +40,158 @@ import glob

logging.basicConfig(level=logging.INFO)

LOGIN_URL = 'https://www.ptgrey.com/login'
LOGIN_DATA = {
'Email': 'code@clearpathrobotics.com',
'Password': 'uNjRxoH6NMsJvi6hyPCH'
}
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.
}

ARCHS = {
'i386': (
'https://www.ptgrey.com/support/downloads/11047/',
'spinnaker-1.13.0.31-i386',
'libSpinnaker.so.1.13.0.31'),
'x86_64': (
'https://www.ptgrey.com/support/downloads/11048/',
'spinnaker-1.13.0.31-amd64',
'libSpinnaker.so.1.13.0.31'),
'armv7': (
'https://www.ptgrey.com/support/downloads/11046/',
'spinnaker-1.13.0.31-armhf',
'libSpinnaker.so.1.13.0.31'),
'armv8': (
'https://www.ptgrey.com/support/downloads/11045/',
'spinnaker-1.13.0.31-arm64',
'libSpinnaker.so.1.13.0.31')
'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'
]
}
}


OS_LIBRARY_VERSION = {
'jessie': 'current',
'xenial': 'current',
'bionic': 'future'
}

archive_url, folder_name, shared_library = ARCHS[sys.argv[1]]
arch = sys.argv[1]
destination_folder = sys.argv[2]
os_code_name = sys.argv[3]

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']


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)):
logging.info("Logging into ptgrey.com.")
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [
('User-agent', 'Mozilla/5.0'),
('Referer', 'https://www.ptgrey.com')]
opener.open(LOGIN_URL, urllib.urlencode(LOGIN_DATA))

logging.info("Downloading SDK archive.")
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()

logging.info("Unpacking debs.")
debs = glob.glob(os.path.join(os.getcwd(), folder_name, "libspinvideoencoder-*.deb"))
debs += glob.glob(os.path.join(os.getcwd(), folder_name, "*spinnaker-*.deb"))
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)
for deb in debs:
subprocess.call(['dpkg', '-x', deb, os.path.join(os.getcwd(), folder_name)])

# Fix for 1.13.0.31
os.remove(os.path.join(os.getcwd(), folder_name, "usr/lib/libspinnaker.so.1"))
os.symlink(shared_library, os.path.join(os.getcwd(), folder_name, "usr/lib/libSpinnaker.so.1"))
logging.info('Extracting {0}'.format(deb))
subprocess.call(['dpkg', '--extract', deb, unpack_dir])

if not os.path.exists(os.path.join(os.getcwd(), "usr")):
os.mkdir(os.path.join(os.getcwd(), "usr"))

# For every folder/file, copy it into the /usr folder we just created.
for filename in os.listdir(os.path.join(os.getcwd(), folder_name, "usr")):
if not os.path.exists(os.path.join(os.getcwd(), "usr", filename)):
shutil.move(os.path.join(os.getcwd(), folder_name, "usr", filename), os.path.join(os.getcwd(), "usr", filename))

# now we do some thing for XML files; copy them next to the catkin binary
xml_path = os.path.join(os.getcwd(), "usr/lib/")
xml_files = os.listdir(xml_path)

try:
# 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)
except:
logging.info("Error XML folder either exists or can't be created.")

for files in xml_files:
if files.endswith(".xml"):
origin_file = os.path.join(xml_path, files)
print('Copying ' + origin_file + ' to ' + destination_folder)
shutil.copy(origin_file, destination_folder)
shutil.copyfile(src_file, os.path.join(destination_folder, 'libSpinnaker.so'))
1 change: 1 addition & 0 deletions include/any_spinnaker_camera_driver/SpinnakerCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <any_spinnaker_camera_driver/SpinnakerConfig.h>
#include "any_spinnaker_camera_driver/camera.h"
#include "any_spinnaker_camera_driver/cm3.h"
#include "any_spinnaker_camera_driver/gh3.h"
#include "any_spinnaker_camera_driver/set_property.h"

// Spinnaker SDK
Expand Down
Loading