YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
rangefinder2D_nwc_yarp_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
7#include <yarp/os/Network.h>
11
13#include <catch2/catch_amalgamated.hpp>
14#include <harness.h>
15
16using namespace yarp::dev;
17using namespace yarp::sig;
18using namespace yarp::os;
19
20TEST_CASE("dev::rangefinder2D_nwc_yarp", "[yarp::dev]")
21{
22 YARP_REQUIRE_PLUGIN("fakeLaser", "device");
23 YARP_REQUIRE_PLUGIN("rangefinder2D_nws_yarp", "device");
24 YARP_REQUIRE_PLUGIN("rangefinder2D_nwc_yarp", "device");
25
26 Network::setLocalMode(true);
27
28 SECTION("Checking rangefinder2D_nwc_yarp device")
29 {
33 IRangefinder2D* irng = nullptr;
34
36 {
38 plas_cfg.put("device", "fakeLaser");
39 plas_cfg.put("test", "use_constant");
40 Property& cm_cfg = plas_cfg.addGroup("CONSTANT_MODE");
41 cm_cfg.put("const_distance", 0.5);
43 }
44 {
46 pnws_cfg.put("device", "rangefinder2D_nws_yarp");
47 pnws_cfg.put("period", 0.010);
48 pnws_cfg.put("name", "/laser");
50 }
51
52 //attach the nws to the fakelaser device
55 bool result_att = ww_nws->attach(&ddlas);
57
58 //wait some time
60
61 //create the client
62 {
64 pnwc_cfg.put("device", "rangefinder2D_nwc_yarp");
65 pnwc_cfg.put("local", "/local_laser");
66 pnwc_cfg.put("remote", "/laser");
69 }
70 REQUIRE(ddnwc.view(irng));
71
72 //execute tests
74
75 //Close all polydrivers and check
76 CHECK(ddnwc.close());
78 INFO("rangefinder2D_nwc_yarp closed");
79
80 CHECK(ddnws.close());
82 INFO("rangefinder2D_nws_yarp closed");
83
84 CHECK(ddlas.close());
86 INFO("fakeLaser closed");
87
88 INFO("Test complete");
89 }
90
91 Network::setLocalMode(false);
92}
A generic interface for planar laser range finders.
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
void exec_iRangefinder2D_test_1(IRangefinder2D *irf, const ValuestoCheck &v=ValuestoCheck())
void exec_params_test(yarp::dev::PolyDriver *pdrv)
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.
Definition OSTestMsg.cpp:13
TEST_CASE("dev::rangefinder2D_nwc_yarp", "[yarp::dev]")
std::string INFO
Definition ymanager.cpp:54