YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
odometry2D_nwc_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7#include <yarp/os/Network.h>
12
13#include <catch2/catch_amalgamated.hpp>
14#include <harness.h>
15
16using namespace yarp::dev;
17using namespace yarp::os;
18
19TEST_CASE("dev::odometry2D_nwc_yarp", "[yarp::dev]")
20{
21 YARP_REQUIRE_PLUGIN("fakeOdometry2D", "device");
22 YARP_REQUIRE_PLUGIN("odometry2D_nws_yarp", "device");
23 YARP_REQUIRE_PLUGIN("odometry2D_nwc_yarp", "device");
24
25 Network::setLocalMode(true);
26
27 SECTION("Checking odometry2D_nwc_yarp device")
28 {
32 Nav2D::IOdometry2D* iodom = nullptr;
33
35 {
37 plas_cfg.put("device", "fakeOdometry2D");
40 }
41 {
43 pnws_cfg.put("device", "odometry2D_nws_yarp");
44 pnws_cfg.put("period", 0.010);
45 pnws_cfg.put("name", "/odom");
48 }
49
50 //attach the nws to the fakeOdometry2D device
53 bool result_att = ww_nws->attach(&ddlas);
55
56 //wait some time
58
59 //create the client
60 {
62 pnwc_cfg.put("device", "odometry2D_nwc_yarp");
63 pnwc_cfg.put("local", "/local_odom");
64 pnwc_cfg.put("remote", "/odom");
67 }
68 REQUIRE(ddnwc.view(iodom));
69
70 //execute tests
72
73 //Close all polydrivers and check
74 CHECK(ddnwc.close());
76 INFO("odometry2D_nwc_yarp closed");
77
78 CHECK(ddnws.close());
80 INFO("odometry2D_nws_yarp closed");
81
82 CHECK(ddlas.close());
84 INFO("fakeOdometry2D closed");
85
86 INFO("Test complete");
87 }
88
89 Network::setLocalMode(false);
90}
IOdometry2D interface.
Definition IOdometry2D.h:23
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:32
void exec_params_test(yarp::dev::PolyDriver *pdrv)
void exec_iOdometry2D_test_1(yarp::dev::Nav2D::IOdometry2D *iodom)
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.
TEST_CASE("dev::odometry2D_nwc_yarp", "[yarp::dev]")
std::string INFO
Definition ymanager.cpp:54