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
15
16#include <yarp/os/Network.h>
17#include <yarp/sig/Image.h>
18#include <yarp/sig/Vector.h>
19#include <yarp/dev/PolyDriver.h>
21#include <yarp/os/Time.h>
22
23#include <string>
24
25#include <catch2/catch_amalgamated.hpp>
26#include <harness.h>
27
28using namespace yarp::os;
29using namespace yarp::dev;
30using namespace yarp::sig;
31
33{
40
41 p_nws.put("device", "frameGrabber_nws_yarp");
42 p_fake.put("device", "fakeFrameGrabber");
46
49 bool result_att = ww_nws->attach(&dd_fake);
51
52 p_nwc.put("device", "frameGrabber_nwc_yarp");
53 p_nwc.put("remote", "/grabber");
54 p_nwc.put("local", "/grabber/client");
55 if (!use_stream)
56 {
57 p_nwc.put("no_stream",true);
58 }
60
65
66 REQUIRE(dd_nwc.view(igrabber));
74
76 {
78 CHECK(img.width() == 0);
79 CHECK(img.height() == 0);
80 CHECK(igrabber->getImage(img));
81 CHECK(img.width() > 0);
82 CHECK(img.height() > 0);
83 }
85 {
87 std::vector<yarp::dev::vertex_t> vertices;
88 vertices.resize(2);
89 vertices[0] = yarp::dev::vertex_t(0, 0);
90 vertices[1] = yarp::dev::vertex_t(10, 10); // Configure a doable crop.
91 CHECK(crop.width() == 0);
92 CHECK(crop.height() == 0);
93 CHECK(igrabber->getImageCrop(YARP_CROP_RECT, vertices, crop));
94 CHECK(crop.width() > 0);
95 CHECK(crop.height() > 0);
96 }
97
102
104
105 CHECK(dd_nwc.close());
106 CHECK(dd_nws.close());
108}
109
110TEST_CASE("dev::frameGrabber_nwc_yarpTest", "[yarp::dev]")
111{
112 //Test starts here. We have two main tests: with and without streaming...
113 YARP_REQUIRE_PLUGIN("fakeFrameGrabber", "device");
114 YARP_REQUIRE_PLUGIN("frameGrabber_nwc_yarp", "device");
115 YARP_REQUIRE_PLUGIN("frameGrabber_nws_yarp", "device");
116
117 Network::setLocalMode(true);
118
119 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (RPC mode)")
120 {
121 //RPCmode
122 do_nws_nwc_test(false);
123 }
124
125 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (streaming mode)")
126 {
127 //streaming mode
128 do_nws_nwc_test(true);
129 }
130
131 Network::setLocalMode(false);
132}
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:33
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_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.