Skip to content

Commit c23e781

Browse files
Shreekantjpsnir
authored andcommitted
merged the changes for external trigger in dev branch
1 parent 0fcd141 commit c23e781

File tree

7 files changed

+182
-32
lines changed

7 files changed

+182
-32
lines changed

.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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ find_package(catkin REQUIRED COMPONENTS
2020
sensor_msgs
2121
dynamic_reconfigure
2222
nodelet
23+
trigger_msgs
2324
)
2425

2526
#find_package(PCL REQUIRED)
@@ -49,6 +50,13 @@ elseif(NOT Boost_FOUND)
4950
message("Boost not found!")
5051
endif()
5152

53+
# configure a header file to pass some of the CMake settings
54+
# to the source code
55+
configure_file (
56+
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h.in"
57+
"${PROJECT_SOURCE_DIR}/include/spinnaker_sdk_camera_driver/spinnaker_configure.h"
58+
)
59+
5260
add_message_files(
5361
FILES
5462
SpinnakerImageNames.msg

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ All the parameters can be set via the launch file or via the yaml config_file.
8888
Should color images be used (only works on models that support color images)
8989
* ~exposure_time (int, default: 0, 0:auto)
9090
Exposure setting for cameras, also available as dynamic reconfiguarble parameter.
91-
* ~external_trigger (bool, default: false)
91+
* ~external_trigger (bool, default: false)
9292
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.
9393
* ~target_grey_value (double, default: 0 , 0:Continous/auto)
9494
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

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

0 commit comments

Comments
 (0)