grabberDual
: A Network grabber for camera devices.
More...
#include <ServerFrameGrabberDual/ServerFrameGrabberDual.h>
Public Member Functions | |
ServerGrabber () | |
ServerGrabber (const ServerGrabber &)=delete | |
ServerGrabber (ServerGrabber &&)=delete | |
ServerGrabber & | operator= (const ServerGrabber &)=delete |
ServerGrabber & | operator= (ServerGrabber &&)=delete |
~ServerGrabber () override | |
bool | close () override |
Close the DeviceDriver. More... | |
bool | open (yarp::os::Searchable &config) override |
Configure with a set of options. More... | |
bool | respond (const yarp::os::Bottle &command, yarp::os::Bottle &reply, bool left, bool both) |
bool | attachAll (const yarp::dev::PolyDriverList &device2attach) override |
Attach to a list of objects. More... | |
bool | detachAll () override |
Detach the object (you must have first called attach). More... | |
bool | attach (yarp::dev::PolyDriver *poly) override |
Attach to another object. More... | |
bool | detach () override |
Detach the object (you must have first called attach). More... | |
bool | threadInit () override |
Initialization method. More... | |
void | threadRelease () override |
Release method. More... | |
void | run () override |
Loop function. More... | |
Public Member Functions inherited from yarp::dev::DeviceDriver | |
~DeviceDriver () override=default | |
Destructor. More... | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. More... | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. More... | |
Public Member Functions inherited from yarp::os::IConfig | |
virtual | ~IConfig () |
Destructor. More... | |
virtual bool | configure (Searchable &config) |
Change online parameters. More... | |
Public Member Functions inherited from yarp::dev::IWrapper | |
virtual | ~IWrapper () |
Destructor. More... | |
Public Member Functions inherited from yarp::dev::IMultipleWrapper | |
virtual | ~IMultipleWrapper () |
Destructor. More... | |
Public Member Functions inherited from yarp::os::PeriodicThread | |
PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No) | |
Constructor. More... | |
virtual | ~PeriodicThread () |
bool | start () |
Call this to start the thread. More... | |
void | step () |
Call this to "step" the thread rather than starting it. More... | |
void | stop () |
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called). More... | |
void | askToStop () |
Stop the thread. More... | |
bool | isRunning () const |
Returns true when the thread is started, false otherwise. More... | |
bool | isSuspended () const |
Returns true when the thread is suspended, false otherwise. More... | |
bool | setPeriod (double period) |
Set the (new) period of the thread. More... | |
double | getPeriod () const |
Return the current period of the thread. More... | |
void | suspend () |
Suspend the thread, the thread keeps running by doLoop is never executed. More... | |
void | resume () |
Resume the thread if previously suspended. More... | |
void | resetStat () |
Reset thread statistics. More... | |
double | getEstimatedPeriod () const |
Return estimated period since last reset. More... | |
void | getEstimatedPeriod (double &av, double &std) const |
Return estimated period since last reset. More... | |
unsigned int | getIterations () const |
Return the number of iterations performed since last reset. More... | |
double | getEstimatedUsed () const |
Return the estimated duration of the run() function since last reset. More... | |
void | getEstimatedUsed (double &av, double &std) const |
Return estimated duration of the run() function since last reset. More... | |
int | setPriority (int priority, int policy=-1) |
Set the priority and scheduling policy of the thread, if the OS supports that. More... | |
int | getPriority () const |
Query the current priority of the thread, if the OS supports that. More... | |
int | getPolicy () const |
Query the current scheduling policy of the thread, if the OS supports that. More... | |
Protected Member Functions | |
bool | fromConfig (yarp::os::Searchable &config) |
bool | initialize_YARP (yarp::os::Searchable ¶ms) |
void | stopThread () |
void | setupFlexImage (const yarp::sig::Image &img, yarp::sig::FlexImage &flex_i) |
void | shallowCopyImages (const yarp::sig::FlexImage &src, yarp::sig::FlexImage &dest) |
void | cleanUp () |
Protected Member Functions inherited from yarp::os::PeriodicThread | |
virtual void | beforeStart () |
Called just before a new thread starts. More... | |
virtual void | afterStart (bool success) |
Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). More... | |
grabberDual
: A Network grabber for camera devices.
In base of the configuration this device can handle one or two cameras.
In case of two cameras, the RGB or RAW streaming will be produced on two separated ports or on a single port with the two images stitched horizontally.
Moreover it has two rpc ports that have the same name of the streaming ports + "/rpc" suffix.
The inheritance from yarp::dev::IWrapper and yarp::dev::IMultipleWrapper allows to be instantiated also through yarprobotinterface. See their documentation for more details about each interface.
This device is paired with its client called RemoteFrameGrabber to receive the data streams and perform remote operations.
Parameters required by this device are:
Parameter name | SubParameter | Type | Units | Default Value | Required | Description | Notes |
---|---|---|---|---|---|---|---|
period | - | int | ms | 30 | No | refresh period(in ms) of the broadcasted values through yarp ports | default 30ms |
name | - | string | - | /grabber | No | Prefix name of the ports opened by the ServerGrabber | Required suffix like '/rpc' will be added by the device |
capabilities | - | string | - | COLOR | No | two capabilities supported, COLOR and RAW respectively for rgb and raw streaming | - |
twoCameras | - | bool | - | - | required only for instantiating this device with the yarprobotinterface | if true ServerGrabber will open and handle two devices, if false only one | =true it makes required left_config and right_config parameters, =false subdevice parameter becomes required |
split | - | bool | - | false | No | set 'true' to split the streaming of the input camera/s on two different ports | Useful in case of dual cameras, the image will be split vertically in the 2 output ports 'left' and 'right' |
subdevice | - | string | - | - | used for opening and handling a single device, alternative to 'attach' action | name of the subdevice to use as a data source | when used, parameters for the subdevice must be provided as well |
left_config | - | string | - | - | used for opening and handling two devices, required if right_config present and/or twoCameras set to true | name of the ini file containing the configuration of one of two subdevices to use as a data source | when used, parameters for the subdevice must be provided in the file specified. This parameter is not admitted if the device is configured for working with one device. |
right_config | - | string | - | - | used for opening and handling two devices, required if left_config present and/or twoCameras set to true | name of the ini file containing the configuration of one of two subdevices to use as a data source | when used, parameters for the subdevice must be provided in the file specified. This parameter is not admitted if the device is configured for working with one device. |
context | - | string | - | - | No | name of context where the yarp::os::ResourceFinder will search the ini files specified in left_config and right_config | - |
Some example of configuration files:
Example of configuration file using .ini format, for handling two cameras.
Example of configuration file using .ini format, for handling one camera.
Example of configuration file using .xml format, for handling two cameras.
Example of configuration file using .xml format, for handling one camera.
Definition at line 181 of file ServerFrameGrabberDual.h.
ServerGrabber::ServerGrabber | ( | ) |
Definition at line 191 of file ServerFrameGrabberDual.cpp.
|
delete |
|
delete |
|
override |
Definition at line 196 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Attach to another object.
poly | the polydriver that you want to attach to. |
Implements yarp::dev::IWrapper.
Definition at line 943 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Attach to a list of objects.
p | the polydriver list that you want to attach to. |
Implements yarp::dev::IMultipleWrapper.
Definition at line 739 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 1327 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 202 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Detach the object (you must have first called attach).
Implements yarp::dev::IWrapper.
Definition at line 964 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Detach the object (you must have first called attach).
Implements yarp::dev::IMultipleWrapper.
Definition at line 909 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 325 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 426 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Configure with a set of options.
config | The options to use |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 260 of file ServerFrameGrabberDual.cpp.
|
delete |
|
delete |
bool ServerGrabber::respond | ( | const yarp::os::Bottle & | command, |
yarp::os::Bottle & | reply, | ||
bool | left, | ||
bool | both = false |
||
) |
Definition at line 472 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Loop function.
This is the thread itself. The thread calls the run() function every <period> ms. At the end of each run, the thread will sleep the amounth of time required, taking into account the time spent inside the loop function. Example: requested period is 10ms, the run() function take 3ms to be executed, the thread will sleep for 7ms.
Note: after each run is completed, the thread will call a yield() in order to facilitate other threads to run.
Implements yarp::os::PeriodicThread.
Definition at line 1133 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 935 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 1321 of file ServerFrameGrabberDual.cpp.
|
protected |
Definition at line 918 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Initialization method.
The thread executes this function when it starts and before "run". This is a good place to perform initialization tasks that need to be done by the thread itself (device drivers initialization, memory allocation etc). If the function returns false the thread quits and never calls "run". The return value of threadInit() is notified to the class and passed as a parameter to afterStart(). Note that afterStart() is called by the same thread that is executing the "start" method.
Reimplemented from yarp::os::PeriodicThread.
Definition at line 1072 of file ServerFrameGrabberDual.cpp.
|
overridevirtual |
Release method.
The thread executes this function once when it exits, after the last "run". This is a good place to release resources that were initialized in threadInit() (release memory, and device driver resources).
Reimplemented from yarp::os::PeriodicThread.
Definition at line 1127 of file ServerFrameGrabberDual.cpp.