64 else {
yCError(FRAMEGRABBER_NWS_YARP) <<
"'capabilities' parameter unsupported value";
return false;}
67 std::string pImg_Name =
m_name;
68 std::string rpcPort_Name = pImg_Name +
"/rpc";
70 if (!rpcPort.
open(rpcPort_Name)) {
71 yCError(FRAMEGRABBER_NWS_YARP) <<
"Unable to open rpc Port" << rpcPort_Name.c_str();
79 if (!pImg.
open(pImg_Name)) {
80 yCError(FRAMEGRABBER_NWS_YARP) <<
"Unable to open image streaming Port" << pImg_Name.c_str();
85 yCInfo(FRAMEGRABBER_NWS_YARP) <<
"Running, waiting for attach...";
93 yCError(FRAMEGRABBER_NWS_YARP) <<
"Device " << poly <<
" to attach to is not valid ... cannot proceed";
97 poly->
view(iRgbVisualParams);
98 poly->
view(iFrameGrabberImage);
99 poly->
view(iFrameGrabberImageRaw);
100 poly->
view(iFrameGrabberControls);
101 poly->
view(iFrameGrabberControlsDC1394);
102 poly->
view(iPreciselyTimed);
106 if (iFrameGrabberImage ==
nullptr) {
107 yCError(FRAMEGRABBER_NWS_YARP) <<
"Capability \"COLOR\" required not supported";
112 if (iFrameGrabberImageRaw ==
nullptr) {
113 yCError(FRAMEGRABBER_NWS_YARP) <<
"Capability \"RAW\" required not supported";
119 if (iRgbVisualParams ==
nullptr) {
120 yCWarning(FRAMEGRABBER_NWS_YARP) <<
"Targets has not IVisualParamInterface, some features cannot be available";
124 if (iFrameGrabberImage !=
nullptr) {
125 if (!(frameGrabberImage_Responder.
configure(iFrameGrabberImage))) {
126 yCError(FRAMEGRABBER_NWS_YARP) <<
"Error configuring interfaces for parsers";
131 if (iFrameGrabberImageRaw !=
nullptr) {
132 if (!(frameGrabberImageRaw_Responder.
configure(iFrameGrabberImageRaw))) {
133 yCError(FRAMEGRABBER_NWS_YARP) <<
"Error configuring interfaces for parsers";
138 if (iRgbVisualParams !=
nullptr) {
139 if (!(rgbVisualParams_Responder.
configure(iRgbVisualParams))) {
140 yCError(FRAMEGRABBER_NWS_YARP) <<
"Error configuring interfaces for parsers";
144 if (iFrameGrabberControls !=
nullptr) {
145 if (!(frameGrabberControls_Responder.
configure(iFrameGrabberControls))) {
146 yCError(FRAMEGRABBER_NWS_YARP) <<
"Error configuring interfaces for parsers";
151 if (iFrameGrabberControlsDC1394 !=
nullptr) {
152 if (!(frameGrabberControlsDC1394_Responder.
configure(iFrameGrabberControlsDC1394))) {
153 yCError(FRAMEGRABBER_NWS_YARP) <<
"Error configuring interfaces for parsers";
158 return PeriodicThread::start();
168 iRgbVisualParams =
nullptr;
169 iFrameGrabberImage =
nullptr;
170 iFrameGrabberImageRaw =
nullptr;
171 iFrameGrabberControls =
nullptr;
172 iFrameGrabberControlsDC1394 =
nullptr;
173 iPreciselyTimed =
nullptr;
180 if (m_cap == COLOR) {
199 if (m_cap == COLOR) {
200 if (iFrameGrabberImage !=
nullptr) {
201 if (iFrameGrabberImage->
getImage(*img))
204 {
yCError(FRAMEGRABBER_NWS_YARP) <<
"Image not captured (getImage failed). Check hardware configuration.";}
206 yCError(FRAMEGRABBER_NWS_YARP) <<
"Image not captured (invalid interface). Check hw/sw configuration.";
211 if (iFrameGrabberImageRaw !=
nullptr) {
212 if (iFrameGrabberImageRaw->
getImage(*img_Raw))
213 {flex_i.
swap(*img_Raw);}
215 {
yCError(FRAMEGRABBER_NWS_YARP) <<
"Image not captured (getImage failed). Check hardware configuration.";}
217 yCError(FRAMEGRABBER_NWS_YARP) <<
"Image not captured (invalid interface). Check hw/sw configuration.";
221 if (iPreciselyTimed) {
238 return frameGrabberImage_Responder.
respond(command, reply);
240 return frameGrabberImageRaw_Responder.
respond(command, reply);
242 return frameGrabberControls_Responder.
respond(command, reply);
244 return rgbVisualParams_Responder.
respond(command, reply);
246 return frameGrabberControlsDC1394_Responder.
respond(command, reply);
248 yCError(FRAMEGRABBER_NWS_YARP) <<
"Command not recognized" << command.
toString();
constexpr yarp::conf::vocab32_t VOCAB_RGB_VISUAL_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL_DC1394
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGERAW
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGE
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL
static constexpr double DEFAULT_THREAD_PERIOD
std::string m_capabilities
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool detach() override
Detach the object (you must have first called attach).
bool threadInit() override
Initialization method.
void run() override
Loop function.
bool close() override
Close the DeviceDriver.
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply) override
Respond to a message.
~FrameGrabber_nws_yarp() override
bool view(T *&x)
Get an interface to the device driver.
virtual bool getImage(ImageType &image)=0
Get an image from the frame grabber.
virtual yarp::os::Stamp getLastInputStamp()=0
Return the time stamp relative to the last acquisition.
A container for a device driver.
bool isValid() const
Check if device is valid.
A simple collection of objects that can be described and transmitted in a portable way.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
void promiseType(const Type &typ) override
Commit the port to a particular type of data.
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
void setReader(PortReader &reader) override
Set an external reader for port data.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void setStrict(bool strict=true) override
Call this to strictly keep all messages, or allow old ones to be quietly dropped.
int getOutputCount() override
Determine how many output connections this port has.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
bool isRunning() const
Returns true when the thread is started, false otherwise.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A base class for nested structures that can be searched.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
static Type byName(const char *name)
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
bool configure(yarp::dev::IFrameGrabberControlsDC1394 *interface)
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
bool configure(yarp::dev::IFrameGrabberControls *interface)
bool configure(yarp::dev::IFrameGrabberOf< ImageType > *interface)
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
bool configure(yarp::dev::IRgbVisualParams *interface)
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
Image class with user control of representation details.
bool swap(Image &alt)
swap operator.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
double now()
Return the current time in seconds, relative to an arbitrary starting point.