Skip to content

Commit f6ab290

Browse files
authored
Merge pull request #110 from neufieldrobotics/dev
This merge from dev to master add the following major changes: Add external triggering ROI settings for images Bring Travis CI to master Adding gain settings to code Bump up version to 1.1.0 Number of little improvements and bug fixes.
2 parents 4977ee8 + b799b30 commit f6ab290

33 files changed

+928
-916
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ $ cat .gitignore
22
*.[oa]
33
*~
44

5+
include/spinnaker_sdk_camera_driver/spinnaker_configure.h
6+
57
# no .a files
68
#*.a
79

@@ -17,6 +19,7 @@ data/
1719
devel
1820
~devel/lib/datacollection_neu/*.xml
1921
.catkin_workspace
22+
include/spinnaker_sdk_camera_driver/spinnaker_configure.h
2023

2124
# ignore doc/notes.txt, but not doc/server/arch.txt
2225
#doc/*.txt

Diff for: .travis.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
language: minimal
2+
3+
services:
4+
- docker
5+
6+
matrix:
7+
include:
8+
- arch: amd64
9+
env : DOCKER_IMAGE=ros:melodic-perception-bionic SPINNAKER_VERSION=2.0.0.147
10+
- arch: amd64
11+
env : DOCKER_IMAGE=ros:kinetic-perception-xenial SPINNAKER_VERSION=2.0.0.147
12+
- arch: amd64
13+
env : DOCKER_IMAGE=ros:melodic-perception-bionic SPINNAKER_VERSION=2.2.0.48
14+
- arch: amd64
15+
env : DOCKER_IMAGE=ros:kinetic-perception-xenial SPINNAKER_VERSION=1.24.0.60
16+
- arch: amd64
17+
env : DOCKER_IMAGE=ros:melodic-perception-bionic SPINNAKER_VERSION=1.24.0.60
18+
- arch: arm64
19+
env : DOCKER_IMAGE=arm64v8/ros:kinetic-perception-xenial SPINNAKER_VERSION=2.0.0.147
20+
- arch: arm64
21+
env : DOCKER_IMAGE=arm64v8/ros:melodic-perception-bionic SPINNAKER_VERSION=2.0.0.147
22+
23+
before_install:
24+
- docker pull $DOCKER_IMAGE
25+
26+
script:
27+
- echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
28+
- >
29+
docker run
30+
-v $TRAVIS_BUILD_DIR:/ros_ws/src/spinnaker_sdk_camera_driver/
31+
--env SPINNAKER_VERSION=$SPINNAKER_VERSION
32+
--env SPINNAKER_LINUX_ARCH=$TRAVIS_CPU_ARCH
33+
$DOCKER_IMAGE
34+
/bin/bash -c
35+
"
36+
/ros_ws/src/spinnaker_sdk_camera_driver/download_and_install_spinnaker.sh;
37+
cd /ros_ws;
38+
catkin_make
39+
"

Diff for: CMakeLists.txt

+20-17
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
88
###
99
# camera Acquisition specific
1010
###
11-
#SET("OpenCV_DIR" "~/apps/opencv-2.4.13/")
1211
set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include" CACHE PATH "Project Include Directory")
13-
#set(SPINNAKER_INCLUDE_DIR "/usr/include/spinnaker" CACHE PATH "Spinnaker Include Directory")
14-
#set(SPINNAKER_LIB_DIR "/usr/lib" CACHE PATH "Spinnaker Libs Directory")
15-
# set(yaml-cpp_DIR "~/apps/yaml-cpp" CACHE PATH "yaml-cpp Directory")
1612
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
1713

1814
find_package(catkin REQUIRED COMPONENTS
@@ -25,7 +21,7 @@ find_package(catkin REQUIRED COMPONENTS
2521
dynamic_reconfigure
2622
nodelet
2723
)
28-
24+
find_package(trigger_msgs)
2925
#find_package(PCL REQUIRED)
3026

3127
###
@@ -53,6 +49,13 @@ elseif(NOT Boost_FOUND)
5349
message("Boost not found!")
5450
endif()
5551

52+
# configure a header file to pass some of the CMake settings
53+
# to the source code
54+
configure_file (
55+
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h.in"
56+
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h"
57+
)
58+
5659
add_message_files(
5760
FILES
5861
SpinnakerImageNames.msg
@@ -110,31 +113,27 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
110113

111114
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
112115

116+
# Make package version available in CPP as a defination
117+
add_definitions("-D${PROJECT_NAME}_VERSION=\"${${PROJECT_NAME}_VERSION}\"")
118+
113119
add_library (acquilib SHARED
114120
src/capture.cpp
115121
src/camera.cpp
116122
)
117-
118123
add_dependencies(acquilib ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
119124
target_link_libraries(acquilib ${LIBS} ${catkin_LIBRARIES})
120125

121-
add_library(capture_nodelet src/capture_nodelet.cpp src/subscriber_nodelet.cpp)
122-
target_link_libraries(capture_nodelet acquilib ${catkin_LIBRARIES})
123-
124126
add_executable (acquisition_node src/acquisition_node.cpp)
125127
add_dependencies(acquisition_node acquilib ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
126128
target_link_libraries (acquisition_node acquilib ${LIBS} ${catkin_LIBRARIES})
127129

130+
## subscriber_example for subscribing as nodelet
131+
add_library (subscriber_example examples/subscriber_nodelet.cpp)
132+
add_dependencies(subscriber_example ${catkin_EXPORTED_TARGETS})
133+
target_link_libraries(subscriber_example ${catkin_LIBRARIES})
128134

129-
add_executable (acquisition_nodelet src/acquisition_nodelet.cpp)
130-
add_dependencies(acquisition_nodelet acquilib capture_nodelet ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencfg)
131-
target_link_libraries (acquisition_nodelet acquilib capture_nodelet ${LIBS} ${catkin_LIBRARIES})
132-
133-
add_executable (nodelet_test src/nodelet_test.cpp)
134-
add_dependencies(nodelet_test ${catkin_EXPORTED_TARGETS})
135-
target_link_libraries (nodelet_test capture_nodelet ${LIBS} ${catkin_LIBRARIES})
136135

137-
install(TARGETS acquilib acquisition_node capture_nodelet acquisition_nodelet nodelet_test
136+
install(TARGETS acquilib acquisition_node subscriber_example
138137
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
139138
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
140139
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
@@ -144,3 +143,7 @@ install(DIRECTORY include
144143
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
145144
FILES_MATCHING PATTERN "*.h"
146145
)
146+
147+
install(FILES nodelet_plugins.xml
148+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
149+
)

Diff for: README.md

+43-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1-
# spinnaker_sdk_camera_driver
1+
master:
2+
[![Build Status](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver.svg?branch=master)](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver)
3+
dev: [![Build Status](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver.svg?branch=dev)](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver)
24

5+
# spinnaker_sdk_camera_driver
36
These are the ros drivers for running the Pt Grey (FLIR) cameras that use the Spinnaker SDK. This code has been tested with various Point Grey Blackfly S (BFS) cameras.
47

8+
## Compatibility Matrix
9+
| Spinnaker | Architecture | Ubnuntu 16.04 Xenial +<br>ROS Kinetic | Ubnuntu 18.04 Bionic +<br>ROS Melodic | Ubnuntu 20.04 Focal +<br>ROS Noetic |
10+
|-----------|:------------:|:--------------------------------------:|:-------------------------------------:|:-----------------------------------:|
11+
| 1.17.0.23 | AMD64 | :heavy_check_mark: |:heavy_minus_sign: |:heavy_minus_sign: |
12+
| 1.17.0.23 | ARM64 | :heavy_check_mark: |:heavy_minus_sign: |:heavy_minus_sign: |
13+
| 1.24.0.60 | AMD64 | :heavy_check_mark: |:heavy_minus_sign: |:heavy_minus_sign: |
14+
| 1.24.0.60 | ARM64 | :heavy_check_mark: |:heavy_minus_sign: |:heavy_minus_sign: |
15+
| 2.0.0.147 | AMD64 | :heavy_check_mark: |:white_check_mark: |:heavy_minus_sign: |
16+
| 2.0.0.147 | ARM64 | :heavy_check_mark: | |:heavy_minus_sign: |
17+
| 2.2.0.48 | AMD64 | :heavy_minus_sign: |:heavy_check_mark: | |
18+
| 2.2.0.48 | ARM64 | :heavy_minus_sign: | | |
19+
| 2.3.0.77 | AMD64 | :heavy_minus_sign: | | |
20+
| 2.3.0.77 | ARM64 | :heavy_minus_sign: | | |
21+
22+
:heavy_check_mark: Tested
23+
:heavy_minus_sign: Not Applicable
24+
:white_check_mark: Reported to work
25+
:x: Known compatibility Issue
26+
527
## Getting Started
628

729
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
@@ -48,15 +70,12 @@ source ~/spinnaker_ws/devel/setup.bash
4870
Modify the `params/test_params.yaml` file replacing the cam-ids and master cam serial number to match your camera's serial number. Then run the code as:
4971
```bash
5072
# To launch nodelet verison of driver, use #
51-
5273
roslaunch spinnaker_sdk_camera_driver acquisition.launch
5374

5475
# To launch node version of driver, use #
55-
56-
roslaunch spinnaker_sdk_camera_driver acquisition_node.launch
76+
roslaunch spinnaker_sdk_camera_driver node_acquisition.launch
5777

5878
# Test that the images are being published by running
59-
6079
rqt_image_view
6180
```
6281
## Parmeters
@@ -69,6 +88,8 @@ All the parameters can be set via the launch file or via the yaml config_file.
6988
Should color images be used (only works on models that support color images)
7089
* ~exposure_time (int, default: 0, 0:auto)
7190
Exposure setting for cameras, also available as dynamic reconfiguarble parameter.
91+
* ~external_trigger (bool, default: false)
92+
Camera triggering setting when using an external trigger. In this mode, none of the cameras would be set as a master camera. All cameras are setup to use external trigger. In this mode the main loop runs at rate set by soft_framerate, so if the external trigger rate is higher than the soft_framerate, the buffer will get filled and images will have a lag. Also in this mode, the getnextimage timeout is set to infinite so that the node dosen't die if a trigger is not received for a while.
7293
* ~target_grey_value (double, default: 0 , 0:Continous/auto)
7394
Setting target_grey_value > 4 (min:4 , max:99) will turn AutoExposureTargetGreyValueAuto to 'off' and set AutoExposureTargetGreyValue to target_grey_value. Also available as dynamic reconfigurable parameter. see below in Dynamic reconfigurable parameter section.
7495
* ~frames (int, default: 50)
@@ -81,7 +102,7 @@ All the parameters can be set via the launch file or via the yaml config_file.
81102
Flag whether images should be saved or not (via opencv mat objects to disk)
82103
* ~save_path (string, default: "\~/projects/data")
83104
Location to save the image data
84-
* \~save_type (string, default: "bmp")
105+
* ~save_type (string, default: "bmp")
85106
Type of file type to save to when saving images locally: binary, tiff, bmp, jpeg etc.
86107
* ~soft_framerate (int, default: 20)
87108
When hybrid software triggering is used, this controls the FPS, 0=as fast as possible
@@ -93,6 +114,18 @@ All the parameters can be set via the launch file or via the yaml config_file.
93114
Flag whether each image should have Unique timestamps vs the master cams time stamp for all
94115
* ~max_rate_save (bool, default: false)
95116
Flag for max rate mode which is when the master triggers the slaves and saves images at maximum rate possible. This is the multithreaded mode
117+
* ~flip_horizontal (bool, default: false)
118+
Flag to flip image horizontally on camera itself, this is not a rotate only a mirror image. This setting does enumeration: "reverseX". It should be specified for all cameras or can be left unspecified for all cameras for default behaviour.
119+
* ~flip_vertical (bool, default: false)
120+
Flag to flip image vertically on camera itself, this is not a rotate only a mirror image. This setting does enumeration: "reverseY". It should be specified for all cameras or can be left unspecified for all cameras for default behaviour.
121+
If both horizontal and vertical flags are true, then it is equivalent to rotating 180deg.
122+
* ~region_of_interest (dict, default = { width: 0, height: 0, x_offset: 0, y_offset: 0 }
123+
Specify the region of interest in the camera image as dict with width, height, x_offset and y_offset. Width and height specify size of the final image (should be smaller than sensor size). X and Y offsets specify the image origin. The offset plus image size should be smaller than the sensor size.
124+
125+
### node/nodelet Specific Parameters
126+
* ~tf_prefix (string, default: "")
127+
tf_prefix will be pre-fixed to (existing cam_*_optical_frame) frame id in ros Image msg and cameraInfo msg. default option doesn't add any prefix to frame id. eg: uas1/cam_0_optical_frame if tf_prefix:= uas1
128+
96129

97130
### System configuration parameters
98131
* ~cam_ids (yaml sequence or array)
@@ -120,11 +153,11 @@ This is the names that would be given to the cameras for filenames and rostopics
120153
When exposure_time is set to 0(zero), the ExposureAuto is set to 'Continuous', enabling auto exposure.
121154

122155
### nodelet details
123-
* ~nodelet_manager_name (string, default: vision_nodelet_manager)
156+
* ~manager (string, default: vision_nodelet_manager)
124157
Specify the name of the nodelet_manager under which nodelet to be launched.
125-
* ~start_nodelet_manager (bool, default: false)
126-
If set True, nodelet_manager of name $(arg nodelet_manager_name) will be launched.
127-
If set False(default), the acquisition/capture_nodelet waits for the nodelet_manager name $(arg nodelet_manager_name).
158+
* ~external_manager (bool, default: false)
159+
If set False(default), nodelet_manager of name $(arg manager) will be launched.
160+
If set True, the acquisition/Capture waits for the nodelet_manager name $(arg manager).
128161

129162
### Camera info message details
130163
* ~image_width (int)

Diff for: cfg/debug_console.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Set the default ros output to warning and higher
22
log4j.logger.ros=INFO
3-
log4j.logger.ros.datacollection_neu=DEBUG
3+
log4j.logger.ros.spinnaker_sdk_camera_driver=DEBUG
44

55

Diff for: download_and_install_spinnaker.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
4+
CWD=`pwd`
5+
6+
export DEBIAN_FRONTEND=noninteractive
7+
8+
# install basic packages
9+
apt-get update
10+
apt-get install -q -y --no-install-recommends \
11+
build-essential tree wget dirmngr gnupg2 vim nano git debconf-utils libunwind-dev iputils-ping dialog apt-utils
12+
13+
wget https://coe.northeastern.edu/fieldrobotics/spinnaker_sdk_archive/spinnaker-$SPINNAKER_VERSION-$SPINNAKER_LINUX_ARCH-pkg.tar.gz -nv
14+
15+
tar -zxvf spinnaker-$SPINNAKER_VERSION-$SPINNAKER_LINUX_ARCH-pkg.tar.gz
16+
cd spinnaker-$SPINNAKER_VERSION-$SPINNAKER_LINUX_ARCH
17+
18+
# fix issue with 'logname' command on docker, required by spinnaker 2.2.0.48
19+
mv /usr/bin/logname /usr/bin/logname_old
20+
echo "echo root" > /usr/bin/logname
21+
chmod +x /usr/bin/logname
22+
23+
# auto accept spinnaker license agreements
24+
echo libspinnaker libspinnaker/present-flir-eula note '' | debconf-set-selections
25+
echo libspinnaker libspinnaker/accepted-flir-eula boolean true | debconf-set-selections
26+
27+
dpkg -i *.deb
28+
29+
cd ..
30+

Diff for: examples/subscriber_nodelet.cpp

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//
2+
// Created by pushyami on 1/15/19.
3+
//
4+
//cpp
5+
#include <iostream>
6+
// ROS
7+
#include <ros/ros.h>
8+
#include <image_transport/image_transport.h>
9+
//#include <cv_bridge/cv_bridge.h>
10+
// msgs
11+
#include "sensor_msgs/Image.h"
12+
//#include "sensor_msgs/CameraInfo.h"
13+
14+
// nodelets
15+
#include <nodelet/nodelet.h>
16+
#include <pluginlib/class_list_macros.h>
17+
18+
19+
20+
namespace subscriber_nodelet_ns
21+
{
22+
class subscriber_nodelet: public nodelet::Nodelet
23+
{
24+
//This is a test nodelet for measuring nodelet performance
25+
public:
26+
subscriber_nodelet(){}
27+
~subscriber_nodelet()
28+
{
29+
it_.reset();
30+
}
31+
32+
std::shared_ptr<image_transport::ImageTransport> it_;
33+
image_transport::Subscriber image_sub_;
34+
35+
virtual void onInit()
36+
{
37+
NODELET_INFO("Initializing Subscriber nodelet");
38+
ros::NodeHandle& node = getNodeHandle();
39+
ros::NodeHandle& private_nh = getPrivateNodeHandle();
40+
41+
it_.reset(new image_transport::ImageTransport(node));
42+
image_sub_ = it_->subscribe("/camera_array/cam0/image_raw",1, &subscriber_nodelet::imgCallback, this);
43+
NODELET_INFO("onInit for Subscriber nodelet Initialized");
44+
}
45+
46+
void imgCallback(const sensor_msgs::Image::ConstPtr& msg)
47+
{
48+
// dont modify the input msg in any way
49+
sensor_msgs::Image tmp_img = *msg;
50+
NODELET_INFO_STREAM("diff time is "<< ros::Time::now().toSec() - tmp_img.header.stamp.toSec());
51+
// copy input img to cv::mat and do any cv stuff
52+
// dont do time intense stuff in callbacks
53+
}
54+
};
55+
}
56+
57+
PLUGINLIB_EXPORT_CLASS(subscriber_nodelet_ns::subscriber_nodelet, nodelet::Nodelet)

Diff for: include/spinnaker_sdk_camera_driver/camera.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ namespace acquisition {
5959
// void setTrigMode();
6060
// void setTriggerOverlapOff();
6161

62-
string get_id() { return string(pCam_->GetUniqueID()); }
62+
string getTLNodeStringValue(string node_string);
63+
double getFloatValueMax(string node_string);
64+
string get_id();
6365
void make_master() { MASTER_ = true; ROS_DEBUG_STREAM( "camera " << get_id() << " set as master"); }
6466
bool is_master() { return MASTER_; }
6567
void set_color(bool flag) { COLOR_ = flag; }
68+
void setGetNextImageTimeout(uint64_t get_next_image_timeout) { GET_NEXT_IMAGE_TIMEOUT_ = get_next_image_timeout; }
69+
bool verifyBinning(int binningDesired);
70+
void calibrationParamsTest(int calibrationWidth, int calibrationHeight);
6671

6772
private:
6873

0 commit comments

Comments
 (0)