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
8
11
12#include <yarp/os/Network.h>
13#include <yarp/sig/Image.h>
14#include <yarp/sig/Vector.h>
15#include <yarp/dev/PolyDriver.h>
17#include <yarp/os/Time.h>
18
19#include <string>
20
21#include <catch2/catch_amalgamated.hpp>
22#include <harness.h>
23
24using namespace yarp::os;
25using namespace yarp::dev;
26using namespace yarp::sig;
27
29{
36
37 p_nws.put("device", "frameGrabber_nws_yarp");
38 p_fake.put("device", "fakeFrameGrabber");
42
45 bool result_att = ww_nws->attach(&dd_fake);
47
48 p_nwc.put("device", "frameGrabber_nwc_yarp");
49 p_nwc.put("remote", "/grabber");
50 p_nwc.put("local", "/grabber/client");
51 if (!use_stream) {p_nwc.put("no_stream",true);}
53
56 REQUIRE(dd_nwc.view(igrabber));
60
62 {
64 CHECK(img.width() == 0);
65 CHECK(img.height() == 0);
66 igrabber->getImage(img);
67 CHECK(img.width() > 0);
68 CHECK(img.height() > 0);
69 }
71 {
74 vertices.resize(2);
75 vertices[0] = std::pair <int, int>(0, 0);
76 vertices[1] = std::pair <int, int>(10, 10); // Configure a doable crop.
77 CHECK(crop.width() == 0);
78 CHECK(crop.height() == 0);
79 CHECK(igrabber->getImageCrop(YARP_CROP_RECT, vertices, crop));
80 CHECK(crop.width() > 0);
81 CHECK(crop.height() > 0);
82 }
83
86
88
92}
93
94TEST_CASE("dev::frameGrabber_nwc_yarpTest", "[yarp::dev]")
95{
96 YARP_REQUIRE_PLUGIN("fakeFrameGrabber", "device");
97 YARP_REQUIRE_PLUGIN("frameGrabber_nwc_yarp", "device");
98 YARP_REQUIRE_PLUGIN("frameGrabber_nws_yarp", "device");
99
100 Network::setLocalMode(true);
101
102 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (RPC mode)")
103 {
104 do_nws_nwc_test(false);
105 }
106
107 SECTION("Test the frameGrabber_nwc_yarp device with a frameGrabber_nws_yarp device (streaming mode)")
108 {
109 do_nws_nwc_test(true);
110 }
111
112 Network::setLocalMode(false);
113}
@ YARP_CROP_RECT
contains the definition of a Vector type
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_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.