YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
laserFromDepth_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::laserFromDepth", "[yarp::dev]")
22{
23 YARP_REQUIRE_PLUGIN("laserFromDepth", "device");
24 YARP_REQUIRE_PLUGIN("fakeDepthCamera", "device");
25 YARP_REQUIRE_PLUGIN("RGBDSensor_nws_yarp", "device");
26
27 Network::setLocalMode(true);
28
29 SECTION("Checking laserFromDepth device")
30 {
35
36 //open a fake source of rgbd images
37 {
38 p_rgbd_fake.put("device", "fakeDepthCamera");
39 // small values to improve valgrind speed
40 p_rgbd_fake.put("rgb_w", 32);
41 p_rgbd_fake.put("rgb_h", 24);
42 p_rgbd_fake.put("dep_w", 32);
43 p_rgbd_fake.put("dep_h", 24);
45
46 p_rgbd_nws.put("device", "RGBDSensor_nws_yarp");
47 p_rgbd_nws.put("name", "/rgbd_nws");
49
51
52 // attach
53 {
55 dd_rgbd_nws.view(ww_nws);
57 bool result_att = ww_nws->attach(&dd_rgbd_fake);
59 }
60 }
61
63 IRangefinder2D* irng = nullptr;
64
66 {
68 las_cfg.put("device", "laserFromDepth");
69
70 auto& rgbdprop = las_cfg.addGroup("RGBD_SENSOR_CLIENT");
71 rgbdprop.put("localImagePort", "/rgbd_nwc/rgbImage:i");
72 rgbdprop.put("remoteImagePort", "/rgbd_nws/rgbImage:o");
73 rgbdprop.put("localDepthPort", "/rgbd_nwc/depthImage:i");
74 rgbdprop.put("remoteDepthPort", "/rgbd_nws/depthImage:o");
75 rgbdprop.put("localRpcPort", "/rgbd_nwc/rpc:o");
76 rgbdprop.put("remoteRpcPort", "/rgbd_nws/rpc:i");
77
79 REQUIRE(laserdev.view(irng));
80 }
81 //@@@not available yet
82 //yarp::dev::tests::exec_params_test(&laserdev);
83
84 //execute tests
86 vals.test_scanrate=0;
87 vals.test_min=0.1;
88 vals.test_max=2.5;
89 vals.test_horizontal_res=1.125;
90 vals.test_lsize=32;
91 vals.test_rho = 2.08999; //almost 2m //(small difference due to camera distortion)
92 vals.test_theta=-0.31415926535897931; //-18dgrees
93 vals.test_cartesian_x=1.9877; // a little smaller than 2meters
94 vals.test_cartesian_y=-0.645844; // a little on the left of the center
95 vals.min_angle=-18;
96 vals.max_angle=18;
98
99 //"Close all polydrivers and check"
101 }
102
103 Network::setLocalMode(false);
104}
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::laserFromDepth", "[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.