YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ControlBoardRemapperHelpers.h
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
6#ifndef YARP_DEV_CONTROLBOARDREMAPPER_CONTROLBOARDREMAPPERHELPERS_H
7#define YARP_DEV_CONTROLBOARDREMAPPER_CONTROLBOARDREMAPPERHELPERS_H
8
9
12#include <yarp/os/Time.h>
13#include <yarp/os/Network.h>
14#include <yarp/os/Stamp.h>
15#include <yarp/os/Vocab.h>
16
20#include <yarp/dev/PolyDriver.h>
23
24
25#include <yarp/sig/Vector.h>
26
27#include <mutex>
28#include <string>
29#include <vector>
30
31
32#ifdef MSVC
33 #pragma warning(disable:4355)
34#endif
35
36/*
37 * Helper class for the ControlBoardRemapper.
38 * It contains all the data structure related
39 * to a given controlboard used by the remapper.
40 */
83
89{
90public:
96
101};
102
104{
105public:
109 std::vector<RemappedSubControlBoard> subdevices;
110
114 std::vector<RemappedAxis> lut;
115
123 {
124 return &(subdevices[i]);
125 }
126
128 {
129 return subdevices.size();
130 }
131
132 size_t getNrOfRemappedAxes() const
133 {
134 return lut.size();
135 }
136};
137
139{
140public:
141 std::mutex mutex;
142 std::vector<int> controlBoardModes;
143 std::vector<double> dummyBuffer;
145
146};
147
156{
157public:
162 bool configure(const RemappedControlBoards & remappedControlBoards);
163
168 void fillSubControlBoardBuffersFromCompleteJointVector(const double * full, const RemappedControlBoards & remappedControlBoards);
169
170
177 const RemappedControlBoards & remappedControlBoards);
178
186 const RemappedControlBoards & remappedControlBoards);
187
192 void fillCompleteJointVectorFromSubControlBoardBuffers(double * full, const RemappedControlBoards & remappedControlBoards);
193
202 const RemappedControlBoards & remappedControlBoards);
203
212 const RemappedControlBoards & remappedControlBoards);
213
214
218 std::mutex mutex;
219
220 // Buffer to be used in MultiJoint version of the
223 std::vector< std::vector<int> > m_jointsInSubControlBoard;
224
225
226 std::vector< std::vector<double> > m_bufferForSubControlBoard;
227 std::vector< std::vector<int> > m_bufferForSubControlBoardControlModes;
228 std::vector< std::vector<yarp::dev::InteractionModeEnum> > m_bufferForSubControlBoardInteractionModes;
229
230 std::vector<int> m_counterForControlBoard;
231};
232
243{
248 void createListOfJointsDecomposition(const int n_joints, const int *joints, const RemappedControlBoards & remappedControlBoards);
249
250public:
255 bool configure(const RemappedControlBoards & remappedControlBoards);
256
257
262 void fillSubControlBoardBuffersFromArbitraryJointVector(const double * arbitraryVec,
263 const int n_joints,
264 const int *joints,
265 const RemappedControlBoards & remappedControlBoards);
266
272 void fillSubControlBoardBuffersFromArbitraryJointVector(const int * arbitraryVec,
273 const int n_joints,
274 const int *joints,
275 const RemappedControlBoards & remappedControlBoards);
276
283 const int n_joints,
284 const int *joints,
285 const RemappedControlBoards & remappedControlBoards);
286
291 void resizeSubControlBoardBuffers(const int n_joints,
292 const int *joints,
293 const RemappedControlBoards & remappedControlBoards);
294
302 const int n_joints, const int *joints,
303 const RemappedControlBoards & remappedControlBoards);
304
313 const int n_joints, const int *joints,
314 const RemappedControlBoards & remappedControlBoards);
315
324 const int n_joints, const int *joints,
325 const RemappedControlBoards & remappedControlBoards);
326
330 std::mutex mutex;
331
332 // Total number of axes in the remapped controlboard
334
335 // Vector of size getNrOfSubControlBoards
337 std::vector< std::vector<int> > m_jointsInSubControlBoard;
338
339 // Buffers for the control board (the size of each one should
340 // match the size of m_nJointsInSubControlBoard[ctrlBoard] and
341 // the size of m_jointsInSubControlBoard[ctrlBoard].size()
342 std::vector< std::vector<double> > m_bufferForSubControlBoard;
343 std::vector< std::vector<int> > m_bufferForSubControlBoardControlModes;
344 std::vector< std::vector<yarp::dev::InteractionModeEnum> > m_bufferForSubControlBoardInteractionModes;
345
346
347 // Counter used when converting a full vector to
348 // the subcontrolboard buffers
349 std::vector<int> m_counterForControlBoard;
350};
351
352#endif // YARP_DEV_CONTROLBOARDREMAPPER_CONTROLBOARDREMAPPERHELPERS_H
define control board standard interfaces
define control board standard interfaces
contains the definition of a Vector type
Class storing the decomposition of a subset of the total remapped axes of the remapped controlboard i...
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
std::vector< std::vector< double > > m_bufferForSubControlBoard
std::vector< std::vector< yarp::dev::InteractionModeEnum > > m_bufferForSubControlBoardInteractionModes
void fillSubControlBoardBuffersFromArbitraryJointVector(const double *arbitraryVec, const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Fill buffers for the SubControlBoard from a vector of joints of the RemappedControlBoards.
std::vector< std::vector< int > > m_jointsInSubControlBoard
void resizeSubControlBoardBuffers(const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Resize buffers to have the dimension of specified by the method (used for multi joint methods that re...
std::vector< std::vector< int > > m_bufferForSubControlBoardControlModes
void fillArbitraryJointVectorFromSubControlBoardBuffers(double *arbitraryVec, const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Fill a vector of joints of the ControlBoardRemapper from the buffers of the SubControlBoard .
std::mutex mutex
Mutex to grab to use this class.
Class storing the decomposition of all the axes in the Remapped ControlBoard in the SubControlBoard,...
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
std::mutex mutex
Mutex to grab to use this class.
std::vector< std::vector< int > > m_jointsInSubControlBoard
void fillCompleteJointVectorFromSubControlBoardBuffers(double *full, const RemappedControlBoards &remappedControlBoards)
Fill a vector of joints of the ControlBoardRemapper from the buffers of the SubControlBoard .
void fillSubControlBoardBuffersFromCompleteJointVector(const double *full, const RemappedControlBoards &remappedControlBoards)
Fill buffers for the SubControlBoard from a vector of joints of the RemappedControlBoards.
std::vector< std::vector< double > > m_bufferForSubControlBoard
std::vector< std::vector< int > > m_bufferForSubControlBoardControlModes
std::vector< std::vector< yarp::dev::InteractionModeEnum > > m_bufferForSubControlBoardInteractionModes
Information in how an axis is remapped on an axis of a SubControlBoard.
size_t axisIndexInSubControlBoard
The index of the remapped axis in the SubControlBoard.
size_t subControlBoardIndex
The index of the SubControlBoard of the remapped axis in the RemappedControlBoards class.
std::vector< RemappedSubControlBoard > subdevices
Vector of dimension getNrOfSubControlBoards .
std::vector< RemappedAxis > lut
Vector of dimension getNrOfRemappedAxes .
RemappedSubControlBoard * getSubControlBoard(size_t i)
Given a controlboard index between 0 and getNrOfSubControlBoards()-1, return the relative SubControlB...
yarp::dev::IPositionControl * pos
yarp::dev::IImpedanceControl * iImpedance
yarp::dev::IAmplifierControl * amp
yarp::dev::IEncodersTimed * iJntEnc
yarp::dev::IInteractionMode * iInteract
yarp::dev::IRemoteVariables * iVar
yarp::dev::ICurrentControl * iCurr
yarp::dev::ITorqueControl * iTorque
yarp::dev::IVelocityControl * vel
yarp::dev::IControlMode * iMode
yarp::dev::IJointFault * iFault
yarp::dev::IPositionDirect * posDir
yarp::dev::IRemoteCalibrator * remcalib
bool attach(yarp::dev::PolyDriver *d, const std::string &id)
yarp::dev::IControlLimits * lim
yarp::dev::IControlCalibration * calib
yarp::dev::PolyDriver * subdevice
yarp::dev::IMotorEncoders * iMotEnc
yarp::dev::IPreciselyTimed * iTimed
Interface for control devices, amplifier commands.
Interface for getting information about specific axes, if available.
Definition IAxisInfo.h:36
Interface for control devices, calibration commands.
Interface for control devices, commands to get/set position and veloity limits.
Interface for setting control mode in control board.
Interface for control boards implementing current control.
Control board, extend encoder interface with timestamps.
Interface for control boards implementing impedance control.
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Interface for getting info about the fault which may occur on a robot.
Definition IJointFault.h:23
Control board, encoder interface.
Control board, encoder interface.
Definition IMotor.h:94
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Definition IPWMControl.h:23
Interface for a generic control board device implementing a PID controller, with scaled arguments.
Interface for a generic control board device implementing position control.
Interface for a generic control board device implementing position control.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
IRemoteVariables interface.
Interface for control boards implementing torque control.
Interface for control boards implementing velocity control.
A container for a device driver.
Definition PolyDriver.h:23
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21