YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ImplementJointFault.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
10
11#include <cstdio>
12using namespace yarp::dev;
13using namespace yarp::os;
14
15namespace {
16YARP_LOG_COMPONENT(IMPLEMENT_LAYER_COMPONENT, "yarp.ImplementJointFault")
17}
18
20 m_helper(nullptr),
21 m_iraw(r)
22{}
23
24bool ImplementJointFault::initialize(int size, const int *amap)
25{
26 if (m_helper != nullptr) {
27 return false;
28 }
29
30 m_helper=(void *)(new ControlBoardHelper(size, amap));
31 yAssert (m_helper != nullptr);
32
33 m_buffer_ints.resize (size);
34 m_buffer_doubles.resize(size);
35
36 return true;
37}
38
43
45{
46 if (m_helper!=nullptr)
47 {
48 delete castToMapper(m_helper);
49 m_helper=nullptr;
50 }
51
52 return true;
53}
54
55ReturnValue ImplementJointFault::getLastJointFault(int j, int& fault, std::string& message)
56{
57 std::lock_guard lock(m_imp_mutex);
59
60 int k=castToMapper(m_helper)->toHw(j);
61 return m_iraw->getLastJointFaultRaw(k, fault, message);
62}
yarp::dev::ControlBoardHelper * castToMapper(void *p)
#define yAssert(x)
Definition Log.h:388
Interface for getting info about the fault which may occur on a robot.
Definition IJointFault.h:36
virtual yarp::dev::ReturnValue getLastJointFaultRaw(int j, int &mode, std::string &message)=0
std::vector< double > m_buffer_doubles
virtual ~ImplementJointFault()
Destructor.
bool uninitialize()
Clean up internal data and memory.
yarp::dev::ReturnValue getLastJointFault(int j, int &fault, std::string &message) override
ImplementJointFault(yarp::dev::IJointFaultRaw *y)
yarp::dev::IJointFaultRaw * m_iraw
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
A mini-server for performing network communication in the background.
#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.
Definition OSTestMsg.cpp:13