YARP
Yet Another Robot Platform
ControlBoardWrapperControlCalibration.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 
11 
12 bool ControlBoardWrapperControlCalibration::calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3)
13 {
14  size_t off;
15  try {
16  off = device.lut.at(j).offset;
17  } catch (...) {
18  yCError(CONTROLBOARD, "Joint number %d out of bound [0-%zu] for part %s", j, controlledJoints, partName.c_str());
19  return false;
20  }
21  size_t subIndex = device.lut[j].deviceEntry;
22 
23  SubDevice* p = device.getSubdevice(subIndex);
24  if (p && p->calib) {
25  return p->calib->calibrateAxisWithParams(static_cast<int>(off + p->base), ui, v1, v2, v3);
26  }
27  return false;
28 }
29 
30 
32 {
33  int off = device.lut[j].offset;
34  size_t subIndex = device.lut[j].deviceEntry;
35 
36  SubDevice* p = device.getSubdevice(subIndex);
37  if (p && p->calib) {
38  return p->calib->setCalibrationParameters(static_cast<int>(off + p->base), params);
39  }
40  return false;
41 }
42 
43 
45 {
46  size_t off;
47  try {
48  off = device.lut.at(j).offset;
49  } catch (...) {
50  yCError(CONTROLBOARD, "Joint number %d out of bound [0-%zu] for part %s", j, controlledJoints, partName.c_str());
51  return false;
52  }
53  size_t subIndex = device.lut[j].deviceEntry;
54 
55  SubDevice* p = device.getSubdevice(subIndex);
56  if (!p) {
57  return false;
58  }
59 
60  if (p->calib) {
61  return p->calib->calibrationDone(static_cast<int>(off + p->base));
62  }
63  return false;
64 }
65 
66 
68 {
69  yCError(CONTROLBOARD, "Calling abortPark -- not implemented");
70  return false;
71 }
72 
73 
75 {
76  yCError(CONTROLBOARD, "Calling abortCalibration -- not implemented");
77  return false;
78 }
const yarp::os::LogComponent & CONTROLBOARD()
bool calibrationDone(int j) override
Check if the calibration is terminated, on a particular joint.
bool calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3) override
Start calibration, this method is very often platform specific.
bool setCalibrationParameters(int j, const yarp::dev::CalibrationParameters &params) override
Start calibration, this method is very often platform specific.
size_t base
Definition: SubDevice.h:55
yarp::dev::IControlCalibration * calib
Definition: SubDevice.h:74
std::vector< DevicesLutEntry > lut
Definition: SubDevice.h:122
SubDevice * getSubdevice(size_t i)
Definition: SubDevice.h:125
virtual bool setCalibrationParameters(int axis, const CalibrationParameters &params)
Start calibration, this method is very often platform specific.
virtual bool calibrationDone(int j)=0
Check if the calibration is terminated, on a particular joint.
virtual bool calibrateAxisWithParams(int axis, unsigned int type, double p1, double p2, double p3)=0
Start calibration, this method is very often platform specific.
#define yCError(component,...)
Definition: LogComponent.h:154