YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
rgbdSensor_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>
11
12#include <catch2/catch_amalgamated.hpp>
13#include <harness.h>
14
15using namespace yarp::dev;
16using namespace yarp::sig;
17using namespace yarp::os;
18
19TEST_CASE("dev::Rangefinder2D_nws_ros2_test", "[yarp::dev]")
20{
21 YARP_REQUIRE_PLUGIN("fakeDepthCamera", "device");
22 YARP_REQUIRE_PLUGIN("rgbdSensor_nws_ros2", "device");
23
24 Network::setLocalMode(true);
25
26 SECTION("Checking the nws alone")
27 {
29
31 {
33 pcfg.put("device", "rgbdSensor_nws_ros2");
34 pcfg.put("node_name", "rgbd_node");
35 pcfg.put("depth_topic_name","/depth_topic");
36 pcfg.put("color_topic_name","/rgbd_topic");
37 pcfg.put("depth_frame_id","depthframe");
38 pcfg.put("color_frame_id","colorframe");
40 }
41
42 //"Close all polydrivers and check"
43 {
44 CHECK(ddnws.close());
45 }
46 }
47
48 SECTION("Checking the nws attached to device")
49 {
53
55 {
57 pcfg.put("device", "rgbdSensor_nws_ros2");
58 pcfg.put("node_name", "rgbd_node");
59 pcfg.put("depth_topic_name","/depth_topic");
60 pcfg.put("color_topic_name","/rgbd_topic");
61 pcfg.put("depth_frame_id","depthframe");
62 pcfg.put("color_frame_id","colorframe");
64 }
65
67 {
69 pcfg_fake.put("device", "fakeDepthCamera");
71 }
72
73 //attach the nws to the fake device
74 {
75 ddnws.view(ww_nws);
76 bool result_att = ww_nws->attach(&ddfake);
78 }
79
80 //"Close all polydrivers and check"
81 {
82 CHECK(ddnws.close());
84 }
85 }
86
87 Network::setLocalMode(false);
88}
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.
Definition jointData.cpp:13
An interface to the operating system, including Port based communication.
TEST_CASE("dev::Rangefinder2D_nws_ros2_test", "[yarp::dev]")