YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RGBDSensorClient_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <yarp/os/Network.h>
11
12#include <catch2/catch_amalgamated.hpp>
13#include <harness.h>
14
15using namespace yarp::dev;
16using namespace yarp::sig;
17using namespace yarp::os;
18
19TEST_CASE("dev::RGBDSensorClientTest", "[yarp::dev]")
20{
21 YARP_REQUIRE_PLUGIN("fakeDepthCamera", "device");
22 YARP_REQUIRE_PLUGIN("rgbdSensor_nws_yarp", "device");
23 YARP_REQUIRE_PLUGIN("RGBDSensorClient", "device");
24
25 Network::setLocalMode(true);
26
27 SECTION("Checking RGBDSensorClient device")
28 {
32 IRGBDSensor* irgbd = nullptr;
33
35 {
37 pdepth_cfg.put("device", "fakeDepthCamera");
38 pdepth_cfg.put("width", 32); //smaller frame to improve valgrind speed
39 pdepth_cfg.put("height", 24); //smaller frame to improve valgrind speed
41 }
42 {
44 pnws_cfg.put("device", "rgbdSensor_nws_yarp");
45 pnws_cfg.put("name", "/rgbd_nws");
47 }
48
49 //attach the nws to the fakeDepthCamera device
52 bool result_att = ww_nws->attach(&dddepth);
54
55 //wait some time
57 INFO("rgbdSensor_nws_yarp and fakeDepthCamera ready");
58
59 //create the client
60 {
62 pnwc_cfg.put("device", "RGBDSensorClient");
63 pnwc_cfg.put("localImagePort", "/rgbd_nwc/rgbImage:i");
64 pnwc_cfg.put("remoteImagePort", "/rgbd_nws/rgbImage:o");
65
66 pnwc_cfg.put("localDepthPort", "/rgbd_nwc/depthImage:i");
67 pnwc_cfg.put("remoteDepthPort", "/rgbd_nws/depthImage:o");
68
69 pnwc_cfg.put("localRpcPort", "/rgbd_nwc/rpc:o");
70 pnwc_cfg.put("remoteRpcPort", "/rgbd_nws/rpc:i");
71
72 //beware: default carrier is udp, but we do not want to use it for tests
73 //since it may fail on the cloud CI.
74 pnwc_cfg.put("ImageCarrier", "tcp");
75 pnwc_cfg.put("DepthCarrier", "tcp");
77 }
78 REQUIRE(ddnwc.view(irgbd));
79
80 //execute tests
82
83 //Close all polydrivers and check
84 CHECK(ddnwc.close());
86 INFO("RGBDSensorClient closed");
87
88 CHECK(ddnws.close());
90 INFO("rgbdSensor_nws_yarp closed");
91
94 INFO("fakeDepthCamera closed");
95
96 INFO("Test complete");
97 }
98
99 Network::setLocalMode(false);
100}
TEST_CASE("dev::RGBDSensorClientTest", "[yarp::dev]")
A generic interface for cameras that have both color camera as well as depth camera sensor,...
Definition IRGBDSensor.h:39
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)
void exec_iRGBDSensor_test_1(IRGBDSensor *irgbd)
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
An interface to the operating system, including Port based communication.
std::string INFO
Definition ymanager.cpp:51