46 _subDevVerbose =
false;
93 if (subdevice->isValid())
97 subdevice->view(posDir);
100 subdevice->view(lim);
101 subdevice->view(calib);
102 subdevice->view(remcalib);
103 subdevice->view(info);
104 subdevice->view(iTimed);
105 subdevice->view(iTorque);
106 subdevice->view(iImpedance);
107 subdevice->view(iMode);
108 subdevice->view(iJntEnc);
109 subdevice->view(iMotEnc);
110 subdevice->view(iInteract);
111 subdevice->view(imotor);
112 subdevice->view(iVar);
113 subdevice->view(iPwm);
114 subdevice->view(iCurr);
122 if ((iTorque==
nullptr) && (_subDevVerbose))
127 if ((iImpedance==
nullptr) && (_subDevVerbose))
132 if ((iInteract==
nullptr) && (_subDevVerbose))
137 if ((iMotEnc==
nullptr) && (_subDevVerbose))
142 if ((imotor==
nullptr) && (_subDevVerbose))
147 if ((iVar ==
nullptr) && (_subDevVerbose))
152 if ((info ==
nullptr) && (_subDevVerbose))
157 if ((iPwm ==
nullptr) && (_subDevVerbose))
162 if ((iCurr ==
nullptr) && (_subDevVerbose))
196 if (!pos->getAxes(&deviceJoints))
201 if(deviceJoints <= 0)
219 m_nJointsInSubControlBoard.resize(nrOfSubControlBoards,0);
220 m_jointsInSubControlBoard.resize(nrOfSubControlBoards);
222 m_bufferForSubControlBoard.resize(nrOfSubControlBoards);
223 m_bufferForSubControlBoardControlModes.resize(nrOfSubControlBoards);
224 m_bufferForSubControlBoardInteractionModes.resize(nrOfSubControlBoards);
226 m_counterForControlBoard.resize(nrOfSubControlBoards);
228 for(
size_t ctrlBrd=0; ctrlBrd < nrOfSubControlBoards; ctrlBrd++)
230 m_nJointsInSubControlBoard[ctrlBrd] = 0;
231 m_jointsInSubControlBoard[ctrlBrd].clear();
232 m_bufferForSubControlBoard[ctrlBrd].clear();
233 m_bufferForSubControlBoardControlModes[ctrlBrd].clear();
234 m_bufferForSubControlBoardInteractionModes[ctrlBrd].clear();
240 int off=(int)remappedControlBoards.
lut[j].axisIndexInSubControlBoard;
241 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
243 m_nJointsInSubControlBoard[subIndex]++;
244 m_jointsInSubControlBoard[subIndex].push_back(off);
248 for(
size_t ctrlBrd=0; ctrlBrd < nrOfSubControlBoards; ctrlBrd++)
250 m_bufferForSubControlBoard[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
251 m_bufferForSubControlBoardControlModes[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
252 m_bufferForSubControlBoardInteractionModes[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
254 m_counterForControlBoard[ctrlBrd] = 0;
266 m_bufferForSubControlBoard[ctrlBrd].clear();
269 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
271 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
273 m_bufferForSubControlBoard[subIndex].push_back(full[j]);
281 m_counterForControlBoard[ctrlBrd] = 0;
284 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
286 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
287 full[j] = m_bufferForSubControlBoard[subIndex][m_counterForControlBoard[subIndex]];
288 m_counterForControlBoard[subIndex]++;
296 m_bufferForSubControlBoardControlModes[ctrlBrd].clear();
299 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
301 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
303 m_bufferForSubControlBoardControlModes[subIndex].push_back(full[j]);
311 m_counterForControlBoard[ctrlBrd] = 0;
314 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
316 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
317 full[j] = m_bufferForSubControlBoardControlModes[subIndex][m_counterForControlBoard[subIndex]];
318 m_counterForControlBoard[subIndex]++;
326 m_bufferForSubControlBoardInteractionModes[ctrlBrd].clear();
329 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
331 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
333 m_bufferForSubControlBoardInteractionModes[subIndex].push_back(full[j]);
341 m_counterForControlBoard[ctrlBrd] = 0;
344 for(
int j=0; j < m_nrOfControlledAxesInRemappedCtrlBrd; j++)
346 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
347 full[j] = m_bufferForSubControlBoardInteractionModes[subIndex][m_counterForControlBoard[subIndex]];
348 m_counterForControlBoard[subIndex]++;
357 m_nJointsInSubControlBoard.resize(nrOfSubControlBoards,0);
358 m_jointsInSubControlBoard.resize(nrOfSubControlBoards);
359 m_bufferForSubControlBoard.resize(nrOfSubControlBoards);
360 m_bufferForSubControlBoardControlModes.resize(nrOfSubControlBoards);
361 m_bufferForSubControlBoardInteractionModes.resize(nrOfSubControlBoards);
363 m_counterForControlBoard.resize(nrOfSubControlBoards);
365 for(
size_t ctrlBrd=0; ctrlBrd < nrOfSubControlBoards; ctrlBrd++)
367 m_jointsInSubControlBoard[ctrlBrd].clear();
368 m_bufferForSubControlBoard[ctrlBrd].clear();
369 m_bufferForSubControlBoardControlModes[ctrlBrd].clear();
370 m_bufferForSubControlBoardInteractionModes[ctrlBrd].clear();
377 size_t subIndex=remappedControlBoards.
lut[j].subControlBoardIndex;
379 m_nJointsInSubControlBoard[subIndex]++;
383 for(
size_t ctrlBrd=0; ctrlBrd < nrOfSubControlBoards; ctrlBrd++)
385 m_bufferForSubControlBoard[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
386 m_bufferForSubControlBoardControlModes[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
387 m_bufferForSubControlBoardInteractionModes[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
389 m_counterForControlBoard[ctrlBrd] = 0;
390 m_jointsInSubControlBoard[ctrlBrd].resize(m_nJointsInSubControlBoard[ctrlBrd]);
405 m_counterForControlBoard[ctrlBrd] = 0;
408 for(
int j=0; j < n_joints; j++)
410 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
411 arbitraryVec[j] = m_bufferForSubControlBoard[subIndex][m_counterForControlBoard[subIndex]];
412 m_counterForControlBoard[subIndex]++;
422 this->createListOfJointsDecomposition(n_joints,joints,remappedControlBoards);
426 m_bufferForSubControlBoard[ctrlBrd].clear();
429 for(
int j=0; j < n_joints; j++)
431 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
432 m_bufferForSubControlBoard[subIndex].push_back(arbitraryVec[j]);
444 m_counterForControlBoard[ctrlBrd] = 0;
447 for(
int j=0; j < n_joints; j++)
449 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
450 arbitraryVec[j] = m_bufferForSubControlBoardControlModes[subIndex][m_counterForControlBoard[subIndex]];
451 m_counterForControlBoard[subIndex]++;
461 this->createListOfJointsDecomposition(n_joints,joints,remappedControlBoards);
465 m_bufferForSubControlBoardControlModes[ctrlBrd].clear();
468 for(
int j=0; j < n_joints; j++)
470 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
471 m_bufferForSubControlBoardControlModes[subIndex].push_back(arbitraryVec[j]);
483 m_counterForControlBoard[ctrlBrd] = 0;
486 for(
int j=0; j < n_joints; j++)
488 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
489 arbitraryVec[j] = m_bufferForSubControlBoardInteractionModes[subIndex][m_counterForControlBoard[subIndex]];
490 m_counterForControlBoard[subIndex]++;
500 this->createListOfJointsDecomposition(n_joints,joints,remappedControlBoards);
504 m_bufferForSubControlBoardInteractionModes[ctrlBrd].clear();
507 for(
int j=0; j < n_joints; j++)
509 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
510 m_bufferForSubControlBoardInteractionModes[subIndex].push_back(arbitraryVec[j]);
515 void ControlBoardArbitraryAxesDecomposition::createListOfJointsDecomposition(
const int n_joints,
const int* joints,
const RemappedControlBoards & remappedControlBoards)
519 m_nJointsInSubControlBoard[ctrlBrd] = 0;
520 m_jointsInSubControlBoard[ctrlBrd].clear();
524 for(
int j=0; j < n_joints; j++)
526 int off=(int)remappedControlBoards.
lut[joints[j]].axisIndexInSubControlBoard;
527 size_t subIndex=remappedControlBoards.
lut[joints[j]].subControlBoardIndex;
529 m_nJointsInSubControlBoard[subIndex]++;
530 m_jointsInSubControlBoard[subIndex].push_back(off);
538 createListOfJointsDecomposition(n_joints,joints,remappedControlBoards);
543 m_bufferForSubControlBoard.resize(m_nJointsInSubControlBoard[ctrlBrd]);
const yarp::os::LogComponent & CONTROLBOARDREMAPPER()
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
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.
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...
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 .
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
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.
size_t getNrOfSubControlBoards() const
std::vector< RemappedAxis > lut
Vector of dimension getNrOfRemappedAxes .
size_t getNrOfRemappedAxes() const
RemappedSubControlBoard()
bool attach(yarp::dev::PolyDriver *d, const std::string &id)
bool view(T *&x)
Get an interface to the device driver.
A container for a device driver.
#define yCError(component,...)
#define yCAssert(component, x)
#define yCWarning(component,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.