YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
mobileBaseVelocityControl_nwc_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7#include <yarp/os/Network.h>
11
12#include <catch2/catch_amalgamated.hpp>
13#include <harness.h>
14
15using namespace yarp::dev;
16using namespace yarp::os;
17
18TEST_CASE("dev::mobileBaseVelocityControl_nws_yarp", "[yarp::dev]")
19{
20 YARP_REQUIRE_PLUGIN("fakeNavigation", "device");
21 YARP_REQUIRE_PLUGIN("mobileBaseVelocityControl_nws_yarp", "device");
22 YARP_REQUIRE_PLUGIN("mobileBaseVelocityControl_nwc_yarp", "device");
23
24 Network::setLocalMode(true);
25
26 SECTION("Checking mobileBaseVelocityControl_nwc_yarp device")
27 {
32
34 {
36 pnws_cfg.put("device", "mobileBaseVelocityControl_nws_yarp");
37 pnws_cfg.put("local", "/mobileBaseVelocityControl_nws_yarp");
40
42 pdev_cfg.put("device", "fakeNavigation");
45
48 bool result_att = ww_nws->attach(&ddfake);
50
52 pclient_cfg.put("device", "mobileBaseVelocityControl_nwc_yarp");
53 pclient_cfg.put("local", "/mobileBaseVelocityControl_nwc_yarp");
54 pclient_cfg.put("server", "/mobileBaseVelocityControl_nws_yarp");
57
58 REQUIRE(ddnwc.view(ivel));
59 }
60
62
63 CHECK (ivel->applyVelocityCommand(1,2,3,10));
64 double x=0; double y=0; double t=0;
65 CHECK( ivel->getLastVelocityCommand(x,y,t));
66 CHECK(x == 1);
67 CHECK(y == 2);
68 CHECK(t == 3);
69
70 //"Close all polydrivers and check"
71 {
72 CHECK(ddnwc.close());
73 CHECK(ddnws.close());
75 }
76 }
77
78 Network::setLocalMode(false);
79}
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
TEST_CASE("dev::mobileBaseVelocityControl_nws_yarp", "[yarp::dev]")
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