17 #include <yarp/os/Time.h>
18 #include <yarp/os/Log.h>
19 #include <yarp/os/LogStream.h>
22 #include <yarp/dev/PolyDriver.h>
23 #include <ace/config.h>
24 #include <ace/Log_Msg.h>
30 #include <yarp/os/LogStream.h>
31 #include "EoAnalogSensors.h"
34 #include "EoProtocol.h"
35 #include "EoProtocolMN.h"
36 #include "EoProtocolAS.h"
38 #include <yarp/os/NetType.h>
39 #include <yarp/conf/environment.h>
42 #pragma warning(once:4355)
48 using namespace yarp::os;
54 yWarning() << std::string(txt) <<
" not yet implemented for embObjAnalogSensor\n";
63 Bottle &
tmp=input.findGroup(key1.c_str(), txt.c_str());
66 yError (
"%s not found\n", key1.c_str());
72 yError(
"%s incorrect number of entries\n", key1.c_str());
81 bool embObjAnalogSensor::fromConfig(yarp::os::Searchable &_config)
88 Bottle config = _config.findGroup(
"GENERAL");
89 if (!
extractGroup(config, xtmp,
"Period",
"transmitting period of the sensors", 1))
91 yError() <<
"embObjAnalogSensor Using default value = 0 (disabled)";
93 _as_type=AS_Type_NONE;
97 _period = xtmp.get(1).asInt32();
98 yDebug() <<
"embObjAnalogSensor::fromConfig() detects embObjAnalogSensor Using value of" << _period;
101 if (!
extractGroup(config, xtmp,
"Channels",
"Number of channels of the sensor", 1))
103 yWarning(
"embObjAnalogSensor: Using default value = 0 (disabled)\n");
107 _as_type=AS_Type_NONE;
111 _channels = xtmp.get(1).asInt32();
115 if (!
extractGroup(config, xtmp,
"NumberOfSensors",
"Number of sensors managed", 1))
117 yWarning(
"embObjAnalogSensor: Using default value = 1 for _numofsensors\n");
122 _numofsensors = xtmp.get(1).asInt32();
127 if(config.check(
"Type") )
129 yDebug() <<
"Using new syntax";
130 std::string type = config.find(
"Type").asString();
131 if(type ==
"inertial")
133 _as_type=AS_Type_INERTIAL_MTB;
135 else if(type ==
"strain")
137 _as_type=AS_Type_STRAIN;
139 else if(type ==
"mais")
141 _as_type=AS_Type_MAIS;
145 _as_type=AS_Type_NONE;
146 yError() <<
"embObjAnalogSensor: unknown device " << type <<
". Supported devices are 'mais', 'strain' and 'inertial'";
153 yDebug() <<
"Using old syntax";
155 if (!
extractGroup(config, xtmp,
"Format",
"data format of the Analog Sensor", 1))
157 yWarning(
"embObjAnalogSensor: Using default value = 0 (disabled)");
160 _as_type=AS_Type_NONE;
164 format = xtmp.get(1).asInt32();
167 if((_channels==NUMCHANNEL_STRAIN) && (format==FORMATDATA_STRAIN))
169 _as_type=AS_Type_STRAIN;
171 else if((_channels==NUMCHANNEL_MAIS) && (format==FORMATDATA_MAIS))
173 _as_type=AS_Type_MAIS;
177 _as_type=AS_Type_NONE;
178 yError() <<
"embObjAnalogSensor incorrect config!channels="<< _channels <<
" format="<< format;
188 if(AS_Type_INERTIAL_MTB == _as_type)
193 tmp = config.findGroup(
"enabledAccelerometers");
194 _numofsensors += (
tmp.size()-1);
196 tmp = config.findGroup(
"enabledGyroscopes");
197 _numofsensors += (
tmp.size()-1);
200 if (!
extractGroup(config, xtmp,
"enabledAccelerometers",
"Position of managed sensors axpressed as strings", 1))
202 yWarning(
"embObjAnalogSensor: cannot find enabledAccelerometers\n");
207 _numofsensors = xtmp.size();
215 if(AS_Type_STRAIN == _as_type)
217 if (!
extractGroup(config, xtmp,
"UseCalibration",
"Calibration parameters are needed", 1))
223 _useCalibration = xtmp.get(1).asInt32();
231 embObjAnalogSensor::embObjAnalogSensor(): analogdata(0)
251 status=IAnalogSensor::AS_OK;
255 std::string
tmp = yarp::conf::environment::get_string(
"ETH_VERBOSEWHENOK");
258 verbosewhenok = (bool)yarp::conf::numeric::from_string(
tmp, 0U);
262 verbosewhenok =
false;
268 if (analogdata != NULL)
270 if (scaleFactor != NULL)
284 if(NULL == ethManager)
286 yFatal() <<
"embObjAnalogSensor::open() fails to instantiate ethManager";
291 if(
false == ethManager->
verifyEthBoardInfo(config, ipv4addr, boardIPstring, boardName))
293 yError() <<
"embObjAnalogSensor::open(): object TheEthManager fails in parsing ETH propertiex from xml file";
307 if(config.findGroup(
"GENERAL").find(
"verbose").asBool())
308 str=config.toString().c_str();
314 if(!fromConfig(config))
316 yError() <<
"embObjAnalogSensor missing some configuration parameter. Check logs and your config file.";
322 eOmn_serv_category_t servcategory = eomn_serv_category_none;
325 servcategory = eomn_serv_category_strain;
329 servcategory = eomn_serv_category_mais;
333 servcategory = eomn_serv_category_inertials;
343 yError() <<
"embObjAnalogSensor::open() fails because could not instantiate the ethResource for BOARD w/ IP = " << boardIPstring <<
" ... unable to continue";
367 analogdata =
new AnalogData(2+_channels*_numofsensors, 2+_channels*_numofsensors+2+1);
370 double *buffer = this->analogdata->
getBuffer();
371 buffer[0] = _numofsensors;
372 buffer[1] = _channels;
377 analogdata =
new AnalogData(_channels, _channels+1);
378 scaleFactor =
new double[_channels];
380 for (i=0; i<_channels; i++) scaleFactor[i]=1;
383 for(
int i=0; i<_channels; i++)
407 ret = configServiceInertials(config);
425 eOprotEntity_t entity = eoprot_entity_none;
431 entity = eoprot_entity_as_mais;
432 ret = sendConfig2Mais();
437 entity = eoprot_entity_as_strain;
438 ret = sendConfig2Strain();
443 entity = eoprot_entity_as_inertial;
444 ret = sendConfig2SkinInertial(config);
486 eOas_inertial_commands_t startCommand = {0};
487 startCommand.enable = 1;
489 uint32_t id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_inertial, 0, eoprot_tag_as_inertial_cmmnds_enable);
492 yError() <<
"embObjAnalogSensor::open() fails to command the start transmission of the inertials";
504 bool embObjAnalogSensor::sendConfig2Strain(
void)
506 eOas_strain_config_t strainConfig = {0};
508 strainConfig.datarate = _period;
509 strainConfig.signaloncefullscale = eobool_false;
513 if( ! getFullscaleValues() )
515 yError() <<
"embObjAnalogSensor::sendConfig2Strain() has failed in calling embObjAnalogSensor::getFullscaleValues()";
518 strainConfig.mode = eoas_strainmode_txcalibrateddatacontinuously;
522 strainConfig.mode = eoas_strainmode_txuncalibrateddatacontinuously;
529 eOprotID32_t id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_config);
548 eOprotID32_t protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_config);
549 if(
false == res->
setRemoteValue(protoid, (uint8_t *) &strainConfig))
551 yError() <<
"embObjAnalogSensor::sendConfig2Strain() could not send a set message for eoprot_tag_as_strain_config";
559 bool embObjAnalogSensor::sendConfig2Mais(
void)
564 eOprotID32_t id32 = eo_prot_ID32dummy;
568 uint8_t datarate = _period;
569 id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_mais, 0, eoprot_tag_as_mais_config_datarate);
586 eOenum08_t maismode = eoas_maismode_txdatacontinuously;
587 id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_mais, 0, eoprot_tag_as_mais_config_mode);
605 uint8_t datarate = _period;
608 eOprotID32_t protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_mais, 0, eoprot_tag_as_mais_config_datarate);
613 yError() <<
"embObjAnalogSensor::sendConfig2Mais() could not send a set message fot datarate";
614 yError() <<
"embObjAnalogSensor::sendConfig2Mais() however did not return false. IS CORRECT?";
618 eOas_maismode_t maismode = eoas_maismode_txdatacontinuously;
619 protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_mais, 0, eoprot_tag_as_mais_config_mode);
624 yError() <<
"embObjAnalogSensor::sendConfig2Mais() could not send a set message fot maismode";
625 yError() <<
"embObjAnalogSensor::sendConfig2Mais() however did not return false. IS CORRECT?";
628 #warning --> marco.accame: maybe we can add a readback of the datarate and maismode to be sure of successful operation
635 bool embObjAnalogSensor::configServiceInertials(Searchable& globalConfig)
642 Bottle
tmp = globalConfig.findGroup(
"SERVICES");
643 Bottle config =
tmp.findGroup(
"INERTIALS");
647 eOas_inertial_serviceconfig_t inertialServiceConfig = {0};
654 int numofentries = 0;
657 canmap = config.findGroup(
"InertialsCAN1mapping");
658 numofentries = canmap.size()-1;
660 for(
int i=0; i<numofentries; i++)
662 eOas_inertial_position_t
pos = eoas_inertial_pos_none;
664 std::string strpos = canmap.get(i+1).asString();
666 pos = getLocationOfInertialSensor(strpos);
667 inertialServiceConfig.canmapofsupportedsensors[0][i] =
pos;
671 canmap = config.findGroup(
"InertialsCAN2mapping");
672 numofentries = canmap.size()-1;
674 for(
int i=0; i<numofentries; i++)
676 eOas_inertial_position_t
pos = eoas_inertial_pos_none;
678 std::string strpos = canmap.get(i+1).asString();
680 pos = getLocationOfInertialSensor(strpos);
681 inertialServiceConfig.canmapofsupportedsensors[1][i] =
pos;
686 eOprotID32_t id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_inertial, 0, eoprot_tag_as_inertial_config_service);
687 if(
false == res->setRemoteValueUntilVerified(id32, &inertialServiceConfig,
sizeof(inertialServiceConfig), 10, 0.010, 0.050, 2))
706 bool embObjAnalogSensor::sendConfig2SkinInertial(Searchable& globalConfig)
713 eOprotID32_t id32 = eo_prot_ID32dummy;
717 Bottle config = globalConfig.findGroup(
"GENERAL");
722 eOas_inertial_sensorsconfig_t inertialSensorsConfig = {0};
724 inertialSensorsConfig.accelerometers = 0;
725 inertialSensorsConfig.gyroscopes = 0;
726 inertialSensorsConfig.datarate = _period;
733 sensors = config.findGroup(
"enabledAccelerometers");
735 int numofaccelerometers = sensors.size()-1;
737 for(
int i=0; i<numofaccelerometers; i++)
739 eOas_inertial_position_t
pos = eoas_inertial_pos_none;
741 std::string strpos = sensors.get(i+1).asString();
743 pos = getLocationOfInertialSensor(strpos);
745 if(eoas_inertial_pos_none !=
pos)
747 _fromInertialPos2DataIndexAccelerometers[
pos] = i;
748 inertialSensorsConfig.accelerometers |= EOAS_ENABLEPOS(
pos);
752 sensors = config.findGroup(
"enabledGyroscopes");
754 int numofgyroscopess = sensors.size()-1;
756 for(
int i=0; i<numofgyroscopess; i++)
758 eOas_inertial_position_t
pos = eoas_inertial_pos_none;
760 std::string strpos = sensors.get(i+1).asString();
762 pos = getLocationOfInertialSensor(strpos);
764 if(eoas_inertial_pos_none !=
pos)
766 _fromInertialPos2DataIndexGyroscopes[
pos] = numofaccelerometers+i;
767 inertialSensorsConfig.gyroscopes |= EOAS_ENABLEPOS(
pos);
773 id32 = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_inertial, 0, eoprot_tag_as_inertial_config_sensors);
774 if(
false == res->setRemoteValueUntilVerified(id32, &inertialSensorsConfig,
sizeof(inertialSensorsConfig), 10, 0.010, 0.050, 2))
806 eOas_inertial1_position_t embObjAnalogSensor::getLocationOfInertialSensor(std::string &strpos)
808 eOas_inertial1_position_t ret = eoas_inertial1_pos_none;
812 ret = eoas_inertial1_pos_none;
815 else if(strpos ==
"l_hand")
817 ret = eoas_inertial1_pos_l_hand;
819 else if(strpos ==
"l_forearm_1")
821 ret = eoas_inertial1_pos_l_forearm_1;
823 else if(strpos ==
"l_forearm_2")
825 ret = eoas_inertial1_pos_l_forearm_2;
827 else if(strpos ==
"l_upper_arm_1")
829 ret = eoas_inertial1_pos_l_upper_arm_1;
831 else if(strpos ==
"l_upper_arm_2")
833 ret = eoas_inertial1_pos_l_upper_arm_2;
835 else if(strpos ==
"l_upper_arm_3")
837 ret = eoas_inertial1_pos_l_upper_arm_3;
839 else if(strpos ==
"l_upper_arm_4")
841 ret = eoas_inertial1_pos_l_upper_arm_4;
843 else if(strpos ==
"l_foot_1")
845 ret = eoas_inertial1_pos_l_foot_1;
847 else if(strpos ==
"l_foot_2")
849 ret = eoas_inertial1_pos_l_foot_2;
851 else if(strpos ==
"l_lower_leg_1")
853 ret = eoas_inertial1_pos_l_lower_leg_1;
855 else if(strpos ==
"l_lower_leg_2")
857 ret = eoas_inertial1_pos_l_lower_leg_2;
859 else if(strpos ==
"l_lower_leg_3")
861 ret = eoas_inertial1_pos_l_lower_leg_3;
863 else if(strpos ==
"l_lower_leg_4")
865 ret = eoas_inertial1_pos_l_lower_leg_4;
867 else if(strpos ==
"l_upper_leg_1")
869 ret = eoas_inertial1_pos_l_upper_leg_1;
871 else if(strpos ==
"l_upper_leg_2")
873 ret = eoas_inertial1_pos_l_upper_leg_2;
875 else if(strpos ==
"l_upper_leg_3")
877 ret = eoas_inertial1_pos_l_upper_leg_3;
879 else if(strpos ==
"l_upper_leg_4")
881 ret = eoas_inertial1_pos_l_upper_leg_4;
883 else if(strpos ==
"l_upper_leg_5")
885 ret = eoas_inertial1_pos_l_upper_leg_5;
887 else if(strpos ==
"l_upper_leg_6")
889 ret = eoas_inertial1_pos_l_upper_leg_6;
891 else if(strpos ==
"l_upper_leg_7")
893 ret = eoas_inertial1_pos_l_upper_leg_7;
896 else if(strpos ==
"r_hand")
898 ret = eoas_inertial1_pos_r_hand;
900 else if(strpos ==
"r_forearm_1")
902 ret = eoas_inertial1_pos_r_forearm_1;
904 else if(strpos ==
"r_forearm_2")
906 ret = eoas_inertial1_pos_r_forearm_2;
908 else if(strpos ==
"r_upper_arm_1")
910 ret = eoas_inertial1_pos_r_upper_arm_1;
912 else if(strpos ==
"r_upper_arm_2")
914 ret = eoas_inertial1_pos_r_upper_arm_2;
916 else if(strpos ==
"r_upper_arm_3")
918 ret = eoas_inertial1_pos_r_upper_arm_3;
920 else if(strpos ==
"r_upper_arm_4")
922 ret = eoas_inertial1_pos_r_upper_arm_4;
924 else if(strpos ==
"r_foot_1")
926 ret = eoas_inertial1_pos_r_foot_1;
928 else if(strpos ==
"r_foot_2")
930 ret = eoas_inertial1_pos_r_foot_2;
932 else if(strpos ==
"r_lower_leg_1")
934 ret = eoas_inertial1_pos_r_lower_leg_1;
936 else if(strpos ==
"r_lower_leg_2")
938 ret = eoas_inertial1_pos_r_lower_leg_2;
940 else if(strpos ==
"r_lower_leg_3")
942 ret = eoas_inertial1_pos_r_lower_leg_3;
944 else if(strpos ==
"r_lower_leg_4")
946 ret = eoas_inertial1_pos_r_lower_leg_4;
948 else if(strpos ==
"r_upper_leg_1")
950 ret = eoas_inertial1_pos_r_upper_leg_1;
952 else if(strpos ==
"r_upper_leg_2")
954 ret = eoas_inertial1_pos_r_upper_leg_2;
956 else if(strpos ==
"r_upper_leg_3")
958 ret = eoas_inertial1_pos_r_upper_leg_3;
960 else if(strpos ==
"r_upper_leg_4")
962 ret = eoas_inertial1_pos_r_upper_leg_4;
964 else if(strpos ==
"r_upper_leg_5")
966 ret = eoas_inertial1_pos_r_upper_leg_5;
968 else if(strpos ==
"r_upper_leg_6")
970 ret = eoas_inertial1_pos_r_upper_leg_6;
972 else if(strpos ==
"r_upper_leg_7")
974 ret = eoas_inertial1_pos_r_upper_leg_7;
986 bool embObjAnalogSensor::getFullscaleValues()
1003 bool gotFullScaleValues =
false;
1004 int timeout, NVsize;
1006 EOnv *p_tmpNV = NULL;
1007 eOas_arrayofupto12bytes_t fullscale_values = {0};
1010 eo_array_New(6, 2, &fullscale_values);
1012 eOprotID32_t protoid_fullscale = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_status_fullscale);
1017 const bool overrideROprotection =
true;
1018 res->
setLocalValue(protoid_fullscale, &fullscale_values, overrideROprotection);
1022 eOas_strain_config_t strainConfig = {0};
1023 strainConfig.datarate = _period;
1024 strainConfig.mode = eoas_strainmode_acquirebutdonttx;
1025 strainConfig.signaloncefullscale = eobool_true;
1027 eOprotID32_t protoid_strain_config = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_config);
1032 while(!gotFullScaleValues && (timeout != 0))
1035 SystemClock::delaySystem(1.0);
1040 NVsize = eo_array_Size((EOarray *)&fullscale_values);
1044 gotFullScaleValues =
true;
1055 if((
false == gotFullScaleValues) && (0 == timeout))
1061 if((NVsize != _channels))
1070 if(gotFullScaleValues)
1078 for(
int i=0; i<_channels; i++)
1081 msg = (uint8_t *) eo_array_At((EOarray *) &fullscale_values, i);
1084 yError() <<
"I don't receive data for channel " << i;
1089 scaleFactor[i]= ((uint16_t)(msg[0]<<8) | msg[1]);
1094 yDebug() <<
"embObjAnalogSensor::getFullscaleValues(): channel " << i <<
"full scale value " << scaleFactor[i];
1102 bool embObjAnalogSensor::init()
1107 vector<eOprotID32_t> id32v(0);
1108 eOprotID32_t protoid = eo_prot_ID32dummy;
1109 eOmn_serv_category_t servcategory = eomn_serv_category_none;
1117 servcategory = eomn_serv_category_mais;
1119 protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_mais, 0, eoprot_tag_as_mais_status_the15values);
1125 servcategory = eomn_serv_category_strain;
1128 protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_status_calibratedvalues);
1130 protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_strain, 0, eoprot_tag_as_strain_status_uncalibratedvalues);
1135 servcategory = eomn_serv_category_inertials;
1136 protoid = eoprot_ID_get(eoprot_endpoint_analogsensors, eoprot_entity_as_inertial, 0, eoprot_tag_as_inertial_status);
1141 yError() <<
"embObjAnalogSensor: unknown device, cannot set regular ROPs";
1142 protoid = eo_prot_ID32dummy;
1148 id32v.push_back(protoid);
1153 yError() <<
"embObjAnalogSensor::init() fails to add its variables to regulars: cannot proceed any further";
1162 for (
size_t r = 0; r<id32v.size(); r++)
1164 uint32_t id32 = id32v.at(r);
1165 eoprot_ID2information(id32, nvinfo,
sizeof(nvinfo));
1166 yDebug() <<
"\t it added regular rop for" << nvinfo;
1171 SystemClock::delaySystem(0.005);
1186 std::lock_guard<std::mutex> lck(mtx);
1194 if (status!=IAnalogSensor::AS_OK)
1198 case IAnalogSensor::AS_OVF:
1202 case IAnalogSensor::AS_ERROR:
1206 case IAnalogSensor::AS_TIMEOUT:
1218 out.resize(analogdata->
size());
1219 for(
int k=0;k<analogdata->
size();k++)
1221 out[k]=(*analogdata)[k];
1228 void embObjAnalogSensor::resetCounters()
1236 void embObjAnalogSensor::getCounters(
unsigned int &
sat,
unsigned int &err,
unsigned int &to)
1246 printf(
"getstate\n");
1252 return analogdata->
size();
1314 ret = fillDatOfMais(rxdata);
1319 ret = fillDatOfStrain(rxdata);
1324 ret = fillDatOfInertial(rxdata);
1339 bool embObjAnalogSensor::fillDatOfStrain(
void *as_array_raw)
1345 EOarray *array = (EOarray*)as_array_raw;
1346 uint8_t size = eo_array_Size(array);
1347 uint8_t itemsize = eo_array_ItemSize(array);
1354 std::lock_guard<std::mutex> lck(mtx);
1356 double *_buffer = this->analogdata->
getBuffer();
1364 for(
int k=0; k<_channels; k++)
1367 char*
tmp = (
char*) eo_array_At(array, k);
1372 uint8_t msg[2] = {0};
1373 memcpy(msg,
tmp, 2);
1375 _buffer[k]= (short)( ( (((
unsigned short)(msg[1]))<<8)+msg[0]) - (
unsigned short) (0x8000) );
1377 if (_useCalibration == 1)
1379 _buffer[k]=_buffer[k]*scaleFactor[k]/float(0x8000);
1388 bool embObjAnalogSensor::fillDatOfMais(
void *as_array_raw)
1395 EOarray *array = (EOarray*)as_array_raw;
1396 uint8_t size = eo_array_Size(array);
1397 uint8_t itemsize = eo_array_ItemSize(array);
1403 std::lock_guard<std::mutex> lck(mtx);
1405 double *_buffer = this->analogdata->
getBuffer();
1414 for(
int k=0; k<size; k++)
1416 uint8_t val = *((uint8_t*)eo_array_At(array, k));
1418 _buffer[k] = (double)val;
1425 bool embObjAnalogSensor::fillDatOfInertial(
void *inertialdata)
1427 eOas_inertial_status_t *status = (eOas_inertial_status_t*) inertialdata;
1433 if((eoas_inertial_pos_none == status->data.position) || (status->data.position >= eoas_inertial_pos_max_numberof))
1438 std::lock_guard<std::mutex> lck(mtx);
1440 double *_buffer = this->analogdata->
getBuffer();
1448 uint8_t dataindex = 255;
1450 if(eoas_inertial_type_accelerometer == status->data.type)
1452 dataindex = _fromInertialPos2DataIndexAccelerometers[status->data.position];
1454 else if(eoas_inertial_type_gyroscope == status->data.type)
1456 dataindex = _fromInertialPos2DataIndexGyroscopes[status->data.position];
1461 if(255 != dataindex)
1464 uint8_t firstpos = 2 + dataindex*6;
1466 _buffer[firstpos+0] = (double) status->data.position;
1467 _buffer[firstpos+1] = (
double) status->data.type;
1468 _buffer[firstpos+2] = (double) status->data.timestamp;
1470 _buffer[firstpos+3] = (
double) status->data.x;
1471 _buffer[firstpos+4] = (double) status->data.y;
1472 _buffer[firstpos+5] = (
double) status->data.z;
1485 void embObjAnalogSensor::cleanup(
void)
1487 if(ethManager == NULL)
return;
virtual const Properties & getProperties()=0
virtual bool setcheckRemoteValue(const eOprotID32_t id32, void *value, const unsigned int retries=10, const double waitbeforecheck=0.001, const double timeout=0.050)=0
virtual bool serviceVerifyActivate(eOmn_serv_category_t category, const eOmn_serv_parameter_t *param, double timeout=0.500)=0
virtual bool setRemoteValue(const eOprotID32_t id32, void *value)=0
virtual bool verifyEPprotocol(eOprot_endpoint_t ep)=0
virtual bool getLocalValue(const eOprotID32_t id32, void *value)=0
virtual bool setLocalValue(eOprotID32_t id32, const void *value, bool overrideROprotection=false)=0
virtual bool serviceSetRegulars(eOmn_serv_category_t category, vector< eOprotID32_t > &id32vector, double timeout=0.500)=0
virtual bool serviceStart(eOmn_serv_category_t category, double timeout=0.500)=0
int releaseResource2(eth::AbstractEthResource *ethresource, IethResource *interface)
bool verifyEthBoardInfo(yarp::os::Searchable &cfgtotal, eOipv4addr_t &boardipv4, string boardipv4string, string boardname)
static bool killYourself()
static TheEthManager * instance()
eth::AbstractEthResource * requestResource2(IethResource *interface, yarp::os::Searchable &cfgtotal)
virtual int getChannels()
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
virtual int calibrateSensor()
virtual bool initialised()
bool open(yarp::os::Searchable &config)
virtual int getState(int ch)
virtual int calibrateChannel(int ch, double v)
virtual eth::iethresType_t type()
virtual int read(yarp::sig::Vector &out)
Read a vector from the sensor.
bool NOT_YET_IMPLEMENTED(const char *txt)
double sat(const double val, const double min, const double max)
Copyright (C) 2008 RobotCub Consortium.
static bool extractGroup(Bottle &input, Bottle &out, const std::string &key1, const std::string &txt, int size)