Skip to content

Commit

Permalink
Merge pull request #91 from luis-camero/noetic-devel
Browse files Browse the repository at this point in the history
ROS Industrial CI
  • Loading branch information
tonybaltovski committed Mar 10, 2022
2 parents a88dd2a + f24b0a8 commit 117ca3c
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 129 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/industrial_ci_action.yml
@@ -0,0 +1,43 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the noetic-devel branch
push:
branches: [ noetic-devel ]
pull_request:
branches: [ noetic-devel ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
industrial_ci:
name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
runs-on: ubuntu-latest
strategy:
matrix:
ROS_DISTRO: [noetic]
ROS_REP: [testing, main]
env:
CCACHE_DIR: "${{ github.workspace }}/.ccache" # directory for ccache (and how we enable ccache in industrial_ci)
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
# This configuration will always create a new ccache cache starting off from the previous one (if any).
# In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
# and might need some fine-tuning to match the use case
key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
restore-keys: |
ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
- uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
env: # either pass all entries explicitly
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
ROS_REPO: ${{ matrix.ROS_REPO }}
# with: # or pass the full matrix as config
# config: ${{toJSON(matrix)}
2 changes: 1 addition & 1 deletion flir_camera_description/CMakeLists.txt
Expand Up @@ -5,6 +5,6 @@ find_package(catkin REQUIRED)

catkin_package()

install(DIRECTORY launch meshes rviz urdf
install(DIRECTORY meshes urdf
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
4 changes: 2 additions & 2 deletions spinnaker_camera_driver/cmake/DownloadSpinnaker.cmake
Expand Up @@ -16,6 +16,6 @@ function(download_spinnaker FLIR_LIB_VAR FLIR_INCLUDE_DIR_VAR)
message(STATUS "Running download_spinnaker script with arguments: ${FLIR_ARCH} ${FLIR_DIR} ${OS_CODE_NAME}")
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)
set(${FLIR_LIB_VAR} "${CMAKE_BINARY_DIR}/opt/spinnaker/lib/libSpinnaker.so" PARENT_SCOPE)
set(${FLIR_INCLUDE_DIR_VAR} "${CMAKE_BINARY_DIR}/opt/spinnaker/include/" PARENT_SCOPE)
endfunction()
144 changes: 48 additions & 96 deletions spinnaker_camera_driver/cmake/download_spinnaker
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Software License Agreement (BSD)
#
Expand Down Expand Up @@ -26,127 +26,78 @@
# 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 http.cookiejar
import io
import logging
import shutil
import subprocess
import sys
import tarfile
import urllib
import urllib2
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',
'deb': 'https://packages.clearpathrobotics.com/stable/flir/Spinnaker/Ubuntu{version}/spinnaker-2.2.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': {
'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',
'current': '20.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'
'folder_name': 'spinnaker-2.2.0.48-amd64',
'shared_library': 'opt/spinnaker/lib/libSpinnaker.so.2.2.0.48',
'debs':[
'libgentl_2.2.0.48_amd64.deb',
'libspinnaker_2.2.0.48_amd64.deb',
'libspinnaker-c_2.2.0.48_amd64.deb',
'libspinnaker-c-dev_2.2.0.48_amd64.deb',
'libspinnaker-dev_2.2.0.48_amd64.deb',
'libspinvideo_2.2.0.48_amd64.deb',
'libspinvideo-c_2.2.0.48_amd64.deb',
'libspinvideo-c-dev_2.2.0.48_amd64.deb',
'libspinvideo-dev_2.2.0.48_amd64.deb',
'spinnaker_2.2.0.48_amd64.deb',
'spinnaker-doc_2.2.0.48_amd64.deb',
'spinupdate_2.2.0.48_amd64.deb',
'spinupdate-dev_2.2.0.48_amd64.deb',
'spinview-qt_2.2.0.48_amd64.deb',
'spinview-qt-dev_2.2.0.48_amd64.deb'
]
},
'armv8': {
'linux_arch': 'armh64',
'current': '16.04',
'future': '18.04',
'current': '20.04',
'type': 'deb',
'shared_library': 'usr/lib/libSpinnaker.so.1.27.0.48',
'folder_name': 'spinnaker-1.27.0.48_arm64',
'shared_library': 'opt/spinnaker/lib/libSpinnaker.so.2.2.0.48',
'folder_name': 'spinnaker-2.2.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'
'libgentl_2.2.0.48_arm64.deb',
'libspinnaker_2.2.0.48_arm64.deb',
'libspinnaker-c_2.2.0.48_arm64.deb',
'libspinnaker-c-dev_2.2.0.48_arm64.deb',
'libspinnaker-dev_2.2.0.48_arm64.deb',
'libspinvideo_2.2.0.48_arm64.deb',
'libspinvideo-c_2.2.0.48_arm64.deb',
'libspinvideo-c-dev_2.2.0.48_arm64.deb',
'libspinvideo-dev_2.2.0.48_arm64.deb',
'spinnaker_2.2.0.48_arm64.deb',
'spinnaker-doc_2.2.0.48_arm64.deb',
'spinupdate_2.2.0.48_arm64.deb',
'spinupdate-dev_2.2.0.48_arm64.deb',
'spinview-qt_2.2.0.48_arm64.deb',
'spinview-qt-dev_2.2.0.48_arm64.deb'
]
}
}


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

arch = sys.argv[1]
Expand All @@ -167,8 +118,8 @@ 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))
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')]
Expand All @@ -177,11 +128,12 @@ if not os.path.exists(os.path.join(os.getcwd(), "usr/lib/")):
resp = opener.open(archive_url)

logging.info("Unpacking tarball.")
with tarfile.open(mode="r:gz", fileobj=cStringIO.StringIO(resp.read())) as tar:
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"))
#debs = glob.glob(os.path.join(os.getcwd(), folder_name, "*spinnaker-*.deb"))
debs = glob.glob(os.path.join(os.getcwd(), folder_name, "*.deb"))
unpack_dir = os.path.join(os.getcwd())
if not os.path.exists(unpack_dir):
os.makedirs(unpack_dir)
Expand All @@ -190,7 +142,7 @@ if not os.path.exists(os.path.join(os.getcwd(), "usr/lib/")):
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'])
src_file = os.path.join(unpack_dir, shared_library)
logging.info('Copying shared library to {0}'.format(destination_folder))
if not os.path.exists(destination_folder):
os.makedirs(destination_folder)
Expand Down
Expand Up @@ -48,8 +48,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sensor_msgs/fill_image.h>
#include <spinnaker_camera_driver/camera_exceptions.h>

#include <sstream>
#include <memory>
#include <mutex>
#include <sstream>
#include <string>

// Header generated by dynamic_reconfigure
Expand Down
Expand Up @@ -49,16 +49,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <ros/ros.h>
#include <bondcpp/bond.h>

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

namespace spinnaker_camera_driver
{
class DiagnosticsManager
{
public:
DiagnosticsManager(const std::string name, const std::string serial, std::shared_ptr<ros::Publisher> const& pub, ros::NodeHandle& nh);
DiagnosticsManager(const std::string name, const std::string serial,
std::shared_ptr<ros::Publisher> const& pub,
const ros::NodeHandle& nh);
~DiagnosticsManager();

/*!
Expand Down
13 changes: 7 additions & 6 deletions spinnaker_camera_driver/src/SpinnakerCamera.cpp
Expand Up @@ -346,15 +346,17 @@ void SpinnakerCamera::grabImage(sensor_msgs::Image* image, const std::string& fr
// std::string format(image_ptr->GetPixelFormatName());
// std::printf("\033[100m format: %s \n", format.c_str());

//throw std::runtime_error("[SpinnakerCamera::grabImage] Image received from camera " + std::to_string(serial_) +
// " is incomplete.");
// throw std::runtime_error("[SpinnakerCamera::grabImage] Image received from camera "
// + std::to_string(serial_)
// + " is incomplete.");
while (image_ptr->IsIncomplete())
{
ROS_WARN_STREAM_ONCE("[SpinnakerCamera::grabImage] Image received from camera " << std::to_string(serial_) << " is incomplete. Trying again.");
ROS_WARN_STREAM_ONCE("[SpinnakerCamera::grabImage] Image received from camera "
<< std::to_string(serial_)
<< " is incomplete. Trying again.");
image_ptr = pCam_->GetNextImage(timeout_);
}



// Set Image Time Stamp
image->header.stamp.sec = image_ptr->GetTimeStamp() * 1e-9;
image->header.stamp.nsec = image_ptr->GetTimeStamp();
Expand Down Expand Up @@ -450,7 +452,6 @@ void SpinnakerCamera::grabImage(sensor_msgs::Image* image, const std::string& fr
// ROS_INFO_ONCE("\033[93m wxh: (%d, %d), stride: %d \n", width, height, stride);
fillImage(*image, imageEncoding, height, width, stride, image_ptr->GetData());
image->header.frame_id = frame_id;

}
catch (const Spinnaker::Exception& e)
{
Expand Down

0 comments on commit 117ca3c

Please sign in to comment.