YARP
Yet Another Robot Platform

grabber: Export a frame grabber to the network. More...

#include <ServerFrameGrabber/ServerFrameGrabber.h>

+ Inheritance diagram for ServerFrameGrabber:

Public Member Functions

 ServerFrameGrabber ()=default
 
 ServerFrameGrabber (const ServerFrameGrabber &)=delete
 
 ServerFrameGrabber (ServerFrameGrabber &&)=delete
 
ServerFrameGrabberoperator= (const ServerFrameGrabber &)=delete
 
ServerFrameGrabberoperator= (ServerFrameGrabber &&)=delete
 
 ~ServerFrameGrabber () override=default
 
bool close () override
 Close the DeviceDriver. More...
 
bool open (yarp::os::Searchable &config) override
 Configure with a set of options. More...
 
virtual bool respond (const yarp::os::Bottle &command, yarp::os::Bottle &reply) override
 Respond to a message. More...
 
bool getDatum (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
 
bool getDatum (yarp::sig::ImageOf< yarp::sig::PixelMono > &image) override
 
bool getDatum (yarp::dev::ImageRgbSound &imageSound) override
 
virtual bool getDatum (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override
 
bool getImage (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
 
virtual bool getImage (yarp::sig::ImageOf< yarp::sig::PixelMono > &image)
 
virtual bool getAudioVisual (yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override
 Get an image and sound. More...
 
int height () const override
 Return the height of each frame. More...
 
int width () const override
 Return the width of each frame. More...
 
bool startService () override
 Initiate the service, whatever it is. More...
 
bool stopService () override
 Shut down the service, whatever it is. More...
 
bool updateService () override
 Give the service the chance to run for a while. 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 DeviceDrivergetImplementation ()
 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::DeviceResponder
 DeviceResponder ()
 Constructor. More...
 
void addUsage (const char *txt, const char *explain=nullptr)
 Add information about a message that the respond() method understands. More...
 
void addUsage (const yarp::os::Bottle &bot, const char *explain=nullptr)
 Add information about a message that the respond() method understands. More...
 
bool read (yarp::os::ConnectionReader &connection) override
 Handler for reading messages from the network, and passing them on to the respond() method. More...
 
void onRead (yarp::os::Bottle &v) override
 Alternative handler for reading messages from the network, and passing them on to the respond() method. More...
 
void makeUsage ()
 Regenerate usage information. More...
 
void attach (yarp::os::TypedReader< yarp::os::Bottle > &source)
 Attach this object to a source of messages. More...
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::TypedReaderCallback< yarp::os::Bottle >
virtual ~TypedReaderCallback ()
 Destructor. More...
 
virtual void onRead (yarp::os::Bottle &datum)
 Callback method. More...
 
virtual void onRead (yarp::os::Bottle &datum, const yarp::os::TypedReader< yarp::os::Bottle > &reader)
 Callback method. More...
 
- Public Member Functions inherited from yarp::dev::IFrameGrabberOf< ImageType >
virtual bool getImage (ImageType &image)=0
 Get an image from the frame grabber. More...
 
virtual bool getImageCrop (cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int >> vertices, ImageType &image)
 Get a crop of the image from the frame grabber. More...
 
- Public Member Functions inherited from yarp::dev::IFrameGrabberImageBase
virtual ~IFrameGrabberImageBase ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::dev::IAudioVisualGrabber
virtual ~IAudioVisualGrabber ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::dev::IService
virtual ~IService ()
 

Detailed Description

grabber: Export a frame grabber to the network.

Provides the IFrameGrabberImage, IFrameGrabberControls, and IAudioGrabberSound interfaces. The corresponding client is a RemoteFrameGrabber.

The network interface is a single Port. Images are streamed out from that Port – RemoteFrameGrabber uses this stream to provide the IFrameGrabberImage interface. The IFrameGrabberControls functionality is provided via RPC.

Here's a command-line example:

[terminal A] yarpdev --device fakeFrameGrabber --width 8 --height 8 --name /grabber --framerate 30
[terminal B] yarp read /read
[terminal C] yarp connect /grabber /read
[terminal C] echo "[get] [gain]" | yarp rpc /grabber

The yarpdev line starts a FakeFrameGrabber wrapped in a ServerFrameGrabber. Parameters are: –width, –height set the size of the frame in pixels –name portname set the name of the output port –framerate set the frequency (Hz) at which images will be read and broadcast to the network; if the parameter is not set images are provided at the maximum speed supported by the device. Notice that the maximum frame rate is determined by the device.

After the "yarp connect" line, image descriptions will show up in terminal B (you could view them with the yarpview application). The "yarp rpc" command should query the gain (0.0 for the test grabber).

Command (text form) Response Code equivalent
[set] [bri] 1.0 none setBrightness()
[set] [gain] 1.0 none setGain()
[set] [shut] 1.0 none setShutter()
[get] [bri] [is] [bri] 1.0 getBrightness()
[get] [gain] [is] [gain] 1.0 getGain()
[get] [shut] [is] [shut] 1.0 getShutter()

Definition at line 82 of file ServerFrameGrabber.h.

Constructor & Destructor Documentation

◆ ServerFrameGrabber() [1/3]

ServerFrameGrabber::ServerFrameGrabber ( )
default

◆ ServerFrameGrabber() [2/3]

ServerFrameGrabber::ServerFrameGrabber ( const ServerFrameGrabber )
delete

◆ ServerFrameGrabber() [3/3]

ServerFrameGrabber::ServerFrameGrabber ( ServerFrameGrabber &&  )
delete

◆ ~ServerFrameGrabber()

ServerFrameGrabber::~ServerFrameGrabber ( )
overridedefault

Member Function Documentation

◆ close()

bool ServerFrameGrabber::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 24 of file ServerFrameGrabber.cpp.

◆ getAudioVisual()

bool ServerFrameGrabber::getAudioVisual ( yarp::sig::ImageOf< yarp::sig::PixelRgb > &  image,
yarp::sig::Sound sound 
)
overridevirtual

Get an image and sound.

Parameters
imagethe image to be filled
soundthe sound to be filled
Returns
true/false upon success/failure

Implements yarp::dev::IAudioVisualGrabber.

Definition at line 457 of file ServerFrameGrabber.cpp.

◆ getDatum() [1/4]

bool ServerFrameGrabber::getDatum ( yarp::dev::ImageRgbSound imageSound)
override

Definition at line 434 of file ServerFrameGrabber.cpp.

◆ getDatum() [2/4]

bool ServerFrameGrabber::getDatum ( yarp::sig::ImageOf< yarp::sig::PixelMono > &  image)
override

Definition at line 429 of file ServerFrameGrabber.cpp.

◆ getDatum() [3/4]

bool ServerFrameGrabber::getDatum ( yarp::sig::ImageOf< yarp::sig::PixelRgb > &  image)
override

Definition at line 424 of file ServerFrameGrabber.cpp.

◆ getDatum() [4/4]

bool ServerFrameGrabber::getDatum ( yarp::sig::ImageOf< yarp::sig::PixelRgb > &  image,
yarp::sig::Sound sound 
)
overridevirtual

Definition at line 439 of file ServerFrameGrabber.cpp.

◆ getImage() [1/2]

bool ServerFrameGrabber::getImage ( yarp::sig::ImageOf< yarp::sig::PixelMono > &  image)
virtual

Definition at line 451 of file ServerFrameGrabber.cpp.

◆ getImage() [2/2]

bool ServerFrameGrabber::getImage ( yarp::sig::ImageOf< yarp::sig::PixelRgb > &  image)
override

Definition at line 445 of file ServerFrameGrabber.cpp.

◆ height()

int ServerFrameGrabber::height ( ) const
overridevirtual

Return the height of each frame.

Returns
image height

Implements yarp::dev::IFrameGrabberImageBase.

Definition at line 464 of file ServerFrameGrabber.cpp.

◆ open()

bool ServerFrameGrabber::open ( yarp::os::Searchable config)
overridevirtual

Configure with a set of options.

These are:

subdevice Common name of device to wrap (e.g. "fakeFrameGrabber").
name Port name to assign to this server (default /grabber).
Parameters
configThe options to use
Returns
true iff the object could be configured.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 38 of file ServerFrameGrabber.cpp.

◆ operator=() [1/2]

ServerFrameGrabber& ServerFrameGrabber::operator= ( const ServerFrameGrabber )
delete

◆ operator=() [2/2]

ServerFrameGrabber& ServerFrameGrabber::operator= ( ServerFrameGrabber &&  )
delete

◆ respond()

bool ServerFrameGrabber::respond ( const yarp::os::Bottle command,
yarp::os::Bottle reply 
)
overridevirtual

Respond to a message.

Parameters
commandthe message
replythe response
Returns
true if there was no critical failure

Reimplemented from yarp::dev::DeviceResponder.

Definition at line 195 of file ServerFrameGrabber.cpp.

◆ startService()

bool ServerFrameGrabber::startService ( )
overridevirtual

Initiate the service, whatever it is.

The service should then run by itself, without any further interaction with its creator until stopService() is called.

Returns
true if the service started and needs no help running. If false is returned, the service expects updateService() to be called repeatedly until that function too returns false. This is useful for devices that don't want to manage their own service threads.

Reimplemented from yarp::dev::IService.

Definition at line 483 of file ServerFrameGrabber.cpp.

◆ stopService()

bool ServerFrameGrabber::stopService ( )
overridevirtual

Shut down the service, whatever it is.

Returns
true iff the service shut down ok.

Reimplemented from yarp::dev::IService.

Definition at line 478 of file ServerFrameGrabber.cpp.

◆ updateService()

bool ServerFrameGrabber::updateService ( )
overridevirtual

Give the service the chance to run for a while.

This is an alternative to calling startService(). It is more appropriate in a single-threaded environment.

Returns
true iff the service is willing to run some more. A return value of false means that the service would like to stop.

Reimplemented from yarp::dev::IService.

Definition at line 492 of file ServerFrameGrabber.cpp.

◆ width()

int ServerFrameGrabber::width ( ) const
overridevirtual

Return the width of each frame.

Returns
image width

Implements yarp::dev::IFrameGrabberImageBase.

Definition at line 471 of file ServerFrameGrabber.cpp.


The documentation for this class was generated from the following files: