73 static constexpr unsigned int hiresWidth_{2560};
74 static constexpr unsigned int hiresHeight_{1024};
75 static constexpr unsigned int lowresWidth_{1280};
76 static constexpr unsigned int lowresHeight_{512};
77 static constexpr unsigned int hiresImageBufferSize_{hiresWidth_ * hiresHeight_ * 3};
78 static constexpr unsigned int lowresImageBufferSize_{lowresWidth_ * lowresHeight_ * 3};
79 static constexpr unsigned int deadTime_{10};
80 static constexpr unsigned int minPermittedExposition_{15};
81 static constexpr unsigned int maxPermittedExposition_{100};
83 static constexpr const char *ultraPythonName =
"ultrapython";
85 inline static constexpr const char *mediaName_ =
"/dev/media0";
88 static constexpr const char *pipelineVideoName =
"vcap_python output 0";
89 static constexpr const char *pipelinePythonName =
"PYTHON1300";
90 static constexpr const char *pipelineTpgName =
"v_tpg";
91 static constexpr const char *pipelineCscName =
"v_proc_ss";
92 static constexpr const char *pipelinePacket32Name =
"Packet32";
93 static constexpr const char *pipelineImgfusionName =
"imgfusion";
94 static constexpr const char *pipelineRxifName =
"PYTHON1300_RXIF";
97 static constexpr unsigned int requestBufferNumber_ = {4};
98 static constexpr unsigned int pipelineMaxLen = {16};
101 static constexpr unsigned int nativeWidth_{1280};
102 static constexpr unsigned int nativeHeight_{1024};
107 bool step(
unsigned char *yarpbuffer);
112 bool setControl(uint32_t v4lCtrl,
double value,
118 double getControl(uint32_t v4lCtrl,
bool absolute);
142 void mapBufferFill(
unsigned char *tofillWith,
unsigned int index);
146 bool ownerCApi_{
false};
149 bool startCapturing();
150 bool setDefaultControl();
151 bool setControl(uint32_t v4lCtrl,
int fd,
double value,
bool absolute);
152 double getControl(uint32_t v4lCtrl,
int fd,
bool absolute);
153 bool setSubDevFormat(
int width,
int height);
155 bool setSubsampling();
156 bool crop(
int top,
int left,
int w,
int h,
int mytry);
157 bool checkDevice(
int mainSubdeviceFd);
158 int readFrame(
unsigned char *yarpbuffer);
159 void processImage(
const void *p,
int size);
161 bool stopCapturing();
162 bool closePipeline();
167 bool setGain(
double value,
bool absolute);
168 bool internalHasControl(uint32_t v4lCtrl)
const;
171 bool subsamplingEnabledProperty_{
true};
172 bool cropEnabledProperty_{
false};
173 bool forceFormatProperty_{
true};
174 double currentExposure_{0};
177 MmapBuffer mMapBuffers_[requestBufferNumber_];
180 int mainSubdeviceFd_ = -1;
181 std::array<int, pipelineMaxLen> pipelineSubdeviceFd_ = {
182 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
184 int sourceSubDeviceIndex1_ = -1;
185 int sourceSubDeviceIndex2_ = -1;
186 int rxif1Index_ = -1;
187 int rxif2Index_ = -1;
190 int imgfusionIndex_ = -1;
191 int packet32Index_ = -1;
193 double stepPeriod_{40};
194 bool honorfps_{
false};
199 double currentGainValue_{1};
200 const std::map<unsigned int, std::pair<unsigned int, unsigned int>> gainMap_{{1, {1, 1}}, {2, {1, 2}}, {3, {1, 3}}, {4, {1, 4}}, {5, {1, 5}}, {6, {2, 2}},
201 {7, {2, 3}}, {8, {2, 4}}, {9, {2, 5}}, {10, {2, 6}}, {11, {2, 7}}};
210 Statistics statistics_{
"frames read by YARP", 0};
213 std::function<void(
const void *,
int)> injectedProcessImage_;
214 std::function<void()> lock_;
215 std::function<void()> unlock_;
216 std::function<void(
const std::string &,
Severity)> log_;
247 std::stringstream ss_;
255 parent_.log_(ss_.str(), severity_);
259 using streamtype = std::ostream &(std::ostream &);
262 template <
typename T>