-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera_lucidTypes.hpp
336 lines (306 loc) · 14.2 KB
/
camera_lucidTypes.hpp
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#ifndef camera_lucid_TYPES_HPP
#define camera_lucid_TYPES_HPP
#include "Arena/ArenaApi.h"
#include <base/Float.hpp>
#include <base/Temperature.hpp>
#include <base/Time.hpp>
#include <base/samples/Frame.hpp>
#include <string>
#include <vector>
/* If you need to define types specific to your oroGen components, define them
* here. Required headers must be included explicitly
*
* However, it is common that you will only import types from your library, in
* which case you do not need this file
*/
namespace camera_lucid {
enum BinningSelector {
BINNING_SELECTOR_DIGITAL = 0,
BINNING_SELECTOR_SENSOR = 1
};
static std::vector<std::string> binning_selector_name = {"Digital", "Sensor"};
enum BinningMode {
BINNING_MODE_SUM = 0,
BINNING_MODE_AVERAGE = 1
};
static std::vector<std::string> binning_mode_name = {"Sum", "Average"};
enum DecimationSelector {
DECIMATION_SELECTOR_SENSOR = 0
};
static std::vector<std::string> decimation_selector_name = {"Sensor"};
enum DecimationMode {
DECIMATION_MODE_DISCARD = 0,
};
static std::vector<std::string> decimation_mode_name = {"Discard"};
enum ExposureAuto {
EXPOSURE_AUTO_OFF = 0,
EXPOSURE_AUTO_ONCE = 1,
EXPOSURE_AUTO_CONTINUOUS = 2
};
static std::vector<std::string> exposure_auto_name = {"Off", "Once", "Continuous"};
enum ExposureAutoAlgorithm {
EXPOSURE_AUTO_ALGORITHM_MEDIAN = 0,
EXPOSURE_AUTO_ALGORITHM_MEAN = 1
};
static std::vector<std::string> exposure_auto_algorithm_name = {"Median", "Mean"};
enum ExposureAutoLimitAuto {
EXPOSURE_AUTO_LIMIT_AUTO_OFF = 0,
EXPOSURE_AUTO_LIMIT_AUTO_CONTINUOUS = 1
};
static std::vector<std::string> exposure_auto_limit_auto_name = {"Off", "Continuous"};
enum DeviceTemperatureSelector {
DEVICE_TEMPERATURE_SELECTOR_SENSOR = 0,
DEVICE_TEMPERATURE_SELECTOR_TEC = 1
};
static std::vector<std::string> device_temperature_selector_name = {"Sensor", "TEC"};
enum GainSelector {
GAIN_SELECTOR_ALL = 0,
GAIN_SELECTOR_SHUTTER_1 = 1,
GAIN_SELECTOR_SHUTTER_2 = 2
};
static std::vector<std::string> gain_selector_name = {"All", "Shutter1", "Shutter2"};
enum GainAuto {
GAIN_AUTO_OFF = 0,
GAIN_AUTO_ONCE = 1,
GAIN_AUTO_CONTINUOUS = 2
};
static std::vector<std::string> gain_auto_name = {"Off", "Once", "Continuous"};
enum BalanceRatioSelector {
BALANCE_RATIO_SELECTOR_RED = 0,
BALANCE_RATIO_SELECTOR_GREEN = 1,
BALANCE_RATIO_SELECTOR_BLUE = 2
};
static std::vector<std::string> balance_ratio_selector_name = {"Red",
"Green",
"Blue"};
// Despite the fact we should be able to set it to Once, the driver doesn't accept it.
enum BalanceWhiteAuto {
BALANCE_WHITE_AUTO_OFF = 0,
BALANCE_WHITE_AUTO_ONCE = 1,
BALANCE_WHITE_AUTO_CONTINUOUS = 2
};
static std::vector<std::string> balance_white_auto_name = {"Off",
"Once",
"Continuous"};
enum BalanceWhiteAutoAnchorSelector {
BALANCE_WHITE_AUTO_ANCHOR_SELECTOR_MINRGB = 0,
BALANCE_WHITE_AUTO_ANCHOR_SELECTOR_MAXRGB = 1,
BALANCE_WHITE_AUTO_ANCHOR_SELECTOR_MEANRGB = 2,
BALANCE_WHITE_AUTO_ANCHOR_SELECTOR_GREEN = 3
};
static std::vector<std::string> balance_white_auto_anchor_selector_name = {"MinRGB",
"MaxRGB",
"MeanRGB",
"Green"};
enum AcquisitionStartMode {
ACQUISITION_START_MODE_NORMAL = 0,
ACQUISITION_START_MODE_LOWLATENCY = 1,
ACQUISITION_START_MODE_PTPSYNC = 2
};
static std::vector<std::string> acquisition_start_mode_name{"Normal",
"LowLatency",
"PTPSync"};
struct BinningConfig {
/** Selects which binning engine is controlled by the BinningHorizontal and
* BinningVertical features. */
BinningSelector selector = BINNING_SELECTOR_DIGITAL;
/** Selects how to combine the horizontal pixels together.*/
BinningMode horizontal_mode = BINNING_MODE_SUM;
/** Selects how to combine the vertical pixels together.*/
BinningMode vertical_mode = BINNING_MODE_SUM;
/**Number of horizontal pixels to combine together. This reduces the horizontal
* resolution (width) of the image. A value of 1 indicates that no horizontal
* binning is performed by the camera.*/
int binning_x = 1;
/** Number of vertical pixels to combine together. This reduces the vertical
* resolution (height) of the image. A value of 1 indicates that no vertical
* binning is performed by the camera. */
int binning_y = 1;
};
struct DecimationConfig {
/** Selects which decimation engine is controlled by the DecimationHorizontal and
* DecimationVertical features. */
DecimationSelector selector = DECIMATION_SELECTOR_SENSOR;
/** Selects how to decimate the horizontal pixels.*/
DecimationMode horizontal_mode = DECIMATION_MODE_DISCARD;
/** Selects how to decimate the vertical pixels.*/
DecimationMode vertical_mode = DECIMATION_MODE_DISCARD;
/** Number of horizontal pixels to decimate. This reduces the horizontal
* resolution (width) of the image. A value of 1 indicates that no horizontal
* decimation is performed by the camera.*/
int decimation_x = 1;
/** Number of vertical pixels to decimate. This reduces the vertical resolution
* (height) of the image. A value of 1 indicates that no vertical decimation is
* performed by the camera.*/
int decimation_y = 1;
};
struct AnalogControllerConfig {
/** Value used for gain*/
float gain = 0.0;
/** Minimal Gain Value*/
float gain_min = 0.0;
/** Maximum Gain Value*/
float gain_max = 48.0;
/** Sets the automatic Gain mode*/
GainAuto gain_auto = GainAuto::GAIN_AUTO_OFF;
/** Selects all shutters or shutter1 or shutter2*/
GainSelector gain_selector = GainSelector::GAIN_SELECTOR_ALL;
/** Gamma correction mode - For uncontrolled outdoor environments,
* The recommended configuration is enabled (true). */
bool gamma_enabled = true;
/** Gamma correction configuration - For uncontrolled outdoor environments,
* The recommended gamma value is 0.5. */
float gamma = 0.5;
/** Configure White Balance
* This skips the configuration on the balance white,
* avoiding errors on the LUCID050S older firmware version */
bool configure_white_balance = false;
/** Balance White Enable - Enables the White Balance */
bool balance_white_enable = true;
/** Balance Ratio Selector - Selects which balance ratio is controlled by
* various balance ratio features.*/
BalanceRatioSelector balance_ratio_selector =
BalanceRatioSelector::BALANCE_RATIO_SELECTOR_RED;
/** Balance Ratio - Controls the selected balance ratio as an absolute physical
* value. This is an amplification factor applied to the video signal.
* Values calibrated on the office for blue, green and red respectively:
* 2.1189, 0.998047, 1.61523 */
float blue_balance_ratio = base::unknown<float>();
float green_balance_ratio = base::unknown<float>();
float red_balance_ratio = base::unknown<float>();
/** Balance White Auto - Controls the mode for automatic white balancing
* between color channels.*/
BalanceWhiteAuto balance_white_auto =
BalanceWhiteAuto::BALANCE_WHITE_AUTO_CONTINUOUS;
/** Balance White Auto Anchor Selector - Controls which type of statistics
* are used for BalanceWhiteAuto.*/
BalanceWhiteAutoAnchorSelector balance_white_auto_anchor_selector =
BalanceWhiteAutoAnchorSelector::BALANCE_WHITE_AUTO_ANCHOR_SELECTOR_MAXRGB;
};
struct PTPConfig {
/** Whether PTP support is enabled or not */
bool enabled = false;
/** Whether this camera should only configure itself as a slave, or
* could be master */
bool slave_only = false;
/** PTP Synchronization timeout
*
* If set, the component will wait for the camera's PTP clock to either become
* master, or get synchronized for this long. It will raise after this timeout
*/
base::Time synchronization_timeout;
};
struct TransmissionConfig {
/** Whether the Arena software requires a packet resend*/
bool stream_packet_resend = true;
/** Whether the camera controls data transfer (false), or the component (true) */
bool explicit_data_transfer = false;
/** Delay between two packets sent by the camera in nanoseconds
*
* There is no sound default, but there has to always be a delay. Set to zero to
* keep the camera's current value
*/
uint64_t packet_delay = 0;
/** Delay between acquisition and transmission of frames
*
* The default is zero. Use non-zero values to interleave transmission of
* different cameras, when the cameras have synchronized acquisition (e.g.
* using PTPSync)
*/
uint64_t frame_transmission_delay = 0;
/** Configures the MTU. Lucid Arena SDK negotiates automatically the packet size.
* If true, the mtu negotiation will be done automatically and it will be checked
* if the negotiated mtu is greater or equal than the desired mtu.
* If false, the mtu will be set as desired mtu.*/
bool auto_negotiate_mtu = false;
/** Desired mtu
* If the camera's mtu value is bellow this value, after the timeout an exception
* is thrown.*/
int mtu = 1500;
/** Sleep while checking mtu value. The configurable task will be in a loop until
* the desired mtu is configured or if timeouts.*/
base::Time mtu_check_sleep = base::Time::fromMilliseconds(500);
/** Timeout for negotiating mtu.*/
base::Time mtu_check_timeout = base::Time::fromSeconds(10);
};
struct ImageConfig {
/** Control when/how acquisition starts on the camera*/
AcquisitionStartMode acquisition_start_mode = ACQUISITION_START_MODE_NORMAL;
/** Specifies the frequency in which frames are acquired */
double frame_rate = 24.0;
/** Timeout for frame acquisition.*/
base::Time frame_timeout = base::Time::fromMilliseconds(500);
/** Maximum number of timeouts every period based on check_image_status, after
* this value it will return an exeption*/
int max_acquisition_timeout = 10;
/** Maximum number of incomplete images every period based on check_image_status,
* after this value it will return an exeption*/
int max_incomplete_images = 10;
/** Period to check the amount of acquisition timeouts and incomplete images.*/
base::Time check_image_status = base::Time::fromSeconds(1);
/** Image format*/
base::samples::frame::frame_mode_t format =
base::samples::frame::frame_mode_t::MODE_BAYER_RGGB;
/** Depth*/
uint8_t depth = 8;
/** Short Exposure State
* This state needs a exposure_time between 2.464 and 1 microseconds
* and is not compatible with Exposure_Auto_Limit_Auto_OFF when in
* EXPOSURE_AUTO_CONTINUOUS. */
bool short_exposure_enable = false;
/** Sets the automatic exposure mode.*/
ExposureAuto exposure_auto = EXPOSURE_AUTO_CONTINUOUS;
/** Configure automatic exposure algorithm configuration
* This skips the configuration on the automatic exposure algorithm
* avoiding errors on the LUCID050S older firmware version */
bool configure_automatic_exposure_algorithm = false;
/** Sets the automatic exposure algorithm*/
ExposureAutoAlgorithm exposure_auto_algorithm = EXPOSURE_AUTO_ALGORITHM_MEAN;
/** Sets the automatic exposure damping represented as %.
* Maximum, Minimum: 99.6094, 0.390625 */
double exposure_auto_damping = base::unknown<double>();
/** Sets the exposure auto limit auto exposure mode*/
ExposureAutoLimitAuto exposure_auto_limit_auto = EXPOSURE_AUTO_LIMIT_AUTO_OFF;
/** Controls the device exposure time.*/
base::Time exposure_time = base::Time::fromMilliseconds(1);
/** Minimum exposure time.*/
base::Time min_exposure_time = base::Time::fromMicroseconds(47);
/** Maximum exposure time.*/
base::Time max_exposure_time = base::Time::fromSeconds(10);
/** Width of the image provided by the device in pixels.*/
int width = 2448;
/** Height of the image provided by the device in pixels.*/
int height = 2048;
/** Horizontal offset from the origin to the region of interest in pixels.*/
int offset_x = 0;
/** Vertical offset from the origin to the region of interest in pixels.*/
int offset_y = 0;
/** Default pixel value the camera will try to reach automatically.
* For uncontrolled outdoor environments, the recommended value is 70. */
uint8_t target_brightness = 70;
};
struct CameraConfig {
/** Camera's ip*/
std::string ip;
/** Perform factory reset? */
bool factory_reset = false;
/** Timeout after factory reset*/
base::Time camera_reset_timeout = base::Time::fromSeconds(50);
/** Period of info update (such as temperature, pressure...)*/
base::Time update_info = base::Time::fromSeconds(1);
/** Choose the temperature sensor*/
DeviceTemperatureSelector temperature_selector =
DeviceTemperatureSelector::DEVICE_TEMPERATURE_SELECTOR_SENSOR;
};
struct CameraInfo {
/** Camera's temperature from Sensor mode*/
base::Temperature temperature;
/** Number of frame acquisition timeouts since start*/
uint64_t acquisition_timeouts = 0;
/** Number of incomplete images since start*/
uint64_t incomplete_images = 0;
/** Mean exposure time*/
uint64_t average_exposure;
};
}
#endif