YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
hapticDevice_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::hapticDevice_nws_ros2_test", "[yarp::dev]")
17{
18 YARP_REQUIRE_PLUGIN("hapticDevice_nws_ros2", "device");
19
20 Network::setLocalMode(true);
21
22 SECTION("Checking the nws alone")
23 {
25
26 // Checking opening nws
27 {
29 pcfg.put("device", "hapticDevice_nws_ros2");
30 pcfg.put("node_name", "haptic_node");
31 pcfg.put("topic_name", "hapticDevice_nws_ros2/haptic");
33 }
34
35 // Close and check
36 {
37 CHECK(ddnws.close());
38 }
39 }
40
41 SECTION("Checking attach with invalid device")
42 {
45
46 // Open nws
47 {
49 pcfg.put("device", "hapticDevice_nws_ros2");
50 pcfg.put("node_name", "haptic_node");
51 pcfg.put("topic_name", "hapticDevice_nws_ros2/haptic");
53 }
54
55 // Attach with nullptr should fail
56 {
57 ddnws.view(ww_nws);
58 REQUIRE(ww_nws != nullptr);
59 bool result_att = ww_nws->attach(nullptr);
61 }
62
63 // Close and check
64 {
65 CHECK(ddnws.close());
66 }
67 }
68
69 Network::setLocalMode(false);
70}
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
TEST_CASE("dev::hapticDevice_nws_ros2_test", "[yarp::dev]")
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.