YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeCalibrator.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026-2026 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <yarp/os/Time.h>
8
9#include "FakeCalibrator.h"
10
11#include <yarp/os/LogStream.h>
12
13using namespace yarp::os;
14using namespace yarp::dev;
15
16namespace {
17YARP_LOG_COMPONENT(FAKECALIBRATOR, "yarp.device.fakeCalibrator")
18}
19
23
29
31{
32 return true;
33}
34
36{
37 yTrace();
38 return true;
39}
40
42{
43 yTrace();
44
45 if (device==nullptr)
46 {
47 yCError(FAKECALIBRATOR) << "calibrate: invalid device driver";
49 }
50
51 yarp::dev::PolyDriver *p = dynamic_cast<yarp::dev::PolyDriver *>(device);
52 m_dev2calibrate = p;
53 if (p!=nullptr)
54 {
55 p->view(m_iControlCalibration);
56 p->view(m_iEncoders);
57 }
58 else
59 {
60 yCWarning(FAKECALIBRATOR) << "calibrate: using parametricCalibrator on an old iCubInterface system. Upgrade to robotInterface is recommended.";
61 device->view(m_iControlCalibration);
62 device->view(m_iEncoders);
63 }
64
65 if (!(m_iControlCalibration && m_iEncoders))
66 {
67 yCError(FAKECALIBRATOR) << "calibrate: interface not found";
69 }
70
71 return ReturnValue_ok;
72}
73
75{
76 if (dd==nullptr)
77 {
78 yCError(FAKECALIBRATOR) << "park: invalid device driver";
80 }
81
82 return ReturnValue_ok;
83}
84
89
94
99
101{
102 if (m_iControlCalibration == nullptr)
103 {
104 yCError(FAKECALIBRATOR) << "calibrateSingleJoint: invalid device driver";
106 }
107
108 auto b = m_iControlCalibration->setCalibrationParameters(j, m_cparams);
109 return b;
110}
111
117
123
129
135
136// called from motorgui or remote devices
138{
139 yTrace();
140 return park(m_dev2calibrate);
141}
#define yTrace(...)
Definition Log.h:231
#define ReturnValue_ok
Definition ReturnValue.h:82
#define ReturnValue_error_method_failed
Definition ReturnValue.h:87
#define ReturnValue_error_not_ready
Definition ReturnValue.h:88
yarp::dev::ReturnValue parkWholePart() override
parkWholePart: start the parking procedure for the whole part
yarp::dev::ReturnValue homingWholePart() override
homingWholePart: call the homing procedure for a the whole part/device
yarp::dev::ReturnValue calibrate(DeviceDriver *device) override
Calibrate method.
yarp::dev::ReturnValue parkSingleJoint(int j, bool _wait=true) override
parkSingleJoint(): start the parking procedure for the single joint
virtual bool open(yarp::os::Searchable &config) override
Open the device driver.
yarp::dev::ReturnValue calibrateWholePart() override
calibrateWholePart: call the procedure for calibrating the whole device
yarp::dev::ReturnValue homingSingleJoint(int j) override
homingSingleJoint: call the homing procedure for a single joint
yarp::dev::ReturnValue quitCalibrate() override
virtual bool close() override
Close the device driver.
yarp::dev::ReturnValue calibrateSingleJoint(int j) override
calibrateSingleJoint: call the calibration procedure for the single joint
yarp::dev::IRemoteCalibrator * getCalibratorDevice() override
getCalibratorDevice: return the pointer stored with the setCalibratorDevice
FakeCalibrator()
Default constructor.
yarp::dev::ReturnValue park(DeviceDriver *dd, bool wait=true) override
~FakeCalibrator()
Destructor.
yarp::dev::ReturnValue quitPark() override
Interface implemented by all device drivers.
bool view(T *&x)
Get an interface to the device driver.
virtual yarp::dev::ReturnValue setCalibrationParameters(int axis, const CalibrationParameters &params)=0
Start calibration, this method is very often platform specific.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
A container for a device driver.
Definition PolyDriver.h:23
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
#define yCError(component,...)
#define yCWarning(component,...)
#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