YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
odometry2D_nws_ros2_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <yarp/os/Network.h>
9
10#include <catch2/catch_amalgamated.hpp>
11#include <harness.h>
12
13using namespace yarp::dev;
14using namespace yarp::os;
15
16TEST_CASE("dev::odometry2D_nws_ros2_test", "[yarp::dev]")
17{
18 YARP_REQUIRE_PLUGIN("odometry2D_nws_ros2", "device");
19 YARP_REQUIRE_PLUGIN("fakeOdometry2D", "device");
20
21 Network::setLocalMode(true);
22
23 SECTION("Checking the nws alone")
24 {
26
28 {
30 pcfg.put("device", "odometry2D_nws_ros2");
31 pcfg.put("node_name", "odometry_node");
32 pcfg.put("topic_name","/robot_odometry");
33 pcfg.put("odom_frame","odometry_frame");
34 pcfg.put("base_frame","base_frame");
36 }
37
38 //"Close all polydrivers and check"
39 {
40 CHECK(ddnws.close());
41 }
42 }
43
44 SECTION("Checking the nws attached to device")
45 {
49
51 {
53 pcfg.put("device", "odometry2D_nws_ros2");
54 pcfg.put("node_name", "odometry_node");
55 pcfg.put("topic_name","/robot_odometry");
56 pcfg.put("odom_frame","odometry_frame");
57 pcfg.put("base_frame","base_frame");
59 }
60
62 {
64 pcfg_fake.put("device", "fakeOdometry2D");
66 }
67
68 //attach the nws to the fake device
69 {
70 ddnws.view(ww_nws);
71 bool result_att = ww_nws->attach(&ddfake);
73 }
74
75 //"Close all polydrivers and check"
76 {
77 CHECK(ddnws.close());
79 }
80 }
81
82 Network::setLocalMode(false);
83}
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
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
TEST_CASE("dev::odometry2D_nws_ros2_test", "[yarp::dev]")