Repository navigation
Expand file tree
/
Copy pathArraySynchronizer.h
More file actions
74 lines (53 loc) · 1.68 KB
/
Copy pathArraySynchronizer.h
File metadata and controls
74 lines (53 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include "image_transport/image_transport.h"
#include "cv_bridge/cv_bridge.h"
#include "argus_utils/synchronization/Semaphore.h"
#include "argus_utils/synchronization/WorkerPool.h"
#include "lookup/LookupInterface.h"
#include "manycal/CaptureArray.h"
#include <boost/thread/thread.hpp>
#include <unordered_map>
namespace argus
{
/*! \brief Cycles and gathers outputs from the array into synchronized outputs.
* Outputs show up as image_synchronized. */
class ArraySynchronizer
{
public:
ArraySynchronizer( ros::NodeHandle& nh, ros::NodeHandle& ph );
void Cycle();
private:
struct BufferedData
{
sensor_msgs::Image::Ptr image;
sensor_msgs::CameraInfo::Ptr info;
};
struct CameraRegistration
{
std::string name;
ros::ServiceClient captureClient;
BufferedData data;
};
image_transport::CameraPublisher imagePub;
image_transport::CameraSubscriber imageSub;
ros::NodeHandle nodeHandle;
ros::NodeHandle privHandle;
ros::ServiceServer captureServer;
LookupInterface lookupInterface;
typedef std::unordered_map< std::string, CameraRegistration > CameraRegistry;
CameraRegistry cameraRegistry;
image_transport::ImageTransport publicPort;
image_transport::ImageTransport privatePort;
Semaphore cameraTokens;
//Semaphore completedJobs;
unsigned int receivedImages;
ros::Time clampTime;
WorkerPool pool;
int numSimultaneous;
void ImageCallback( const sensor_msgs::Image::ConstPtr& image,
const sensor_msgs::CameraInfo::ConstPtr& info );
void CaptureJob( CameraRegistration& registration );
bool CaptureArrayCallback( manycal::CaptureArray::Request& req,
manycal::CaptureArray::Response& res );
};
}