Skip to content

Commit cd430bd

Browse files
authored
Merge pull request #115 from neufieldrobotics/dev_master_merge
Dev master merge
2 parents 188c364 + e17654e commit cd430bd

File tree

11 files changed

+314
-63
lines changed

11 files changed

+314
-63
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**System Description**
11+
Camera Name and Model:
12+
Operating System:
13+
Spinnaker Version:
14+
ROS Version:
15+
16+
***Computer details***
17+
Processor:
18+
RAM:
19+
20+
***Multiple Cameras Only***
21+
How is the triggering setup? Master/Slave or all slaves or all software triggered?
22+
23+
For USB 3.0 cameras:
24+
On same USB 3.0 bus or different buses?
25+
Is the USB 3.0 hub externally powered?
26+
27+
For Ethernet cameras:
28+
How busy is the network, does the system work in grayscale, at a lower resoultion (binning) and framerate?
29+
30+
**Do the cameras work with SpinView?**
31+
32+
**Describe the bug**
33+
A clear and concise description of what the bug is.
34+
35+
**Error Messages**
36+
Copy and paste your error messages here
37+
38+
**Screenshots**
39+
If applicable, add screenshots to help explain your problem.

.gitignore

Lines changed: 2 additions & 0 deletions
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

CMakeLists.txt

Lines changed: 16 additions & 11 deletions
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,13 +21,15 @@ find_package(catkin REQUIRED COMPONENTS
2521
dynamic_reconfigure
2622
nodelet
2723
)
28-
24+
find_package(trigger_msgs)
2925
#find_package(PCL REQUIRED)
3026

3127
###
3228
# Acquisition specific
3329
###
3430
# Find Packages
31+
find_package(Spinnaker REQUIRED)
32+
message("spinnaker lib : " ${Spinnaker_LIBRARIES})
3533
find_package(OpenCV REQUIRED)
3634
# use LibUnwind only for x86_64 or x86_32 architecture
3735
# do not use LibUnwind for arm architecture
@@ -51,6 +49,13 @@ elseif(NOT Boost_FOUND)
5149
message("Boost not found!")
5250
endif()
5351

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+
5459
add_message_files(
5560
FILES
5661
SpinnakerImageNames.msg
@@ -76,15 +81,15 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
7681
include_directories(
7782
${PROJECT_INCLUDE_DIR}
7883
${catkin_INCLUDE_DIRS}
79-
SYSTEM ${SPINNAKER_INCLUDE_DIR}
84+
SYSTEM ${Spinnaker_INCLUDE_DIRS}
8085
SYSTEM ${OpenCV_INCLUDE_DIRS}
8186
SYSTEM ${Boost_INCLUDE_DIR}
8287
${LibUnwind_INCLUDE_DIRS}
8388
)
8489

85-
link_directories( ${SPINNAKER_LIB_DIR} )
90+
link_directories( ${Spinnaker_LIBRARIES} )
8691

87-
set (LIBS ${LibUnwind_LIBRARIES} Spinnaker ${OpenCV_LIBS} ${Boost_GENERAL})
92+
set (LIBS ${LibUnwind_LIBRARIES} ${Spinnaker_LIBRARIES} ${OpenCV_LIBS} ${Boost_GENERAL})
8893

8994
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64 OR x86_32)
9095
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
@@ -97,14 +102,14 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
97102
include_directories(
98103
${PROJECT_INCLUDE_DIR}
99104
${catkin_INCLUDE_DIRS}
100-
SYSTEM ${SPINNAKER_INCLUDE_DIR}
105+
SYSTEM ${Spinnaker_INCLUDE_DIRS}
101106
SYSTEM ${OpenCV_INCLUDE_DIRS}
102107
SYSTEM ${Boost_INCLUDE_DIR}
103108
)
104109

105-
link_directories( ${SPINNAKER_LIB_DIR} )
110+
link_directories( ${Spinnaker_LIBRARIES} )
106111

107-
set (LIBS Spinnaker ${OpenCV_LIBS} ${Boost_GENERAL})
112+
set (LIBS ${Spinnaker_LIBRARIES} ${OpenCV_LIBS} ${Boost_GENERAL})
108113

109114
endif(${CMAKE_SYSTEM_PROCESSOR} MATCHES aarch64 OR arm)
110115

README.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@ master:
33
dev: [![Build Status](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver.svg?branch=dev)](https://travis-ci.org/neufieldrobotics/spinnaker_sdk_camera_driver)
44

55
# spinnaker_sdk_camera_driver
6-
76
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.
87

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+
927
## Getting Started
1028

1129
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
@@ -18,23 +36,25 @@ The pre-requisites for this repo include:
1836
* ros-kinetic-cv-bridge
1937
* ros-kinetic-image-transport
2038

21-
**Incase of x86_64 or x86_32 architecture, also install *libunwind-dev* **
39+
#### After installing spinnaker, Verify that you can run your cameras with SpinView.
40+
41+
#### For x86_64 or x86_32 architecture, install the following:
42+
* libunwind-dev
2243

2344
```bash
24-
# after installing spinnaker verify that you can run your cameras with SpinView
2545

2646
# after installing ros, install other pre-requisites with:
2747

2848
sudo apt install libunwind-dev ros-kinetic-cv-bridge ros-kinetic-image-transport
49+
```
2950

30-
# if you use arm64 (aarch64), install pre-requisites with:
31-
51+
#### For arm64 (aarch64) architecture, install pre-requisites with:
52+
```
3253
sudo apt install ros-kinetic-cv-bridge ros-kinetic-image-transport
33-
3454
```
3555

3656
### Installing
37-
To install the spinnaker drivers
57+
To install this spinnaker_sdk_camera_driver
3858
```bash
3959
mkdir -p ~/spinnaker_ws/src
4060
cd spinnaker_ws/src
@@ -50,12 +70,11 @@ source ~/spinnaker_ws/devel/setup.bash
5070
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:
5171
```bash
5272
# To launch nodelet verison of driver, use #
73+
roslaunch spinnaker_sdk_camera_driver acquisition.launch
5374

54-
roslaunch spinnaker_camera_driver acquisition.launch
55-
56-
# To launch node version of driver, use
75+
# To launch node version of driver, use #
76+
roslaunch spinnaker_sdk_camera_driver node_acquisition.launch
5777

58-
roslaunch spinnaker_camera_driver node_acquisition.launch
5978
# Test that the images are being published by running
6079
rqt_image_view
6180
```
@@ -69,7 +88,7 @@ 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.
72-
* ~external_trigger (bool, default: false)
91+
* ~external_trigger (bool, default: false)
7392
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.
7493
* ~target_grey_value (double, default: 0 , 0:Continous/auto)
7594
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.

cfg/debug_console.conf

Lines changed: 1 addition & 1 deletion
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

cmake/FindSpinnaker.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Find the Spinnaker library
2+
#
3+
# Spinnaker_FOUND - True if Spinnaker was found.
4+
# Spinnaker_LIBRARIES - The libraries needed to use Spinnaker
5+
# Spinnaker_INCLUDE_DIRS - Location of Spinnaker.h
6+
7+
unset(Spinnaker_FOUND)
8+
unset(Spinnaker_INCLUDE_DIRS)
9+
unset(Spinnaker_LIBRARIES)
10+
11+
find_path(Spinnaker_INCLUDE_DIRS NAMES
12+
Spinnaker.h
13+
PATHS
14+
/opt/spinnaker/include
15+
)
16+
find_library(Spinnaker_LIBRARIES NAMES Spinnaker
17+
PATHS
18+
/opt/spinnaker/lib
19+
)
20+
21+
if(NOT Spinnaker_INCLUDE_DIRS OR NOT Spinnaker_LIBRARIES)
22+
message(STATUS "Couldnt find Spinnaker 2.2.x. Checking lower versions")
23+
find_path(Spinnaker_INCLUDE_DIRS NAMES
24+
Spinnaker.h
25+
PATHS
26+
/usr/include/spinnaker/
27+
/usr/local/include/spinnaker/
28+
)
29+
find_library(Spinnaker_LIBRARIES NAMES Spinnaker
30+
PATHS
31+
/usr/lib
32+
/usr/local/lib
33+
)
34+
if(NOT Spinnaker_INCLUDE_DIRS OR NOT Spinnaker_LIBRARIES)
35+
message(STATUS "Couldnt find Spinnaker.")
36+
endif()
37+
endif()
38+
39+
if (Spinnaker_INCLUDE_DIRS AND Spinnaker_LIBRARIES)
40+
message(STATUS "Spinnaker found in the system")
41+
set(Spinnaker_FOUND 1)
42+
endif (Spinnaker_INCLUDE_DIRS AND Spinnaker_LIBRARIES)

include/spinnaker_sdk_camera_driver/capture.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "std_include.h"
55
#include "serialization.h"
66
#include "camera.h"
7-
7+
#include "spinnaker_configure.h"
88
#include <boost/archive/binary_oarchive.hpp>
99
#include <boost/filesystem.hpp>
1010
//ROS
@@ -23,6 +23,10 @@
2323
#include <nodelet/loader.h>
2424
#include "pluginlib/class_list_macros.h"
2525

26+
#ifdef trigger_msgs_FOUND
27+
#include <trigger_msgs/sync_trigger.h>
28+
#endif
29+
2630
using namespace Spinnaker;
2731
using namespace Spinnaker::GenApi;
2832
using namespace Spinnaker::GenICam;
@@ -38,7 +42,7 @@ namespace acquisition {
3842
~Capture();
3943
Capture();
4044
virtual void onInit();
41-
45+
4246
std::shared_ptr<boost::thread> pubThread_;
4347

4448
void load_cameras();
@@ -73,7 +77,7 @@ namespace acquisition {
7377
void update_grid();
7478
void export_to_ROS();
7579
void dynamicReconfigureCallback(spinnaker_sdk_camera_driver::spinnaker_camConfig &config, uint32_t level);
76-
80+
7781
float mem_usage();
7882

7983
SystemPtr system_;
@@ -112,6 +116,7 @@ namespace acquisition {
112116
string ext_;
113117
float exposure_time_;
114118
double target_grey_value_;
119+
bool first_image_received;
115120
// int decimation_;
116121
string tf_prefix_;
117122
int soft_framerate_; // Software (ROS) frame rate
@@ -139,6 +144,21 @@ namespace acquisition {
139144
bool VERIFY_BINNING_;
140145
uint64_t SPINNAKER_GET_NEXT_IMAGE_TIMEOUT_;
141146

147+
#ifdef trigger_msgs_FOUND
148+
ros::Time latest_imu_trigger_time_;
149+
uint32_t prev_imu_trigger_count_ = 0;
150+
uint32_t latest_imu_trigger_count_;
151+
152+
void assignTimeStampCallback(const trigger_msgs::sync_trigger::ConstPtr& msg);
153+
struct SyncInfo_{
154+
uint32_t latest_imu_trigger_count_;
155+
ros::Time latest_imu_trigger_time_;
156+
};
157+
std::vector<std::queue<SyncInfo_>> sync_message_queue_vector_;
158+
ros::Subscriber timeStamp_sub;
159+
#endif
160+
161+
142162
bool region_of_interest_set_;
143163
int region_of_interest_width_;
144164
int region_of_interest_height_;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#cmakedefine trigger_msgs_FOUND

params/stereo_camera_example.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cam_ids:
2+
<<<<<<< HEAD
23
- 17197554
34
- 17197556
45
cam_aliases:
@@ -21,8 +22,9 @@ delay: 1.0
2122

2223
#Camera info message details
2324
distortion_model: plumb_bob
24-
image_height: 1024 #1536
25-
image_width: 1280 #2048
25+
image_height: 1024
26+
image_width: 1280
27+
2628
distortion_coeffs:
2729
- [-0.021141875266089592, -0.3733872931278025, 2.385982550579459, 3.2824571732099725]
2830
- [-0.021141875266089592, -0.3733872931278025, 2.385982550579459, 3.2824571732099725]
@@ -40,11 +42,14 @@ rectification_coeffs:
4042
projection_coeffs:
4143
- [913.700317, 0.000000, 953.448302, 0.000000, 0.000000, 1063.296631, 777.871993, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
4244
- [913.700317, 0.000000, 953.448302, 0.000000, 0.000000, 1063.296631, 777.871993, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
45+
<<<<<<< HEAD
4346

4447
flip_horizontal:
4548
- false
4649
- false
4750

4851
flip_vertical:
4952
- false
50-
- false
53+
- false
54+
=======
55+
>>>>>>> master

params/test_params.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cam_ids:
2-
- 17197556
2+
- 17197559
33
cam_aliases:
44
- cam0
5-
master_cam: 17197556
5+
master_cam: 17197559
66
skip: 20
77
delay: 1.0
88

0 commit comments

Comments
 (0)