YARP
Yet Another Robot Platform
ControlBoardWrapperAxisInfo.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
9
10
11bool ControlBoardWrapperAxisInfo::getAxisName(int j, std::string& name)
12{
13 size_t off;
14 try {
15 off = device.lut.at(j).offset;
16 } catch (...) {
17 yCError(CONTROLBOARD, "Joint number %d out of bound [0-%zu] for part %s", j, controlledJoints, partName.c_str());
18 return false;
19 }
20 size_t subIndex = device.lut[j].deviceEntry;
21
22 SubDevice* p = device.getSubdevice(subIndex);
23 if (!p) {
24 return false;
25 }
26
27 if (p->info) {
28 return p->info->getAxisName(static_cast<int>(off + p->base), name);
29 }
30 return false;
31}
32
34{
35 int off = device.lut[j].offset;
36 size_t subIndex = device.lut[j].deviceEntry;
37
38 SubDevice* p = device.getSubdevice(subIndex);
39 if (!p) {
40 return false;
41 }
42
43 if (p->info) {
44 return p->info->getJointType(static_cast<int>(off + p->base), type);
45 }
46 return false;
47}
const yarp::os::LogComponent & CONTROLBOARD()
bool getJointType(int j, yarp::dev::JointTypeEnum &type) override
bool getAxisName(int j, std::string &name) override
size_t base
Definition: SubDevice.h:55
yarp::dev::IAxisInfo * info
Definition: SubDevice.h:79
std::vector< DevicesLutEntry > lut
Definition: SubDevice.h:122
SubDevice * getSubdevice(size_t i)
Definition: SubDevice.h:125
virtual bool getAxisName(int axis, std::string &name)=0
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:55
#define yCError(component,...)
Definition: LogComponent.h:213