YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
laserFromPointCloud_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7#include <yarp/os/Network.h>
13
14#include <catch2/catch_amalgamated.hpp>
15#include <harness.h>
16
17using namespace yarp::dev;
18using namespace yarp::sig;
19using namespace yarp::os;
20
21TEST_CASE("dev::laserFromPointCloud", "[yarp::dev]")
22{
23 YARP_REQUIRE_PLUGIN("laserFromPointCloud", "device");
24 YARP_REQUIRE_PLUGIN("fakeDepthCamera", "device");
25 YARP_REQUIRE_PLUGIN("RGBDSensor_nws_yarp", "device");
26
27 Network::setLocalMode(true);
28
29 SECTION("Checking laserFromPointCloud device")
30 {
35
36 //open a fake source of rgbd images
37 {
38 p_rgbd_nws.put("device", "RGBDSensor_nws_yarp");
39 p_rgbd_nws.put("name", "/rgbd_nws");
40 p_rgbd_fake.put("device", "fakeDepthCamera");
41 // small values to improve valgrind speed
42 p_rgbd_fake.put("rgb_w", 32);
43 p_rgbd_fake.put("rgb_h", 24);
44 p_rgbd_fake.put("dep_w", 32);
45 p_rgbd_fake.put("dep_h", 24);
48
50
51 // attach
52 {
54 dd_rgbd_nws.view(ww_nws);
56 bool result_att = ww_nws->attach(&dd_rgbd_fake);
58 }
59 }
61
63 IRangefinder2D* irng = nullptr;
64
66 {
68 las_cfg.put("device", "laserFromPointCloud");
69 auto& rgbdprop = las_cfg.addGroup("RGBD_SENSOR_CLIENT");
70 rgbdprop.put("localImagePort", "/rgbd_nwc/rgbImage:i");
71 rgbdprop.put("remoteImagePort", "/rgbd_nws/rgbImage:o");
72 rgbdprop.put("localDepthPort", "/rgbd_nwc/depthImage:i");
73 rgbdprop.put("remoteDepthPort", "/rgbd_nws/depthImage:o");
74 rgbdprop.put("localRpcPort", "/rgbd_nwc/rpc:o");
75 rgbdprop.put("remoteRpcPort", "/rgbd_nws/rpc:i");
76 auto& qualityprop = las_cfg.addGroup("POINTCLOUD_QUALITY");
77 qualityprop.put("x_step", 1.0);
78 qualityprop.put("y_step", 1.0);
79 auto& planesprop = las_cfg.addGroup("Z_CLIPPING_PLANES");
80 planesprop.put("floor_height", 0.15);
81 planesprop.put("ceiling_height", 3.0);
82
83 auto& transfprop = las_cfg.addGroup("TRANSFORM_CLIENT");
84 transfprop.put("config_name", "ftc_local_only.xml");
85 las_cfg.put("testWithIndentityTransform", true);
86
88 REQUIRE(laserdev.view(irng));
89
91 // yarp::dev::tests::exec_params_test(&laserdev);
92 }
93
94 //execute tests
96 vals.test_scanrate=0;
97 vals.test_min=0.1;
98 vals.test_max=5.0;
99 vals.test_horizontal_res=1.0;
100 vals.test_lsize=360;
101 vals.test_rho = 2.0; //almost 2meters
102 vals.test_theta=0.0;
103 vals.test_cartesian_x= 2.0; //almost 2meters
104 vals.test_cartesian_y=0.0;
106
107 //"Close all polydrivers and check"
109 }
110
111 Network::setLocalMode(false);
112}
A generic interface for planar laser range finders.
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::laserFromPointCloud", "[yarp::dev]")
void exec_iRangefinder2D_test_1(IRangefinder2D *irf, const ValuestoCheck &v=ValuestoCheck())
void wait_safe(const double seconds)
Definition TestUtils.cpp:17
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.