JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
Engine.H
Go to the documentation of this file.
1// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2//
3// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5//
6// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10// License for more details. You should have received a copy of the GNU General Public License along with this program;
11// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12//
13// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16/*! \file */
17
18#pragma once
19
22#include <jevois/Types/Enum.H>
26
27#include <memory>
28#include <mutex>
29#include <vector>
30#include <list>
31#include <atomic>
32
33// #################### Platform mode config:
34#ifdef JEVOIS_PLATFORM
35
36#if defined(JEVOIS_A33)
37// ########## JeVois-A33 platform:
38
39// On the JeVois-A33 platform, we use a gadget driver by default to send output frames over USB, one hardware serial
40// driver, and one serial-over-USB driver:
41
42//! On platform hardware, device for the camera sensor
43#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
44
45//! On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host computer)
46#define JEVOIS_GADGET_DEFAULT "/dev/video1"
47
48//! On platform hardware, device for the 4-pin hardware serial port
49#define JEVOIS_SERIAL_DEFAULT "/dev/ttyS0"
50
51//! On platform hardware, device for serial-over-USB port
52#define JEVOIS_USBSERIAL_DEFAULT "/dev/ttyGS0"
53
54//! Default camera sensor
55#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::ov9650
56
57//! Default IMU spi device
58#define JEVOIS_IMUSPI_DEFAULT ""
59
60#elif defined(JEVOIS_PRO)
61// ########## JeVois-Pro platform:
62
63// On the JeVois-Pro platform, we have no gadget for now (which will trigger displaying output frames to a window), one
64// hardware serial driver, and not yet one serial-over-USB driver:
65
66//! On platform hardware, device for the camera sensor
67#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
68
69//! On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host computer)
70#define JEVOIS_GADGET_DEFAULT ""
71
72//! On platform hardware, device for the 4-pin hardware serial port
73#define JEVOIS_SERIAL_DEFAULT "/dev/ttyS4"
74
75//! On platform hardware, device for serial-over-USB port
76#define JEVOIS_USBSERIAL_DEFAULT ""
77//#define JEVOIS_USBSERIAL_DEFAULT "/dev/ttyGS0"
78
79//! Default camera sensor
80#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::any
81
82//! Default IMU spi device
83#define JEVOIS_IMUSPI_DEFAULT "/dev/spidev32766.0"
84
85#else
86#error "Neither JEVOIS_A33 nor JEVOIS_PRO defined -- ABORT"
87#endif
88
89#else // JEVOIS_PLATFORM
90// #################### Host mode config:
91
92// On the host, we have no gadget (which will trigger displaying output frames to a window) and we use the terminal in
93// which jevois-daemon was started for serial commands:
94
95//! On generic computer hardware, device for the camera sensor
96#define JEVOIS_CAMERA_DEFAULT "/dev/video0"
97
98//! On generic computer hardware, device for the USB gadget driver should always be empty
99#define JEVOIS_GADGET_DEFAULT ""
100
101//! On generic computer hardware, device for serial port should always be stdio to use an StdioInterface
102#define JEVOIS_SERIAL_DEFAULT "stdio"
103
104//! On generic computer hardware, device for the serial-over-USB port should always be empty
105#define JEVOIS_USBSERIAL_DEFAULT ""
106
107//! Default IMU spi device
108#define JEVOIS_IMUSPI_DEFAULT ""
109
110#ifdef JEVOIS_PRO
111//! Default camera sensor
112#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::imx290
113#else
114//! Default camera sensor
115#define JEVOIS_CAMERASENS_DEFAULT CameraSensor::ov9650
116#endif
117
118#endif // JEVOIS_PLATFORM
119
120namespace cv { namespace parallel { class ParallelForAPI; } }
121
122namespace jevois
123{
124 class VideoInput;
125 class VideoOutput;
126 class Module;
127 class DynamicLoader;
128 class UserInterface;
129 class GUIhelper;
130 class GUIconsole;
131 class Camera;
132 class IMU;
133
134 //! Parameters of the Engine class
135 namespace engine
136 {
137 static ParameterCategory const ParamCateg("Engine Options");
138
139 //! Parameter \relates jevois::Engine
140 JEVOIS_DECLARE_PARAMETER(cameradev, std::string, "Camera device name (if starting with /dev/v...), or movie "
141 "file name (e.g., movie.mpg) or image sequence (e.g., im%02d.jpg, to read frames "
142 "im00.jpg, im01.jpg, etc).",
143 JEVOIS_CAMERA_DEFAULT, ParamCateg);
144
145 //! Parameter \relates jevois::Engine
146 JEVOIS_DECLARE_PARAMETER(camerasens, CameraSensor, "Camera sensor. Users would usually not set this parameter "
147 "manually, it is set through boot-time configuration.",
148 JEVOIS_CAMERASENS_DEFAULT, CameraSensor_Values, ParamCateg);
149
150 //! Parameter \relates jevois::Engine
151 JEVOIS_DECLARE_PARAMETER(cameralens, CameraLens, "Camera lens. Users should usually set this parameter "
152 "using the global JeVois params.cfg config file.",
153 CameraLens::standard, CameraLens_Values, ParamCateg);
154
155 JEVOIS_DECLARE_PARAMETER(imudev, std::string, "IMU SPI device name, typically starting with /dev/spidev..., "
156 "or empty if device does not have an IMU with SPI interface.",
157 JEVOIS_IMUSPI_DEFAULT, ParamCateg);
158
159 //! Parameter \relates jevois::Engine
160 JEVOIS_DECLARE_PARAMETER(cameranbuf, unsigned int, "Number of video input (camera) buffers, or 0 for automatic.",
161 0, ParamCateg);
162
163 //! Parameter \relates jevois::Engine
164 JEVOIS_DECLARE_PARAMETER(gadgetdev, std::string, "Gadget device name. This is used on platform hardware only. "
165 "On host hardware, a display window will be used unless gadgetdev is None (useful "
166 "for benchmarking) or is a file stem for a movie file that does not start with /dev/ "
167 "(and which should contain a printf-style directive for a single int argument, "
168 "the movie number).",
169 JEVOIS_GADGET_DEFAULT, ParamCateg);
170
171 //! Parameter \relates jevois::Engine
172 JEVOIS_DECLARE_PARAMETER(gadgetnbuf, unsigned int, "Number of video output (USB video) buffers, or 0 for auto",
173 0, ParamCateg);
174
175 //! Parameter \relates jevois::Engine
176 JEVOIS_DECLARE_PARAMETER(videomapping, int, "Index of Video Mapping to use, or -1 to use the default mapping. "
177 "Note that this parameter is only available when parsing command-line arguments. "
178 "At runtime, the setmapping command should be used instead.",
179 -1, ParamCateg);
180
181#ifdef JEVOIS_PRO
182 //! Parameter \relates jevois::Engine
183 JEVOIS_DECLARE_PARAMETER(serialmonitors, bool, "If true, serial port monitors will be enabled "
184 "in the GUI, which can be used to peek at serial communications not "
185 "directed to the console. Can be turned off at start time (e.g., in the "
186 "global JeVois params.cfg) as there is some small CPU cost to it.",
187 true, ParamCateg);
188#endif
189
190 //! Parameter \relates jevois::Engine
191 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(serialdev, std::string, "Hardware (4-pin connector) serial device name, "
192 "or 'stdio' to use the console, or empty for no hardware serial port",
193 JEVOIS_SERIAL_DEFAULT, ParamCateg);
194
195 //! Parameter \relates jevois::Engine
196 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(usbserialdev, std::string, "Over-the-USB serial device name, or empty",
197 JEVOIS_USBSERIAL_DEFAULT, ParamCateg);
198
199 //! Parameter \relates jevois::Engine
200 JEVOIS_DECLARE_PARAMETER(camreg, bool, "Enable raw access to camera registers through setcamreg and getcamreg",
201 false, ParamCateg);
202
203 //! Parameter \relates jevois::Engine
204 JEVOIS_DECLARE_PARAMETER(imureg, bool, "Enable raw access to IMU registers through setimureg and getimureg",
205 false, ParamCateg);
206
207 //! Parameter \relates jevois::Engine
208 JEVOIS_DECLARE_PARAMETER(camturbo, bool, "Enable camera turbo mode by relaxing the need for DMA-coherent video "
209 "buffer memory. This can accelerate severalfolds access to the captured image data, but "
210 "it may also yield stripe artifacts with some modules, such as PassThrough. The stripes "
211 "are pieces of incorrect data in the cache. You should experiment with each particular "
212 "module. Turbo mode is not recommended for any production-grade application.",
213 false, ParamCateg);
214
215 //! Enum for Parameter \relates jevois::Engine
216 JEVOIS_DEFINE_ENUM_CLASS(SerPort, (None) (All) (Hard) (USB) );
217
218 //! Parameter \relates jevois::Engine
219 JEVOIS_DECLARE_PARAMETER(serlog, SerPort, "Show log and debug messages on selected serial port(s)",
220 SerPort::None, SerPort_Values, ParamCateg);
221
222 //! Parameter \relates jevois::Engine
223 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(videoerrors, bool, "Show any machine vision module errors (exceptions) "
224 "in the video stream. Only takes effect if streaming video to USB.",
225 true, ParamCateg);
226
227 //! Parameter \relates jevois::Engine
228 JEVOIS_DECLARE_PARAMETER(serout, SerPort, "Send module serial messages to selected serial port(s)",
229 SerPort::None, SerPort_Values, ParamCateg);
230
231 //! Enum for Parameter \relates jevois::Engine
232 JEVOIS_DEFINE_ENUM_CLASS(CPUmode, (PowerSave) (Conservative) (OnDemand) (Interactive) (Performance) );
233
234 //! Parameter \relates jevois::Engine
235 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumode, CPUmode, "CPU frequency modulation mode"
236#ifdef JEVOIS_PRO
237 " for A73 big cores"
238#endif
239 , CPUmode::Performance, CPUmode_Values, ParamCateg);
240
241#ifdef JEVOIS_PRO
242 //! Parameter \relates jevois::Engine
243 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumodel, CPUmode, "CPU frequency modulation mode for A53 little cores",
244 CPUmode::Performance, CPUmode_Values, ParamCateg);
245#endif
246
247 //! Parameter \relates jevois::Engine
248 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumax, unsigned int, "CPU maximum frequency in MHz"
249#ifdef JEVOIS_PRO
250 ". To enable overclock frequencies above 2208 MHz, you need to first edit "
251 "/boot/env.txt and change max_freq_a73, then reboot. Use with caution!"
252#endif
253#ifdef JEVOIS_A33
254 // keep this in sync with sunxi-cpufreq.c
255 , 1344, { 120, 240, 312, 408, 480, 504, 600, 648, 720, 816, 912, 1008,
256 1044, 1056, 1080, 1104, 1116, 1152, 1200, 1224, 1248, 1296, 1344 },
257#else
258 // keep this in sync with device tree
259 // A73 cores
260 , 2208, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
261 2100, 2208, 2304, 2400 },
262 // A53 cores
263 //1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
264 // 2100, 2208 },
265#endif
266 ParamCateg);
267#ifdef JEVOIS_PRO
268 //! Parameter \relates jevois::Engine
269 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumaxl, unsigned int, "CPU maximum frequency in MHz, for A53 little cores. "
270 "To enable overclock frequencies above 1800 MHz, you need to first edit "
271 "/boot/env.txt and change max_freq_a53, then reboot. Use with caution!",
272 // keep this in sync with device tree
273 1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016,
274 2100, 2208 },
275 ParamCateg);
276#endif
277
278 //! Parameter \relates jevois::Engine
279 JEVOIS_DECLARE_PARAMETER(multicam, bool, "Allow up to 3 JeVois cameras on one USB bus. Enabling this "
280 "reduces the amount of USB bandwidth used by each JeVois camera, from 3kb "
281 "per USB isochronous microframe to 1kb. All 3 JeVois cameras must have this "
282 "option enabled, and the JeVois linux kernel module should also have "
283 "been loaded with multicam on.",
284 false, ParamCateg);
285
286 //! Parameter \relates jevois::Engine
287 JEVOIS_DECLARE_PARAMETER(quietcmd, bool, "When true, do not issue a message 'OK' after every correct command "
288 "received at the command-line interface. Recommended for advanced users only.",
289 false, ParamCateg);
290
291 //! Parameter \relates jevois::Engine
292 JEVOIS_DECLARE_PARAMETER(python, bool, "When true, enable support for modules written in Python. Otherwise, "
293 "attempting to load a python module will throw an exception. Disabling python saves "
294 "a lot of memory and may be useful when using C++ modules that run large deep neural "
295 "networks.",
296 true, ParamCateg);
297
298 //! Parameter \relates jevois::Engine
299 JEVOIS_DECLARE_PARAMETER(serlimit, size_t, "Maximum number of serial messages that can be sent by a module "
300 "using sendSerial(), for each video frame, or 0 for no limit. Any message sent by "
301 "the module beyond the first serlimit ones will be dropped. This is useful to avoid "
302 "overloading the serial link, for example in case one is running a ArUco detector and "
303 "a large number of ArUco tags are present in the field of view of JeVois.",
304 0, ParamCateg);
305
306#ifdef JEVOIS_PRO
307 //! Parameter \relates jevois::Engine
308 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(gui, bool, "Use a graphical user interface instead of plain display "
309 "when true",
310 true, ParamCateg);
311 //! Parameter \relates jevois::Engine
312 JEVOIS_DECLARE_PARAMETER(conslock, bool, "Lock the console and capture the keyboard and mouse to avoid "
313 "interference, only effective on JeVois-Pro Platform, otherwise ignored. Set conslock "
314 "to false if you are experiencing hard crashes and want to run jevoispro-daemon in gdb.",
315 true, ParamCateg);
316
317 //! Parameter \relates jevois::Engine
318 JEVOIS_DECLARE_PARAMETER(watchdog, double, "Timeout in seconds after which we kill this process if the main loop "
319 "is stuck somehow, or 0.0 for no watchdog",
320 10.0, ParamCateg);
321
322 //! Parameter \relates jevois::Engine
323 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(demomode, float, "Show a demonstration of some available JeVois-Pro "
324 "machine vision modules, cycling to the next modules after a number "
325 "of seconds specified by this parameter (or 0.0 for no demo mode).",
326 0.0F, ParamCateg);
327#endif
328 }
329
330 //! JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB
331 /*! The Engine is orchestrating the execution of vision processing software. It is a Manager, i.e., it is the root of
332 a hierarchy of Component objects and it handles access to their Parameter settings and their construction, init(),
333 unInit(), and destruction. The component hierarchy consists of Engine at the root, then one Module which is
334 selected by the user at runtime, e.g., by selecting a given video format on video camera software running on a
335 host computer connected to the JeVois hardware. The Module may then contain an arbitrarily complex hierarchy of
336 Component objects with Parameter settings in them. Module derives from Component and thus may also have its own
337 Parameter settings.
338
339 Engine contains the following basic elements:
340
341 - A VideoInput, instantiated as either a Camera for live video streaming or a MovieInput for processing of
342 pre-recorded video files or sequences of images (useful during algorithm development, to test and optimize on
343 reproducible inputs);
344
345 - A VideoOutput, instantiated either as a USB Gadget driver when running on the JeVois hardware platform, or as a
346 VideoDisplay when running on a computer that has a graphics display, or as a MovieOutput to save output video
347 frames to disk, or as a VideoOutputNone if desired for benchmarking of vision algorithms while discounting any
348 work related to transmitting output frames.
349
350 - A DynamicLoader which handles loading the chosen vision processing Module at runtime depending on user
351 selections;
352
353 - Any number of UserInterface objects, instantiated as either a hardware Serial port (for the 4-pin JST 1.0mm
354 connector on the platform hardware), a serial-over-USB Serial port (visible on the host computer to which the
355 JeVois hardware is connected by USB), or an StdioInterface (used to accept commands and print results directly
356 in the terminal where the JeVois Engine was started, particularly useful when running on a generic computer as
357 opposed to the platform hardware). When running on platform hardware, usually two UserInterface objects are
358 created (one hardware Serial, one serial-over-USB Serial), while, when running on a generic computer, usually
359 only one UserInterface is created (of type StdioInterface to accept commands directly in the terminal in which
360 the jevois-daemon was started);
361
362 - The list of VideoMapping definitions imported from your videomappings.cfg file. These definitions specify which
363 video output modes are available over USB and their corresponding Camera settings and which Module to use, as
364 well as which modes are available that do not have any sreaming video output over USB (e.g., when connecting the
365 hardware platform to an Arduino only).
366
367 The main loop of Engine runs until the user decides to quit, and basically goes through the following steps:
368
369 - Create an InputFrame object which is an exception-safe wrapper around the next available Camera frame. The frame
370 may not have been captured yet. The InputFrame can be understood as a mechanism to gain access to that frame in
371 the future, when it has become available (i.e., has been captured by the camera). This is very similar to the
372 std::future framework of C++11.
373
374 - When the current VideoMapping specifies that we will be streaming video frames out over USB, also create an
375 OutputFrame object which is an exception-safe wrapper around the next available Gadget frame. This is also just
376 a mechanism for gaining access to the next blank video buffer that is available from the USB driver and that we
377 should fill with interesting pixel data before sending it over USB to a host computer.
378
379 - Call the currently-loaded Module's process() function, either as process(InputFrame, OutputFrame) when the
380 current VideoMapping specifies that some video output is to be sent over USB, or as process(InputFrame) when the
381 current VideoMapping specifies no video output. Any exception thrown by the Module's process() function will be
382 caught, reported, and ignored. The process() function would typically request the next available camera image
383 through the InputFrame wrapper (this request may block until the frame has been captured by the camera sensor
384 hardware), process that image, request the next available output image through the OutputFrame wrapper (when
385 VideoMapping specifies that there is USB video output), and paint some results into that output image, which
386 will then be sent to the host coputer over USB, for display by some webcam program or for further processing by
387 some custom vision software running on that computer. In addition, the currently loaded Module may issue
388 messages over the UserInterface ports (e.g., indicating the location at which an object was found, to let an
389 Arduino know about it).
390
391 - Read any new commands issued by users over the UserInterface ports and execute the appropriate commands.
392
393 - Handle user requests to change VideoMapping, when they select a different video mode in their webcam software
394 running on the host computer connected to the JeVois hardware. Such requests may trigger unloading of the
395 current Module and loading a new one, and changing camera pixel format, image size, etc. These changes are
396 guaranteed to occur when the Module's process() function is not running, i.e., Module programmers do not have to
397 worry about possible changes in image dimensions or pixel formats during execution of their process() function.
398
399 - Pass any user requests received over USB or UserInterface to adjust camera parameters to the actual Camera
400 hardware driver (e.g., when users change contrast in their webcam program, that request is sent to the Engine
401 over USB, and the Engine then forwards it to the Camera hardware driver).
402
403 \ingroup core */
404 class Engine : public Manager,
405 public Parameter<engine::cameradev, engine::camerasens, engine::cameralens, engine::cameranbuf,
406 engine::gadgetdev, engine::gadgetnbuf, engine::imudev, engine::videomapping,
407 engine::serialdev, engine::usbserialdev, engine::camreg, engine::imureg,
408 engine::camturbo, engine::serlog, engine::videoerrors, engine::serout,
409 engine::cpumode, engine::cpumax, engine::multicam, engine::quietcmd,
410 engine::python, engine::serlimit
411#ifdef JEVOIS_PRO
412 , engine::serialmonitors, engine::gui, engine::conslock, engine::cpumaxl,
413 engine::cpumodel, engine::watchdog, engine::demomode
414#endif
415 >
416 {
417 public:
418 //! Constructor
419 Engine(std::string const & instance);
420
421 //! Constructor with command-line parsing
422 Engine(int argc, char const* argv[], std::string const & instance);
423
424 //! Destructor
425 ~Engine();
426
427 //! Re-load video mappings from videomappings.cfg
428 /*! Mappings are automatically loaded on startup so this should only be used if the file has been modified and the
429 mappings need to be refreshed. Note that this will not refresh the available resolutions for USB output, which
430 requires a full reboot to re-initialize the kernel Gadget module. Also beware of possible state inconsistency
431 (e.g., if external code is holding a reference previously returned by findVideoMapping(). So, use with
432 caution. Basically, only GUIhelper should use this. */
433 void reloadVideoMappings();
434
435 //! Find the VideoMapping that has the given output specs, or throw if not found
436 VideoMapping const & findVideoMapping(unsigned int oformat, unsigned int owidth, unsigned int oheight,
437 float oframespersec) const;
438
439 //! Get the current video mapping
440 /*! Note that the current mapping may not have an entry in our list of mappings obtained from videomappings.cfg,
441 if the current one was set on the fly by the setmapping2 CLI command. */
442 VideoMapping const & getCurrentVideoMapping() const;
443
444 //! Return the number of video mappings
445 size_t numVideoMappings() const;
446
447 //! Allow access to our video mappings which are parsed from file at construction
448 VideoMapping const & getVideoMapping(size_t idx) const;
449
450 //! Get the video mapping index for a given UVC iformat, iframe and interval
451 size_t getVideoMappingIdx(unsigned int iformat, unsigned int iframe, unsigned int interval) const;
452
453 //! Allow access to the default video mapping
454 VideoMapping const & getDefaultVideoMapping() const;
455
456 //! Allow access to the default video mapping index
457 size_t getDefaultVideoMappingIdx() const;
458
459 //! Run a function on every video mapping
460 /*! The first mapping your function will be called on is for mapping with index 0, and so on until index
461 numVideoMappings()-1. If your function throws, we report the exception and then ignore it, then we move on to
462 the next mapping. */
463 void foreachVideoMapping(std::function<void(VideoMapping const & m)> && func);
464
465 //! Use this to request a format change from within process()
466 /*! This should only be used on JeVois-Pro in GUI mode. The engine is locked up hence and setFormat() cannot be
467 called from within a Module's process function, to avoid possible disasters of changing format while we
468 process. Modules or the GUI can use requestSetFormat() to request a format change in between two calls to
469 process(). Note special values: -1 to just reload the current format (e.g., after editing code), -2 does
470 nothing. */
471 void requestSetFormat(int idx);
472
473 //! Terminate the program
474 void quit();
475
476 //! Request a reboot
477 /*! On JeVois-A33 Platform, trigger a hard reset. On JeVois-Pro Platform or JeVois-Host, just terminate the
478 program. */
479 void reboot();
480
481 //! Callback for when the user selects a new output video format
482 /*! Here, we stop streaming, nuke any current processing module, set the camera format, set the gadget output
483 format, load the new processing module, and start streaming again. The given VideoMapping will typically be
484 obtained using findVideoMapping() from output specs received over the USB link. */
485 void setFormat(size_t idx);
486
487 //! Start streaming on video from camera, processing, and USB
488 void streamOn();
489
490 //! Stop streaming on video from camera, processing, and USB
491 void streamOff();
492
493 //! Main loop: grab, process, send over USB. Should be called by main application thread
494 int mainLoop();
495
496 //! Send a string to all serial ports
497 /*! \note When islog is true, this is assumes to be a log message, and it will be sent to the port(s) specified by
498 parameter serlog. Otherwise, the message will be sent to the ports specified by parameter serout. Note how the
499 number of messages that can be sent for each video frame may be limited by parameter \p serlimit; only up to
500 \p serlimit messages will be sent for a given video frame. This is useful to avoid overloading the serial
501 link, for example in cases one is running a ArUco detector and a large number of ArUco tags are present in the
502 field of view of JeVois. */
503 void sendSerial(std::string const & str, bool islog = false);
504
505 //! Get a pointer to our current module (may be null)
506 std::shared_ptr<Module> module() const;
507
508 //! Get a pointer to our IMU (may be null)
509 std::shared_ptr<IMU> imu() const;
510
511 //! Get a pointer to our Camera (may be null, especially if not using a camera but, eg, movie input)
512 std::shared_ptr<Camera> camera() const;
513
514#ifdef JEVOIS_PRO
515 //! Draw all camera controls into our GUI
516 void drawCameraGUI();
517#endif
518
519 //! Helper to load an OpenCV camera matrix and distortion coeffs for the current running module
520 /*! If do_throw is false, just report an error and provide identity defaults if calibration mot found. This would
521 typically be called in preInit() or postInit() of any module that will need the calibration parameters. Note:
522 for thread safety, engine should be locked; calling this inside Module::process() is safe. */
523 CameraCalibration loadCameraCalibration(std::string const & stem = "calibration", bool do_throw = false);
524
525 //! Helper to save an OpenCV camera matrix and distortion coeffs for the current running module
526 /*! Note: for thread safety, engine should be locked; calling this inside Module::process() is safe. */
527 void saveCameraCalibration(CameraCalibration const & calib, std::string const & stem = "calibration");
528
529 //! Register a component as linked to some python code, used by dynamic params created in python
530 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
531 void registerPythonComponent(Component * comp, void * pyinst);
532
533 //! Unregister a component as linked to some python code, used by dynamic params created in python
534 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
536
537 //! Get the component registered with a given python instance
538 /*! Use with extreme caution to guarantee thread safety and object lifetime since we just use raw pointers here */
539 Component * getPythonComponent(void * pyinst) const;
540
541 // Report an error to console and JeVois-Pro GUI
542 /*! Try to minimize the use of this function, and normally use LERROR() or LFATAL() instead. Currently the only
543 use is in jevois::dnn::Pipeline, to report parameters set in the zoo file but not used by the pipeline, as
544 issuing an LFATAL() for that may be too strict, but issuing an LERROR() may go un-noticed since the pipeline
545 is still running just fine. */
546 void reportError(std::string const & err);
547
548 //! Clear all errors currently displayed in the JeVois-Pro GUI
549 /*! In the JevoisPro GUI, errors reported via reportError() remain displayed for a few seconds, but sometimes we
550 want to clear them right away, e.g., after DNN pipeline threw, if the user selects another one, we want the
551 previous error to disappear immediately since it is not applicable anymore. When the JeVois-Pro GUI is not
552 used, this has no effect. */
553 void clearErrors();
554
555#ifdef JEVOIS_PRO
556 //! When in demo mode, switch to next demo
557 void nextDemo();
558
559 //! When in demo mode, abort demo mode
560 void abortDemo();
561
562 //! Set OpenCV parallel threading framework
563 /*! The default OpenCV threading uses all cores, which may sometimes give slow results if an image operation is
564 split across big and little cores, as we will end up waiting for the little cores to finish. However, using
565 all cores may be beneficial for deep nets. Hence, current polity is to use JeVois Big threadpool unless one
566 wants to use the default OpenCV threadpool by calling this function, which NetworkOpenCV does. Valid values
567 here are "jevois" (to only use big A73 cores and the JeVois ThreadPool), "tbb", "openmp", "pthreads" */
568 void setOpenCVthreading(char const * name = "jevois");
569#endif
570
571 protected:
572 //! Run a script from file
573 /*! The filename should be absolute. The file should have any of the commands supported by Engine, one per
574 line. Filename should be relative to the current module's path. */
575 void runScriptFromFile(std::string const & filename, std::shared_ptr<UserInterface> ser,
576 bool throw_no_file);
577
578 //! Parameter callback
579 void onParamChange(engine::serialdev const & param, std::string const & newval) override;
580
581 //! Parameter callback
582 void onParamChange(engine::usbserialdev const & param, std::string const & newval) override;
583
584 //! Parameter callback
585 void onParamChange(engine::cpumode const & param, engine::CPUmode const & newval) override;
586
587 //! Parameter callback
588 void onParamChange(engine::cpumax const & param, unsigned int const & newval) override;
589
590 //! Parameter callback
591 void onParamChange(engine::videoerrors const & param, bool const & newval) override;
592
593#ifdef JEVOIS_PRO
594 //! Parameter callback
595 void onParamChange(engine::gui const & param, bool const & newval) override;
596
597 //! Parameter callback
598 void onParamChange(engine::cpumaxl const & param, unsigned int const & newval) override;
599
600 //! Parameter callback
601 void onParamChange(engine::cpumodel const & param, engine::CPUmode const & newval) override;
602
603 //! Parameter callback
604 void onParamChange(engine::demomode const & param, float const & newval) override;
605#endif
606
607 size_t itsDefaultMappingIdx; //!< Index of default mapping
608 std::vector<VideoMapping> itsMappings; //!< All our mappings from videomappings.cfg
609 VideoMapping itsCurrentMapping; //!< Current mapping, may not match any in itsMappings if setmapping2 used
610
611 std::shared_ptr<VideoInput> itsCamera; //!< Our camera
612 std::shared_ptr<IMU> itsIMU; //! Our IMU
613 std::shared_ptr<VideoOutput> itsGadget; //!< Our gadget
614
615 std::unique_ptr<DynamicLoader> itsLoader; //!< Our module loader
616 std::shared_ptr<Module> itsModule; //!< Our current module
617
618 std::atomic<bool> itsRunning; //!< True when we are running
619 std::atomic<bool> itsStreaming; //!< True when we are streaming video
620 std::atomic<bool> itsStopMainLoop; //!< Flag used to stop the main loop
621
622 mutable std::timed_mutex itsMtx; //!< Mutex to protect our internals
623
624 void preInit() override; //!< Override of Manager::preInit()
625 void postInit() override; //!< Override of Manager::postInit()
626
627 //! Parse a user command received over serial port
628 /*! Throw upon receiving an incorrect command (eg, bad parameter value), return true if success, return false if
629 command was not recognized and should be tried by Module. pfx is an optional prefix which will be added to all
630 produced messages or errors. */
631 bool parseCommand(std::string const & str, std::shared_ptr<UserInterface> s, std::string const & pfx = "");
632
633 private:
634 std::list<std::shared_ptr<UserInterface> > itsSerials;
635
636 void setFormatInternal(size_t idx); // itsMtx should be locked by caller
637 void setFormatInternal(jevois::VideoMapping const & m, bool reload = false); // itsMtx should be locked by caller
638
639 // Loop over all available camera controls and run a function on each:
640 void foreachCamCtrl(std::function<void(struct v4l2_queryctrl & qc, std::set<int> & doneids)> && func);
641
642 // Return help string for a camera control or throw
643 std::string camCtrlHelp(struct v4l2_queryctrl & qc, std::set<int> & doneids);
644
645 // Return machine-oriented string for a camera control or throw
646 std::string camCtrlInfo(struct v4l2_queryctrl & qc, std::set<int> & doneids);
647
648 // Send info about built-in engine commands
649 void cmdInfo(std::shared_ptr<UserInterface> s, bool showAll, std::string const & pfx = "");
650
651 // Send info about module commands
652 void modCmdInfo(std::shared_ptr<UserInterface> s, std::string const & pfx = "");
653
654 // Get short name from V4L2 ID, long name is a backup in case we don't find the control in our list
655 std::string camctrlname(unsigned int id, char const * longname) const;
656
657 // Get V4L2 ID from short name
658 unsigned int camctrlid(std::string const & shortname);
659
660 // Report an error to console, video frame, or GUI
661 /*! Call this from within catch. Note, in GUI mode, this calls endFrame() so it should not be used except for
662 exceptions that will not be ignored. */
663 void reportErrorInternal(std::string const & err = "");
664
665 bool itsShellMode; // When true, pass any CLI command to the Linux shell
666 bool itsTurbo;
667 bool itsManualStreamon; // allow manual streamon when outputing video to None or file
668 std::atomic<bool> itsVideoErrors; // fast cached value for engine::videoerrors
669 jevois::RawImage itsVideoErrorImage;
670 std::string itsModuleConstructionError; // Non-empty error message if module constructor threw
671
672#ifdef JEVOIS_PLATFORM_A33
673 // Things related to mass storage gadget to export our /jevois partition as a virtual USB flash drive:
674 void checkMassStorage(); // thread to check mass storage gadget status
675 std::future<void> itsCheckMassStorageFut;
676 std::atomic<bool> itsCheckingMassStorage;
677 std::atomic<bool> itsMassStorageMode;
678 void startMassStorageMode();
679 void stopMassStorageMode();
680#endif
681
682 std::atomic<size_t> itsNumSerialSent; // Number of serial messages sent this frame; see serlimit
683 std::atomic<int> itsRequestedFormat; // Set by requestSetFormat(), could be -1 to reload, otherwise -2
684
685#ifdef JEVOIS_PRO
686 std::shared_ptr<GUIhelper> itsGUIhelper;
687
688 // Draw ImGui widgets for all camera controls
689 void camCtrlGUI(struct v4l2_queryctrl & qc, std::set<int> & doneids);
690
691 std::shared_ptr<jevois::Watchdog> itsWatchdog;
692
693 bool itsDemoReset = true; // Restart the demo
694 void runDemoStep(); // run one step of the demo mode
695 struct DemoData
696 {
697 int mapping_idx;
698 std::string title;
699 std::string msg;
700 std::vector<std::pair<std::string /* param name */, std::string /* param val */>> params;
701 };
702 std::vector<DemoData> itsDemoData;
703 bool itsNextDemoRequested = false;
704#endif
705
706 // Python code registry, used to assign dynamic parameters created in python code to the correct owning component.
707 // This looks thread-unsafe but should be ok as long as objects inherit first from Component and then from
708 // PythonWrapper.
709 std::map<void *, Component *> itsPythonRegistry;
710 mutable std::mutex itsPyRegMtx;
711
712#ifdef JEVOIS_PRO
713 // Custom threading for OpenCV on JeVois-Pro
714 std::shared_ptr<cv::parallel::ParallelForAPI> itsOpenCVparallelAPI;
715#endif
716 };
717} // namespace jevois
718
#define JEVOIS_A33
Target hardware selection:
Definition Config.H:36
#define JEVOIS_CAMERASENS_DEFAULT
Default camera sensor.
Definition Engine.H:80
#define JEVOIS_CAMERA_DEFAULT
On platform hardware, device for the camera sensor.
Definition Engine.H:67
#define JEVOIS_GADGET_DEFAULT
On platform hardware, device for the USB gadget driver (which sends video frames over USB to a host c...
Definition Engine.H:70
#define JEVOIS_SERIAL_DEFAULT
On platform hardware, device for the 4-pin hardware serial port.
Definition Engine.H:73
#define JEVOIS_USBSERIAL_DEFAULT
On platform hardware, device for serial-over-USB port.
Definition Engine.H:76
#define JEVOIS_IMUSPI_DEFAULT
Default IMU spi device.
Definition Engine.H:83
Helper class for camera calibration, which allows some modules to compute 3D locations of objects.
A component of a model hierarchy.
Definition Component.H:182
JeVois processing engine - gets images from camera sensor, processes them, and sends results over USB...
Definition Engine.H:416
Component * getPythonComponent(void *pyinst) const
Get the component registered with a given python instance.
Definition Engine.C:3025
void requestSetFormat(int idx)
Use this to request a format change from within process()
Definition Engine.C:942
void streamOn()
Start streaming on video from camera, processing, and USB.
Definition Engine.C:910
void drawCameraGUI()
Draw all camera controls into our GUI.
Definition Engine.C:2869
void nextDemo()
When in demo mode, switch to next demo.
Definition Engine.C:610
void reboot()
Request a reboot.
Definition Engine.C:1858
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(usbserialdev, std::string, "Over-the-USB serial device name, or empty", JEVOIS_USBSERIAL_DEFAULT, ParamCateg)
Parameter.
void onParamChange(engine::cpumaxl const &param, unsigned int const &newval) override
Parameter callback.
std::atomic< bool > itsStopMainLoop
Flag used to stop the main loop.
Definition Engine.H:620
JEVOIS_DECLARE_PARAMETER(quietcmd, bool, "When true, do not issue a message 'OK' after every correct command " "received at the command-line interface. Recommended for advanced users only.", false, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(videoerrors, bool, "Show any machine vision module errors (exceptions) " "in the video stream. Only takes effect if streaming video to USB.", true, ParamCateg)
Parameter.
void preInit() override
Override of Manager::preInit()
Definition Engine.C:627
std::shared_ptr< Module > itsModule
Our current module.
Definition Engine.H:616
JEVOIS_DECLARE_PARAMETER(python, bool, "When true, enable support for modules written in Python. Otherwise, " "attempting to load a python module will throw an exception. Disabling python saves " "a lot of memory and may be useful when using C++ modules that run large deep neural " "networks.", true, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(watchdog, double, "Timeout in seconds after which we kill this process if the main loop " "is stuck somehow, or 0.0 for no watchdog", 10.0, ParamCateg)
Parameter.
std::atomic< bool > itsStreaming
True when we are streaming video.
Definition Engine.H:619
void onParamChange(engine::serialdev const &param, std::string const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(imureg, bool, "Enable raw access to IMU registers through setimureg and getimureg", false, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serout, SerPort, "Send module serial messages to selected serial port(s)", SerPort::None, SerPort_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(camturbo, bool, "Enable camera turbo mode by relaxing the need for DMA-coherent video " "buffer memory. This can accelerate severalfolds access to the captured image data, but " "it may also yield stripe artifacts with some modules, such as PassThrough. The stripes " "are pieces of incorrect data in the cache. You should experiment with each particular " "module. Turbo mode is not recommended for any production-grade application.", false, ParamCateg)
Parameter.
void saveCameraCalibration(CameraCalibration const &calib, std::string const &stem="calibration")
Helper to save an OpenCV camera matrix and distortion coeffs for the current running module.
Definition Engine.C:1518
std::atomic< bool > itsRunning
True when we are running.
Definition Engine.H:618
size_t numVideoMappings() const
Return the number of video mappings.
Definition Engine.C:1536
std::shared_ptr< Module > module() const
Get a pointer to our current module (may be null)
Definition Engine.C:1468
void onParamChange(engine::demomode const &param, float const &newval) override
Parameter callback.
std::shared_ptr< IMU > itsIMU
Definition Engine.H:612
void onParamChange(engine::cpumax const &param, unsigned int const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(conslock, bool, "Lock the console and capture the keyboard and mouse to avoid " "interference, only effective on JeVois-Pro Platform, otherwise ignored. Set conslock " "to false if you are experiencing hard crashes and want to run jevoispro-daemon in gdb.", true, ParamCateg)
Parameter.
void abortDemo()
When in demo mode, abort demo mode.
Definition Engine.C:614
size_t getDefaultVideoMappingIdx() const
Allow access to the default video mapping index.
Definition Engine.C:1584
JEVOIS_DECLARE_PARAMETER(videomapping, int, "Index of Video Mapping to use, or -1 to use the default mapping. " "Note that this parameter is only available when parsing command-line arguments. " "At runtime, the setmapping command should be used instead.", -1, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serlog, SerPort, "Show log and debug messages on selected serial port(s)", SerPort::None, SerPort_Values, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(multicam, bool, "Allow up to 3 JeVois cameras on one USB bus. Enabling this " "reduces the amount of USB bandwidth used by each JeVois camera, from 3kb " "per USB isochronous microframe to 1kb. All 3 JeVois cameras must have this " "option enabled, and the JeVois linux kernel module should also have " "been loaded with multicam on.", false, ParamCateg)
Parameter.
JEVOIS_DEFINE_ENUM_CLASS(SerPort,(None)(All)(Hard)(USB))
Enum for Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumaxl, unsigned int, "CPU maximum frequency in MHz, for A53 little cores. " "To enable overclock frequencies above 1800 MHz, you need to first edit " "/boot/env.txt and change max_freq_a53, then reboot. Use with caution!", 1800, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016, 2100, 2208 }, ParamCateg)
Parameter.
void setFormat(size_t idx)
Callback for when the user selects a new output video format.
Definition Engine.C:949
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(demomode, float, "Show a demonstration of some available JeVois-Pro " "machine vision modules, cycling to the next modules after a number " "of seconds specified by this parameter (or 0.0 for no demo mode).", 0.0F, ParamCateg)
Parameter.
void onParamChange(engine::usbserialdev const &param, std::string const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(serlimit, size_t, "Maximum number of serial messages that can be sent by a module " "using sendSerial(), for each video frame, or 0 for no limit. Any message sent by " "the module beyond the first serlimit ones will be dropped. This is useful to avoid " "overloading the serial link, for example in case one is running a ArUco detector and " "a large number of ArUco tags are present in the field of view of JeVois.", 0, ParamCateg)
Parameter.
void onParamChange(engine::gui const &param, bool const &newval) override
Parameter callback.
void unRegisterPythonComponent(Component *comp)
Unregister a component as linked to some python code, used by dynamic params created in python.
Definition Engine.C:3016
void onParamChange(engine::cpumodel const &param, engine::CPUmode const &newval) override
Parameter callback.
void setOpenCVthreading(char const *name="jevois")
Set OpenCV parallel threading framework.
Definition Engine.C:3037
void sendSerial(std::string const &str, bool islog=false)
Send a string to all serial ports.
Definition Engine.C:1356
void streamOff()
Stop streaming on video from camera, processing, and USB.
Definition Engine.C:921
void runScriptFromFile(std::string const &filename, std::shared_ptr< UserInterface > ser, bool throw_no_file)
Run a script from file.
Definition Engine.C:2791
JEVOIS_DECLARE_PARAMETER(cameranbuf, unsigned int, "Number of video input (camera) buffers, or 0 for automatic.", 0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumax, unsigned int, "CPU maximum frequency in MHz" ". To enable overclock frequencies above 2208 MHz, you need to first edit " "/boot/env.txt and change max_freq_a73, then reboot. Use with caution!", 2208, { 500, 667, 1000, 1200, 1398, 1512, 1608, 1704, 1800, 1908, 2016, 2100, 2208, 2304, 2400 }, ParamCateg)
Parameter.
size_t itsDefaultMappingIdx
Index of default mapping.
Definition Engine.H:607
JEVOIS_DEFINE_ENUM_CLASS(CPUmode,(PowerSave)(Conservative)(OnDemand)(Interactive)(Performance))
Enum for Parameter.
void quit()
Terminate the program.
Definition Engine.C:1879
bool parseCommand(std::string const &str, std::shared_ptr< UserInterface > s, std::string const &pfx="")
Parse a user command received over serial port.
Definition Engine.C:1981
void onParamChange(engine::videoerrors const &param, bool const &newval) override
Parameter callback.
int mainLoop()
Main loop: grab, process, send over USB. Should be called by main application thread.
Definition Engine.C:1105
~Engine()
Destructor.
Definition Engine.C:840
JEVOIS_DECLARE_PARAMETER(gadgetdev, std::string, "Gadget device name. This is used on platform hardware only. " "On host hardware, a display window will be used unless gadgetdev is None (useful " "for benchmarking) or is a file stem for a movie file that does not start with /dev/ " "(and which should contain a printf-style directive for a single int argument, " "the movie number).", JEVOIS_GADGET_DEFAULT, ParamCateg)
Parameter.
VideoMapping const & getVideoMapping(size_t idx) const
Allow access to our video mappings which are parsed from file at construction.
Definition Engine.C:1540
size_t getVideoMappingIdx(unsigned int iformat, unsigned int iframe, unsigned int interval) const
Get the video mapping index for a given UVC iformat, iframe and interval.
Definition Engine.C:1549
JEVOIS_DECLARE_PARAMETER(gadgetnbuf, unsigned int, "Number of video output (USB video) buffers, or 0 for auto", 0, ParamCateg)
Parameter.
JEVOIS_DECLARE_PARAMETER(serialmonitors, bool, "If true, serial port monitors will be enabled " "in the GUI, which can be used to peek at serial communications not " "directed to the console. Can be turned off at start time (e.g., in the " "global JeVois params.cfg) as there is some small CPU cost to it.", true, ParamCateg)
Parameter.
VideoMapping const & getCurrentVideoMapping() const
Get the current video mapping.
Definition Engine.C:1532
void registerPythonComponent(Component *comp, void *pyinst)
Register a component as linked to some python code, used by dynamic params created in python.
Definition Engine.C:3006
JEVOIS_DECLARE_PARAMETER(camreg, bool, "Enable raw access to camera registers through setcamreg and getcamreg", false, ParamCateg)
Parameter.
CameraCalibration loadCameraCalibration(std::string const &stem="calibration", bool do_throw=false)
Helper to load an OpenCV camera matrix and distortion coeffs for the current running module.
Definition Engine.C:1480
VideoMapping const & findVideoMapping(unsigned int oformat, unsigned int owidth, unsigned int oheight, float oframespersec) const
Find the VideoMapping that has the given output specs, or throw if not found.
Definition Engine.C:1596
void onParamChange(engine::cpumode const &param, engine::CPUmode const &newval) override
Parameter callback.
JEVOIS_DECLARE_PARAMETER(camerasens, CameraSensor, "Camera sensor. Users would usually not set this parameter " "manually, it is set through boot-time configuration.", JEVOIS_CAMERASENS_DEFAULT, CameraSensor_Values, ParamCateg)
Parameter.
void reloadVideoMappings()
Re-load video mappings from videomappings.cfg.
Definition Engine.C:638
void postInit() override
Override of Manager::postInit()
Definition Engine.C:651
std::shared_ptr< Camera > camera() const
Get a pointer to our Camera (may be null, especially if not using a camera but, eg,...
Definition Engine.C:1476
JEVOIS_DECLARE_PARAMETER(cameralens, CameraLens, "Camera lens. Users should usually set this parameter " "using the global JeVois params.cfg config file.", CameraLens::standard, CameraLens_Values, ParamCateg)
Parameter.
VideoMapping const & getDefaultVideoMapping() const
Allow access to the default video mapping.
Definition Engine.C:1580
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumode, CPUmode, "CPU frequency modulation mode" " for A73 big cores", CPUmode::Performance, CPUmode_Values, ParamCateg)
Parameter.
std::shared_ptr< VideoInput > itsCamera
Our camera.
Definition Engine.H:611
JEVOIS_DECLARE_PARAMETER(cameradev, std::string, "Camera device name (if starting with /dev/v...), or movie " "file name (e.g., movie.mpg) or image sequence (e.g., im%02d.jpg, to read frames " "im00.jpg, im01.jpg, etc).", JEVOIS_CAMERA_DEFAULT, ParamCateg)
Parameter.
std::shared_ptr< VideoOutput > itsGadget
Our IMU.
Definition Engine.H:613
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(cpumodel, CPUmode, "CPU frequency modulation mode for A53 little cores", CPUmode::Performance, CPUmode_Values, ParamCateg)
Parameter.
std::timed_mutex itsMtx
Mutex to protect our internals.
Definition Engine.H:622
std::vector< VideoMapping > itsMappings
All our mappings from videomappings.cfg.
Definition Engine.H:608
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(serialdev, std::string, "Hardware (4-pin connector) serial device name, " "or 'stdio' to use the console, or empty for no hardware serial port", JEVOIS_SERIAL_DEFAULT, ParamCateg)
Parameter.
void clearErrors()
Clear all errors currently displayed in the JeVois-Pro GUI.
Definition Engine.C:1410
void foreachVideoMapping(std::function< void(VideoMapping const &m)> &&func)
Run a function on every video mapping.
Definition Engine.C:1588
void reportError(std::string const &err)
Definition Engine.C:1401
std::unique_ptr< DynamicLoader > itsLoader
Our module loader.
Definition Engine.H:615
VideoMapping itsCurrentMapping
Current mapping, may not match any in itsMappings if setmapping2 used.
Definition Engine.H:609
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(gui, bool, "Use a graphical user interface instead of plain display " "when true", true, ParamCateg)
Parameter.
Manager of a hierarchy of Component objects.
Definition Manager.H:74
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
Definition RawImage.H:111
Definition Engine.H:120
Main namespace for all JeVois classes and functions.
Definition Concepts.dox:2
Simple struct to hold video mapping definitions for the processing Engine.