YARP
Yet Another Robot Platform
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
9
10#include <cstdio>
11using namespace yarp::dev;
12using namespace yarp::os;
13
14#define JOINTIDCHECK if (j >= castToMapper(helper)->axes()){yError("joint id out of bound"); return false;}
15
16ImplementJointFault::ImplementJointFault(IJointFaultRaw *r):
17 helper(nullptr),
18 raw(r)
19{}
20
21bool ImplementJointFault::initialize(int size, const int *amap)
22{
23 if (helper != nullptr) {
24 return false;
25 }
26
27 helper=(void *)(new ControlBoardHelper(size, amap));
28 yAssert (helper != nullptr);
29
30 return true;
31}
32
34{
36}
37
39{
40 if (helper!=nullptr)
41 {
42 delete castToMapper(helper);
43 helper=nullptr;
44 }
45
46 return true;
47}
48
49bool ImplementJointFault::getLastJointFault(int j, int& fault, std::string& message)
50{
52 int k=castToMapper(helper)->toHw(j);
53 return raw->getLastJointFaultRaw(k, fault, message);
54}
yarp::dev::ControlBoardHelper * castToMapper(void *p)
#define JOINTIDCHECK
#define yAssert(x)
Definition: Log.h:383
Interface for getting info about the fault which may occur on a robot.
Definition: IJointFault.h:35
virtual bool getLastJointFaultRaw(int j, int &mode, std::string &message)=0
yarp::dev::IJointFaultRaw * raw
virtual ~ImplementJointFault()
Destructor.
bool uninitialize()
Clean up internal data and memory.
bool getLastJointFault(int j, int &fault, std::string &message) override
bool initialize(int size, const int *amap)
Initialize the internal data and alloc memory.
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.