YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
frameGrabber_nwc_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
10
16
17#include <yarp/os/Network.h>
18#include <yarp/sig/Image.h>
19#include <yarp/sig/Vector.h>
20#include <yarp/dev/PolyDriver.h>
22#include <yarp/os/Time.h>
23
24#include <string>
25
26#include <catch2/catch_amalgamated.hpp>
27#include <harness.h>
28
29using namespace yarp::os;
30using namespace yarp::dev;
31using namespace yarp::sig;
32
34{
41
42 p_nws.put("device", "frameGrabber_nws_yarp");
43 p_fake.put("device", "fakeFrameGrabber");
46
49
51
54 bool result_att = ww_nws->attach(&dd_fake);
56
57 p_nwc.put("device", "frameGrabber_nwc_yarp");
58 p_nwc.put("remote", "/grabber");
59 p_nwc.put("local", "/grabber/client");
60 if (!use_stream)
61 {
62 p_nwc.put("no_stream",true);
63 }
65
70
71 REQUIRE(dd_nwc.view(igrabber));
79
81 {
83 CHECK(img.width() == 0);
84 CHECK(img.height() == 0);
85 CHECK(igrabber->getImage(img));
86 CHECK(img.width() > 0);
87 CHECK(img.height() > 0);
88 }
90 {
92 std::vector<yarp::dev::VertexData> vertices;
93 vertices.resize(2);
94 vertices[0] = yarp::dev::VertexData(0, 0);
95 vertices[1] = yarp::dev::VertexData(10, 10); // Configure a doable crop.
96 CHECK(crop.width() == 0);
97 CHECK(crop.height() == 0);
98 CHECK(igrabber->getImageCrop(YARP_CROP_RECT, vertices, crop));
99 CHECK(crop.width() > 0);
100 CHECK(crop.height() > 0);
101 }
102
107
109
110 CHECK(dd_nwc.close());
111 CHECK(dd_nws.close());
113}
114
115TEST_CASE("dev::frameGrabber_nwc_yarpTest", "[yarp::dev]")
116{
117 //Test starts here. We have two main tests: with and without streaming...
118 YARP_REQUIRE_PLUGIN("fakeFrameGrabber", "device");
119 YARP_REQUIRE_PLUGIN("frameGrabber_nwc_yarp", "device");
120 YARP_REQUIRE_PLUGIN("frameGrabber_nws_yarp", "device");
121
122 Network::setLocalMode(true);
123
124 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (RPC mode)")
125 {
126 //RPCmode
127 do_nws_nwc_test(false);
128 }
129
130 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (streaming mode)")
131 {
132 //streaming mode
133 do_nws_nwc_test(true);
134 }
135
136 Network::setLocalMode(false);
137}
contains the definition of a Vector type
Control interface for frame grabber devices that conform to the 1394-based Digital Camera Specificati...
Control interface for frame grabber devices.
An interface for retrieving intrinsic parameter from a rgb camera.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Definition Property.h:32
static void delaySystem(double seconds)
TEST_CASE("dev::frameGrabber_nwc_yarpTest", "[yarp::dev]")
void do_nws_nwc_test(bool use_stream)
void exec_IFrameGrabberControlsDC1394_test_1(IFrameGrabberControlsDC1394 *ictl)
void exec_params_test(yarp::dev::PolyDriver *pdrv)
void exec_IFrameGrabberControls_test_1(IFrameGrabberControls *ictl)
void exec_IRgbVisualParams_test_1(IRgbVisualParams *irgb)
void exec_IFrameGrabberImage_test_1(IFrameGrabberImage *iframe)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.