32    Bottle &conf_group = rf.findGroup(
"GENERAL");
 
   33    Bottle* jointsBottle = 
nullptr;
 
   34    if (conf_group.isNull())
 
   36        yWarning() << 
"Missing GENERAL group! The module uses the default values";
 
   40        if(conf_group.check(
"portprefix")) { m_portPrefix = conf_group.find(
"portprefix").asString(); }
 
   41        if(conf_group.check(
"period")) { _updatePeriod = conf_group.find(
"period").asFloat64(); }
 
   42        if(conf_group.check(
"robotname")) { _robotName = conf_group.find(
"robotname").asString(); }
 
   43        if (conf_group.check(
"listofjoints"))
 
   45            jointsBottle = conf_group.find(
"listofjoints").asList();
 
   46            _nEnabledMotors = jointsBottle->size();
 
   47            for(
int i=0; i < _nEnabledMotors; i++) _listOfJoints.push_back(jointsBottle->get(i).asInt32());
 
   54    options.put(
"device", 
"remote_controlboard");
 
   55    options.put(
"remote", 
"/"+ _robotName + m_portPrefix);
 
   56    options.put(
"local", m_portPrefix + 
"/mc");
 
   59    yDebug() << 
"++++ config:\n"  
   60        << 
"\t portprefix: " << m_portPrefix << 
"\n" 
   61        << 
"\t period: " << _updatePeriod << 
"\n" 
   62        << 
"\t robotname: " << _robotName << 
"\n" 
   63        << 
"\t listofjoints: " << jointsBottle->toString() << 
"\n";
 
   65    _motionControlDevice.open(options);
 
   67    if (!_motionControlDevice.isValid())
 
   69        yError() << 
"Unable to open device driver. Aborting...";
 
   73    if (!_motionControlDevice.view(_imot) || _imot==
nullptr)
 
   75        yError() << 
"Unable to open motor raw interface. Aborting...";
 
   79    if (!_imot->getNumberOfMotors(&_nmotors))
 
   81        yError() << 
"Unable to retrieve the number of motors";
 
   86        yDebug() << 
"Working with" << _nmotors << 
"motors";
 
   87        yDebug() << 
"Enabling" << _nEnabledMotors << 
"motors of the subpart";
 
   91    if (!alloc(_nEnabledMotors))
 
   93        yError() << 
"Error allocating memory for pointers. Aborting...";
 
   99    if(!_outputPort.open(m_portPrefix +
"/motor_temperatures:o"))
 
  101        yError() << 
"Error opening output port for motor control";
 
  105    for (uint8_t i = 0; i < _listOfJoints.size(); i++)
 
  107        if (!_imot->getTemperatureLimit(i, &_motorTemperatureLimits[i]))
 
  109            yError() << 
"Unable to get motor temperature Limits. Aborting...";
 
  114            yDebug() << 
"Limit for motor#" << i << 
"value:" << _motorTemperatureLimits[i];
 
 
  145    for (
int i = 0; i < _listOfJoints.size(); i++)
 
  147        _motorTemperatures[i]= 0;
 
  148        int jointNib = (int)_listOfJoints[i];
 
  149        if (!_imot->getTemperature(jointNib, &_motorTemperatures[jointNib]))
 
  151            yError() << 
"Unable to get motor " << jointNib << 
" temperature.\n";
 
  155    sendData2OutputPort(_motorTemperatures);