YARP
Yet Another Robot Platform
yarp::dev::ServerFrameGrabber Class Reference

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

#include <ServerFrameGrabber/ServerFrameGrabber.h>

+ Inheritance diagram for yarp::dev::ServerFrameGrabber:

Detailed Description

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 test_grabber --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 TestFrameGrabber 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 85 of file ServerFrameGrabber.h.

Public Member Functions

 ServerFrameGrabber ()
 Constructor. More...
 
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 (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
 Get an rgb image from the frame grabber, if required demosaicking/color reconstruction is applied. More...
 
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
virtual ~DeviceDriver ()
 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=0)
 Add information about a message that the respond() method understands. More...
 
void addUsage (const yarp::os::Bottle &bot, const char *explain=0)
 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, const yarp::os::TypedReader< yarp::os::Bottle > &reader)
 Callback method. More...
 
- Public Member Functions inherited from yarp::dev::IFrameGrabberImage
virtual ~IFrameGrabberImage ()
 Destructor. More...
 
virtual bool getImageCrop (cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int > > vertices, yarp::sig::ImageOf< yarp::sig::PixelRgb > &image)
 Get a crop of the rgb image from the frame grabber, if required demosaicking/color reconstruction is applied. More...
 
- Public Member Functions inherited from yarp::dev::IAudioVisualGrabber
virtual ~IAudioVisualGrabber ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::dev::IService
virtual ~IService ()
 

Constructor & Destructor Documentation

◆ ServerFrameGrabber()

ServerFrameGrabber::ServerFrameGrabber ( )

Constructor.

Definition at line 28 of file ServerFrameGrabber.cpp.

Member Function Documentation

◆ close()

bool ServerFrameGrabber::close ( void  )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 44 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 466 of file ServerFrameGrabber.cpp.

◆ getDatum() [1/4]

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

Definition at line 439 of file ServerFrameGrabber.cpp.

◆ getDatum() [2/4]

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

Definition at line 443 of file ServerFrameGrabber.cpp.

◆ getDatum() [3/4]

bool ServerFrameGrabber::getDatum ( ImageRgbSound imageSound)
override

Definition at line 447 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 451 of file ServerFrameGrabber.cpp.

◆ getImage() [1/2]

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

Get an rgb image from the frame grabber, if required demosaicking/color reconstruction is applied.

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

Implements yarp::dev::IFrameGrabberImage.

Definition at line 456 of file ServerFrameGrabber.cpp.

◆ getImage() [2/2]

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

Definition at line 461 of file ServerFrameGrabber.cpp.

◆ height()

int ServerFrameGrabber::height ( ) const
overridevirtual

Return the height of each frame.

Returns
image height

Implements yarp::dev::IFrameGrabberImage.

Definition at line 472 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. "test_grabber").
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 57 of file ServerFrameGrabber.cpp.

◆ 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 212 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 488 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 484 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 496 of file ServerFrameGrabber.cpp.

◆ width()

int ServerFrameGrabber::width ( ) const
overridevirtual

Return the width of each frame.

Returns
image width

Implements yarp::dev::IFrameGrabberImage.

Definition at line 478 of file ServerFrameGrabber.cpp.


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