YARP
Yet Another Robot Platform
ControlBoardWrapperControlCalibration.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
10 
12 
14 
15 bool ControlBoardWrapperControlCalibration::calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3)
16 {
17  size_t off;
18  try {
19  off = device.lut.at(j).offset;
20  } catch (...) {
21  yCError(CONTROLBOARDWRAPPER, "Joint number %d out of bound [0-%zu] for part %s", j, controlledJoints, partName.c_str());
22  return false;
23  }
24  size_t subIndex = device.lut[j].deviceEntry;
25 
26  SubDevice* p = device.getSubdevice(subIndex);
27  if (p && p->calib) {
28  return p->calib->calibrateAxisWithParams(static_cast<int>(off + p->base), ui, v1, v2, v3);
29  }
30  return false;
31 }
32 
33 
35 {
36  int off = device.lut[j].offset;
37  size_t subIndex = device.lut[j].deviceEntry;
38 
39  SubDevice* p = device.getSubdevice(subIndex);
40  if (p && p->calib) {
41  return p->calib->setCalibrationParameters(static_cast<int>(off + p->base), params);
42  }
43  return false;
44 }
45 
46 
48 {
49  size_t off;
50  try {
51  off = device.lut.at(j).offset;
52  } catch (...) {
53  yCError(CONTROLBOARDWRAPPER, "Joint number %d out of bound [0-%zu] for part %s", j, controlledJoints, partName.c_str());
54  return false;
55  }
56  size_t subIndex = device.lut[j].deviceEntry;
57 
58  SubDevice* p = device.getSubdevice(subIndex);
59  if (!p) {
60  return false;
61  }
62 
63  if (p->calib) {
64  return p->calib->calibrationDone(static_cast<int>(off + p->base));
65  }
66  return false;
67 }
68 
69 
71 {
72  yCError(CONTROLBOARDWRAPPER, "Calling abortPark -- not implemented");
73  return false;
74 }
75 
76 
78 {
79  yCError(CONTROLBOARDWRAPPER, "Calling abortCalibration -- not implemented");
80  return false;
81 }
ControlBoardWrapperControlCalibration::calibrationDone
bool calibrationDone(int j) override
Check if the calibration is terminated, on a particular joint.
Definition: ControlBoardWrapperControlCalibration.cpp:47
ControlBoardWrapperLogComponent.h
ControlBoardWrapperControlCalibration::abortPark
bool abortPark() override
Definition: ControlBoardWrapperControlCalibration.cpp:70
ControlBoardWrapperControlCalibration::abortCalibration
bool abortCalibration() override
Definition: ControlBoardWrapperControlCalibration.cpp:77
SubDevice::calib
yarp::dev::IControlCalibration * calib
Definition: SubDevice.h:77
CONTROLBOARDWRAPPER
const yarp::os::LogComponent & CONTROLBOARDWRAPPER()
Definition: ControlBoardWrapperLogComponent.cpp:11
ControlBoardWrapperCommon::partName
std::string partName
Definition: ControlBoardWrapperCommon.h:24
ControlBoardWrapperCommon::controlledJoints
size_t controlledJoints
Definition: ControlBoardWrapperCommon.h:23
yarp::dev::IControlCalibration::setCalibrationParameters
virtual bool setCalibrationParameters(int axis, const CalibrationParameters &params)
Start calibration, this method is very often platform specific.
Definition: IControlCalibration.h:108
WrappedDevice::getSubdevice
SubDevice * getSubdevice(size_t i)
Definition: SubDevice.h:129
yarp::dev::IControlCalibration::calibrateAxisWithParams
virtual bool calibrateAxisWithParams(int axis, unsigned int type, double p1, double p2, double p3)=0
Start calibration, this method is very often platform specific.
ControlBoardWrapperControlCalibration.h
ControlBoardWrapperCommon::device
WrappedDevice device
Definition: ControlBoardWrapperCommon.h:22
yarp::dev::IControlCalibration::calibrationDone
virtual bool calibrationDone(int j)=0
Check if the calibration is terminated, on a particular joint.
yCError
#define yCError(component,...)
Definition: LogComponent.h:157
ControlBoardWrapperControlCalibration::setCalibrationParameters
bool setCalibrationParameters(int j, const yarp::dev::CalibrationParameters &params) override
Start calibration, this method is very often platform specific.
Definition: ControlBoardWrapperControlCalibration.cpp:34
SubDevice::base
size_t base
Definition: SubDevice.h:58
WrappedDevice::lut
std::vector< DevicesLutEntry > lut
Definition: SubDevice.h:126
yarp::dev::CalibrationParameters
Definition: IControlCalibration.h:32
ControlBoardWrapperControlCalibration::calibrateAxisWithParams
bool calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3) override
Start calibration, this method is very often platform specific.
Definition: ControlBoardWrapperControlCalibration.cpp:15
SubDevice
Definition: SubDevice.h:55