YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformGetMultiplexer.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
6/*
7 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
12
14#include <yarp/os/LogStream.h>
15
16using namespace yarp::sig;
17using namespace yarp::dev;
18using namespace yarp::os;
19
20YARP_LOG_COMPONENT(FRAMETRANSFORMGETMULTIPLEXER, "yarp.devices.FrameTransformGetMultiplexer")
21
22
23
25{
27 yCError(FRAMETRANSFORMGETMULTIPLEXER,"Error! YARP Network is not initialized");
28 return false;
29 }
30 return true;
31}
32
33
34
36{
37 m_iFrameTransformStorageGetList.clear();
38 return true;
39}
40
41
43{
45 detachAll();
46 return true;
47}
48
49
51{
52 for (int i = 0; i < devices2attach.size(); i++)
53 {
55 if (polyDriverLocal->isValid())
56 {
59 {
60 m_iFrameTransformStorageGetList.push_back(iFrameTransformStorageGet);
61 }
62 else
63 {
64 yCError(FRAMETRANSFORMGETMULTIPLEXER) << "failed to attach all the devices";
65 return false;
66 }
67 }
68 else
69 {
70 yCError(FRAMETRANSFORMGETMULTIPLEXER) << "polydriver not valid";
71 return false;
72 }
73 }
74 return true;
75}
76
77
78yarp::dev::ReturnValue FrameTransformGetMultiplexer::getTransforms(std::vector<yarp::math::FrameTransform>& transforms) const
79{
80 for (size_t i = 0; i < m_iFrameTransformStorageGetList.size(); i++)
81 {
82 if (m_iFrameTransformStorageGetList[i] != nullptr) {
83 std::vector<yarp::math::FrameTransform> localTransform;
84 m_iFrameTransformStorageGetList[i]->getTransforms(localTransform);
85 transforms.insert(transforms.end(),
86 localTransform.begin(),
87 localTransform.end());
88 }
89 else
90 {
91 yCError(FRAMETRANSFORMGETMULTIPLEXER) << "pointer to interface IFrameTransformStorageGet not valid";
92 return ReturnValue::return_code::return_value_error_method_failed;
93 }
94 }
95 return ReturnValue_ok;
96}
const yarp::os::LogComponent & FRAMETRANSFORMGETMULTIPLEXER()
#define ReturnValue_ok
Definition ReturnValue.h:77
A multiplexer which collapses the output of many IFrameTransformStorageGet interfaces into one.
bool close() override
Close the DeviceDriver.
bool detachAll() override
Detach the object (you must have first called attach).
bool attachAll(const yarp::dev::PolyDriverList &devices2attach) override
Attach to a list of objects.
yarp::dev::ReturnValue getTransforms(std::vector< yarp::math::FrameTransform > &transforms) const override
Obtains all frame transforms saved in a storage.
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
static bool checkNetwork()
Check if the YARP Network is up and running.
Definition Network.cpp:1370
A base class for nested structures that can be searched.
Definition Searchable.h:31
#define yCError(component,...)
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.
Definition dirs.h:16