|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
43 yCError(SERVERFRAMEGRABBER,
"Did you just try to open the same ServerFrameGrabber twice?\n");
48 bool separatePorts =
false;
54 if (config.
check(
"subdevice",name,
"name (or nested configuration) of device to wrap")) {
58 p.setMonitor(config.getMonitor(),
68 if (!poly.isValid()) {
73 yCError(SERVERFRAMEGRABBER,
"\"--subdevice <name>\" not set for server_framegrabber\n");
91 poly.view(fgImageRaw);
101 ifgCtrl_Parser.configure(fgCtrl);
105 bool conf = rgbParser.configure(rgbVis_p);
109 yCWarning(SERVERFRAMEGRABBER) <<
"ServerFrameGrabber: error configuring interfaces for parsers";
113 canDrop = !config.
check(
"no_drop",
"if present, use strict policy for sending data");
114 addStamp = config.
check(
"stamp",
"if present, add timestamps to data");
119 "name of port to send data on").asString());
130 !config.
check(
"shared-ports",
131 "If present, send audio and images on same port")) {
132 separatePorts =
true;
133 yCAssert(SERVERFRAMEGRABBER, p2==
nullptr);
135 yCAssert(SERVERFRAMEGRABBER, p2!=
nullptr);
136 p2->open(config.
check(
"name2",
Value(
"/grabber2"),
137 "Name of second port to send data on, when audio and images sent separately").asString());
142 yCAssert(SERVERFRAMEGRABBER, p2!=
nullptr);
145 thread.attach(
new DataWriter<ImageRgbSound>(p,*
this,canDrop,
148 }
else if (fgImage!=
nullptr) {
150 }
else if (fgImageRaw!=
nullptr) {
153 yCError(SERVERFRAMEGRABBER,
"subdevice <%s> doesn't look like a framegrabber\n",
159 config.
check(
"single_threaded",
160 "if present, operate in single threaded mode")!=0;
161 thread.open(config.
check(
"framerate",
Value(
"0"),
162 "maximum rate in Hz to read from subdevice").asFloat64(),
167 DeviceResponder::makeUsage();
168 addUsage(
"[set] [bri] $fBrightness",
"set brightness");
169 addUsage(
"[set] [expo] $fExposure",
"set exposure");
170 addUsage(
"[set] [shar] $fSharpness",
"set sharpness");
171 addUsage(
"[set] [whit] $fBlue $fRed",
"set white balance");
172 addUsage(
"[set] [hue] $fHue",
"set hue");
173 addUsage(
"[set] [satu] $fSaturation",
"set saturation");
174 addUsage(
"[set] [gamm] $fGamma",
"set gamma");
175 addUsage(
"[set] [shut] $fShutter",
"set shutter");
176 addUsage(
"[set] [gain] $fGain",
"set gain");
177 addUsage(
"[set] [iris] $fIris",
"set iris");
179 addUsage(
"[get] [bri]",
"get brightness");
180 addUsage(
"[get] [expo]",
"get exposure");
181 addUsage(
"[get] [shar]",
"get sharpness");
182 addUsage(
"[get] [whit]",
"get white balance");
183 addUsage(
"[get] [hue]",
"get hue");
184 addUsage(
"[get] [satu]",
"get saturation");
185 addUsage(
"[get] [gamm]",
"get gamma");
186 addUsage(
"[get] [shut]",
"get shutter");
187 addUsage(
"[get] [gain]",
"get gain");
188 addUsage(
"[get] [iris]",
"get iris");
190 addUsage(
"[get] [w]",
"get width of image");
191 addUsage(
"[get] [h]",
"get height of image");
208 return ifgCtrl_Parser.respond(cmd, response);
212 return rgbParser.respond(cmd,response);
225 response.
addInt32(
int(fgCtrlDC1394->getVideoModeMaskDC1394()));
228 response.
addInt32(
int(fgCtrlDC1394->getVideoModeDC1394()));
234 response.
addInt32(
int(fgCtrlDC1394->getFPSMaskDC1394()));
237 response.
addInt32(
int(fgCtrlDC1394->getFPSDC1394()));
244 response.
addInt32(
int(fgCtrlDC1394->getISOSpeedDC1394()));
254 response.
addInt32(
int(fgCtrlDC1394->getColorCodingDC1394()));
261 unsigned int xstep,ystep,xdim,ydim,xoffstep,yoffstep;
262 fgCtrlDC1394->getFormat7MaxWindowDC1394(xdim,ydim,xstep,ystep,xoffstep,yoffstep);
273 unsigned int xdim,ydim;
275 fgCtrlDC1394->getFormat7WindowDC1394(xdim,ydim,x0,y0);
286 response.
addInt32(
int(fgCtrlDC1394->setOperationModeDC1394(cmd.
get(1).
asInt32()!=0)));
289 response.
addInt32(fgCtrlDC1394->getOperationModeDC1394());
296 response.
addInt32(fgCtrlDC1394->getTransmissionDC1394());
310 response.
addInt32(
int(fgCtrlDC1394->setDefaultsDC1394()));
313 response.
addInt32(
int(fgCtrlDC1394->setResetDC1394()));
325 response.
addInt32(fgCtrlDC1394->getBytesPerPacketDC1394());
328 return DeviceResponder::respond(cmd,response);
333 yCError(SERVERFRAMEGRABBER) <<
"ServerFrameGrabber: command not recognized" << cmd.
toString();
334 return DeviceResponder::respond(cmd,response);
427 return getImage(image);
432 return getImage(image);
437 return getDatum(imageSound.
head,imageSound.
body);
443 return getAudioVisual(image,sound);
448 if (fgImage==
nullptr) {
return false; }
449 return fgImage->getImage(image);
454 if (fgImageRaw==
nullptr) {
return false; }
455 return fgImageRaw->getImage(image);
461 if (fgAv==
nullptr) {
return false; }
462 return fgAv->getAudioVisual(image,sound);
467 if (fgImage) {
return fgImage->height(); }
468 if (fgImageRaw) {
return fgImageRaw->height(); }
474 if (fgImage) {
return fgImage->width(); }
475 if (fgImageRaw) {
return fgImageRaw->width(); }
486 if (singleThreaded) {
495 if (singleThreaded) {
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
constexpr yarp::conf::vocab32_t VOCAB_DRSETCOD
constexpr yarp::conf::vocab32_t VOCAB_DRSETISO
A simple collection of objects that can be described and transmitted in a portable way.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
constexpr yarp::conf::vocab32_t VOCAB_DRGETISO
A base class for nested structures that can be searched.
constexpr yarp::conf::vocab32_t VOCAB_DRSETPWR
Group a pair of objects to be sent and received together.
BODY body
An object of the second type (BODY).
constexpr yarp::conf::vocab32_t VOCAB_DRGETCCM
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
#define yCWarning(component,...)
bool close() override
Close the DeviceDriver.
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
constexpr yarp::conf::vocab32_t VOCAB_DRSETBPP
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
#define YARP_LOG_COMPONENT(name,...)
constexpr yarp::conf::vocab32_t VOCAB_DRSETTXM
constexpr yarp::conf::vocab32_t VOCAB_DRGETOPM
constexpr yarp::conf::vocab32_t VOCAB_DRGETVMD
constexpr yarp::conf::vocab32_t VOCAB_DRSETVMD
virtual bool hasAudio()=0
virtual bool getAudioVisual(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override
Get an image and sound.
constexpr yarp::conf::vocab32_t VOCAB_DRSETCAP
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply) override
Respond to a message.
virtual bool hasVideo()=0
virtual bool hasRawVideo()
An interface for the device drivers.
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPM
A mini-server for network communication.
constexpr yarp::conf::vocab32_t VOCAB_DRGETWF7
virtual bool isString() const
Checks if value is a string.
static Type byName(const char *name)
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
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.
constexpr yarp::conf::vocab32_t VOCAB_DRGETCOD
int height() const override
Return the height of each frame.
constexpr yarp::conf::vocab32_t VOCAB_DRSETFPS
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPS
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
bool updateService() override
Give the service the chance to run for a while.
constexpr yarp::conf::vocab32_t VOCAB_DRSETOPM
bool startService() override
Initiate the service, whatever it is.
bool getDatum(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
constexpr yarp::conf::vocab32_t VOCAB_DRGETMSK
constexpr yarp::conf::vocab32_t VOCAB_DRGETTXM
#define yCAssert(component, x)
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
Bottle tail() const
Get all but the first element of a bottle.
constexpr yarp::conf::vocab32_t VOCAB_DRGETF7M
#define yCError(component,...)
constexpr yarp::conf::vocab32_t VOCAB_DRSETDEF
constexpr yarp::conf::vocab32_t VOCAB_RGB_VISUAL_PARAMS
virtual std::int32_t asInt32() const
Get 32-bit integer value.
HEAD head
An object of the first type (HEAD).
constexpr yarp::conf::vocab32_t VOCAB_DRSETBCS
An interface to the operating system, including Port based communication.
bool stopService() override
Shut down the service, whatever it is.
Class for storing sounds.
constexpr yarp::conf::vocab32_t VOCAB_DRGETBPP
constexpr yarp::conf::vocab32_t VOCAB_DRSETWF7
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
constexpr yarp::conf::vocab32_t VOCAB_DRSETRST
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL_DC1394
A class for storing options and configuration information.
int width() const override
Return the width of each frame.