29 #include "EOYtheSystem.h"
34 #include "EoProtocol.h"
37 #include "EOdeviceTransceiver.h"
39 #include "EOprotocolConfigurator.h"
41 #include "EoProtocol.h"
42 #include "EoProtocolMN.h"
43 #include "EoProtocolMC.h"
44 #include "EoProtocolAS.h"
45 #include "EoProtocolSK.h"
49 #include <yarp/os/LogStream.h>
51 #include <yarp/os/Time.h>
52 #include <yarp/os/Bottle.h>
54 using namespace yarp::os;
68 protboardnumber = eo_prot_BRDdummy;
78 memcpy(&devtxrxcfg, &eo_devicetransceiver_cfg_default,
sizeof(eOdevicetransceiver_cfg_t));
88 yDebug() <<
" input is " << rf.toString().c_str();
90 if(!rf.check(
"PC104IpAddress"))
92 yError() <<
"missing PC104IpAddress";
96 if(!rf.check(
"emsIpAddress"))
98 yError() <<
"missing emsIpAddress";
102 if(!rf.check(
"port"))
104 yError() <<
"missing port";
108 yDebug() <<
" I have all params I need!!";
109 Bottle parameter1( rf.find(
"PC104IpAddress").asString() );
111 int port = rf.find(
"port").asInt32();
112 strcpy(_fId.PC104ipAddr.string, parameter1.toString().c_str());
113 _fId.PC104ipAddr.port = port;
115 Bottle parameter2( rf.find(
"emsIpAddress").asString() );
116 strcpy(_fId.EMSipAddr.string, parameter2.toString().c_str());
117 _fId.EMSipAddr.port = port;
119 sscanf(_fId.EMSipAddr.string,
"\"%d.%d.%d.%d", &_fId.EMSipAddr.ip1, &_fId.EMSipAddr.ip2, &_fId.EMSipAddr.ip3, &_fId.EMSipAddr.ip4);
120 sscanf(_fId.PC104ipAddr.string,
"\"%d.%d.%d.%d", &_fId.PC104ipAddr.ip1, &_fId.PC104ipAddr.ip2, &_fId.PC104ipAddr.ip3, &_fId.PC104ipAddr.ip4);
122 snprintf(_fId.EMSipAddr.string,
sizeof(_fId.EMSipAddr.string),
"%u.%u.%u.%u:%u", _fId.EMSipAddr.ip1, _fId.EMSipAddr.ip2, _fId.EMSipAddr.ip3, _fId.EMSipAddr.ip4, _fId.EMSipAddr.port);
123 snprintf(_fId.PC104ipAddr.string,
sizeof(_fId.PC104ipAddr.string),
"%u.%u.%u.%u:%u", _fId.PC104ipAddr.ip1, _fId.PC104ipAddr.ip2, _fId.PC104ipAddr.ip3, _fId.PC104ipAddr.ip4, _fId.PC104ipAddr.port);
126 yDebug() <<
" boardTransceiver - referred to EMS: " << _fId.EMSipAddr.string;
129 ACE_UINT32 hostip = (_fId.PC104ipAddr.ip1 << 24) | (_fId.PC104ipAddr.ip2 << 16) | (_fId.PC104ipAddr.ip3 << 8) | (_fId.PC104ipAddr.ip4);
130 ACE_INET_Addr myIP((u_short)_fId.PC104ipAddr.port, hostip);
133 if(!createSocket(myIP) )
143 UDP_socket =
new ACE_SOCK_Dgram();
146 if(-1 == UDP_socket->open(local_addr))
148 local_addr.addr_to_string(
tmp, 64);
149 yError() <<
"\n/---------------------------------------------------\\"
150 <<
"\n| Unable to bind to local IP address " <<
tmp
151 <<
"\n\\---------------------------------------------------/";
157 yTrace() <<
"BoardTransceiver created socket correctly!";
171 localipaddr = _localipaddr;
172 remoteipaddr = _remoteipaddr;
173 remoteipport = _remoteipport;
177 if(!initProtocol(config))
179 yError() <<
"BoardTransceiver::initProtocol() fails";
184 if(!prepareTransceiverConfig(config))
186 yError() <<
"BoardTransceiver::prepareTransceiverConfig() fails";
192 devtxrx = eo_devicetransceiver_New(&devtxrxcfg);
197 transceiver = eo_devicetransceiver_GetTransceiver(devtxrx);
198 if(transceiver == NULL)
202 nvset = eo_devicetransceiver_GetNVset(devtxrx);
212 p_RxPkt = eo_packet_New(_pktsizerx);
216 eOnvID32_t id32status = eoprot_ID_get(eoprot_endpoint_management, eoprot_entity_mn_appl, 0, eoprot_tag_mn_appl_status);
217 eo_nvset_NV_Get(nvset, eok_ipv4addr_localhost, id32status, oneNV);
219 pApplStatus = (eOmn_appl_status_t*) oneNV->ram;
220 pApplStatus->currstate = applstate_config;
230 v.msec(
static_cast<int>(
x*1000/unit+0.5));
232 v.tv_usec =
static_cast<int>(
x*1000000/unit+0.5) % 1000000;
233 v.tv_sec =
static_cast<int>(
x/unit);
240 ACE_INET_Addr sender_addr;
242 ACE_Time_Value recvTimeOut;
246 uint16_t bytes_to_send = 0;
250 bool parsepacket =
false;
251 bool transmitpacket =
false;
256 recv_size = UDP_socket->recv((
void *) incoming_msg,
RECV_BUFFER_SIZE, sender_addr, 0, &recvTimeOut);
258 switch(pApplStatus->currstate)
260 case applstate_config:
265 transmitpacket =
true;
269 case applstate_running:
275 transmitpacket =
true;
278 case applstate_error:
283 transmitpacket =
true;
296 onMsgReception(incoming_msg, recv_size);
301 getTransmit(&p_sendData, &bytes_to_send);
303 ssize_t ret = UDP_socket->send(p_sendData, bytes_to_send, remoteipaddr);
306 yError() <<
"Unable to send a message";
320 yError() <<
"eo BoardTransceiver::onMsgReception() called with NULL data";
324 yError() <<
"Received a message with size = " << size;
329 uint16_t capacityrxpkt = 0;
333 eo_packet_Capacity_Get(p_RxPkt, &capacityrxpkt);
334 if(size > capacityrxpkt)
336 yError () <<
"received packet has size " << size <<
"which is higher than capacity of rx pkt = " << capacityrxpkt <<
"\n";
340 eo_packet_Payload_Set(p_RxPkt,
data, size);
341 eo_packet_Addressing_Set(p_RxPkt, remoteipaddr, remoteipport);
342 eo_transceiver_Receive(transceiver, p_RxPkt, &numofrops, &
txtime);
354 if((NULL ==
data) || (NULL == size))
356 yError() <<
"eo BoardTransceiver::getTransmit() called with NULL data or size";
361 EOpacket* ptrpkt = NULL;
368 res = eo_transceiver_outpacket_Prepare(transceiver, &numofrops);
371 yError() <<
"eo BoardTransceiver::getTransmit(): failure of eo_transceiver_outpacket_Prepare()";
375 res = eo_transceiver_outpacket_Get(transceiver, &ptrpkt);
378 yError() <<
"eo BoardTransceiver::getTransmit(): failure of eo_transceiver_outpacket_Get()";
383 eo_packet_Payload_Get(ptrpkt,
data, size);
390 return(protboardnumber);
394 void embOBJerror(eOerrmanErrorType_t errtype, eOid08_t taskid,
const char *eobjstr,
const char *
info)
396 static const char* theerrors[] = {
"eo_errortype_info",
"eo_errortype_warning",
"eo_errortype_weak",
"eo_errortype_fatal" };
398 yError() <<
"embOBJerror(): errtype = " << theerrors[errtype] <<
"from EOobject = " << eobjstr <<
" w/ message = " <<
info;
400 if(errtype == eo_errortype_fatal)
402 yError() <<
"embOBJerror(): FATAL ERROR: the calling thread shall now be stopped in a forever loop here inside";
411 eOerrman_cfg_t errmanconfig = {0};
413 const eOysystem_cfg_t *syscfg = NULL;
414 const eOmempool_cfg_t *mpoolcfg = NULL;
416 eoy_sys_Initialise(syscfg, mpoolcfg, &errmanconfig);
419 bool BoardTransceiver::initProtocol(yarp::os::Searchable &config)
421 static bool alreadyinitted =
false;
423 if(
false == alreadyinitted)
428 static const uint8_t numOfBoardsinRobot = eoprot_boards_maxnumberof;
431 if(eores_OK != eoprot_config_board_numberof(numOfBoardsinRobot))
433 yError() <<
"BoardTransceiver::initProtocol(): call to eoprot_config_board_numberof() fails.";
439 eoprot_override_mn();
440 eoprot_override_mc();
441 eoprot_override_as();
442 eoprot_override_sk();
445 alreadyinitted =
true;
461 void BoardTransceiver::eoprot_override_mn(
void)
464 static const eOprot_callbacks_endpoint_descriptor_t mn_callbacks_descriptor_endp =
466 EO_INIT(.endpoint) eoprot_endpoint_management,
467 EO_INIT(.raminitialise) NULL
470 static const eOprot_callbacks_variable_descriptor_t mn_callbacks_descriptors_vars[] =
474 EO_INIT(.endpoint) eoprot_endpoint_management,
475 EO_INIT(.entity) eoprot_entity_mn_appl,
476 EO_INIT(.tag) eoprot_tag_mn_appl_cmmnds_go2state,
494 uint32_t number =
sizeof(mn_callbacks_descriptors_vars)/
sizeof(mn_callbacks_descriptors_vars[0]);
497 for(i=0; i<number; i++)
499 eoprot_config_callbacks_variable_set(&mn_callbacks_descriptors_vars[i]);
507 void BoardTransceiver::eoprot_override_mc(
void)
510 static const eOprot_callbacks_endpoint_descriptor_t mc_callbacks_descriptor_endp =
512 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
513 EO_INIT(.raminitialise) NULL
516 static const eOprot_callbacks_variable_descriptor_t mc_callbacks_descriptors_vars[] =
521 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
522 EO_INIT(.entity) eoprot_entity_mc_joint,
523 EO_INIT(.tag) eoprot_tag_mc_joint_config,
525 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_config
528 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
529 EO_INIT(.entity) eoprot_entity_mc_joint,
530 EO_INIT(.tag) eoprot_tag_mc_joint_config_pidposition,
532 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_config_pidposition
535 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
536 EO_INIT(.entity) eoprot_entity_mc_joint,
537 EO_INIT(.tag) eoprot_tag_mc_joint_config_impedance,
539 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_config_impedance
542 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
543 EO_INIT(.entity) eoprot_entity_mc_joint,
544 EO_INIT(.tag) eoprot_tag_mc_joint_config_pidtorque,
546 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_config_pidtorque
549 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
550 EO_INIT(.entity) eoprot_entity_mc_joint,
551 EO_INIT(.tag) eoprot_tag_mc_joint_status,
556 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
557 EO_INIT(.entity) eoprot_entity_mc_joint,
558 EO_INIT(.tag) eoprot_tag_mc_joint_status_basic,
560 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_status_basic
563 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
564 EO_INIT(.entity) eoprot_entity_mc_joint,
565 EO_INIT(.tag) eoprot_tag_mc_joint_cmmnds_setpoint,
567 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_cmmnds_setpoint
570 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
571 EO_INIT(.entity) eoprot_entity_mc_joint,
572 EO_INIT(.tag) eoprot_tag_mc_joint_config_limitsofjoint,
574 EO_INIT(.update) eoprot_fun_UPDT_mc_joint_config_limitsofjoint
578 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
579 EO_INIT(.entity) eoprot_entity_mc_motor,
580 EO_INIT(.tag) eoprot_tag_mc_motor_config,
582 EO_INIT(.update) eoprot_fun_UPDT_mc_motor_config
585 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
586 EO_INIT(.entity) eoprot_entity_mc_motor,
587 EO_INIT(.tag) eoprot_tag_mc_motor_config_maxcurrentofmotor,
589 EO_INIT(.update) eoprot_fun_UPDT_mc_motor_config_maxcurrentofmotor
592 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
593 EO_INIT(.entity) eoprot_entity_mc_motor,
594 EO_INIT(.tag) eoprot_tag_mc_motor_status_basic,
596 EO_INIT(.update) eoprot_fun_UPDT_mc_motor_status_basic
603 EO_INIT(.endpoint) eoprot_endpoint_motioncontrol,
604 EO_INIT(.entity) eoprot_entity_mc_joint,
605 EO_INIT(.tag) eoprot_tag_mc_joint_cmmnds_interactionmode,
623 uint32_t number =
sizeof(mc_callbacks_descriptors_vars)/
sizeof(mc_callbacks_descriptors_vars[0]);
626 for(i=0; i<number; i++)
628 eoprot_config_callbacks_variable_set(&mc_callbacks_descriptors_vars[i]);
634 void BoardTransceiver::eoprot_override_as(
void)
640 static const eOprot_callbacks_endpoint_descriptor_t as_callbacks_descriptor_endp =
642 EO_INIT(.endpoint) eoprot_endpoint_analogsensors,
643 EO_INIT(.raminitialise) NULL
646 static const eOprot_callbacks_variable_descriptor_t as_callbacks_descriptors_vars[] =
650 EO_INIT(.endpoint) eoprot_endpoint_analogsensors,
651 EO_INIT(.entity) eoprot_entity_as_strain,
652 EO_INIT(.tag) eoprot_tag_as_strain_status_calibratedvalues,
657 EO_INIT(.endpoint) eoprot_endpoint_analogsensors,
658 EO_INIT(.entity) eoprot_entity_as_strain,
659 EO_INIT(.tag) eoprot_tag_as_strain_status_uncalibratedvalues,
665 EO_INIT(.endpoint) eoprot_endpoint_analogsensors,
666 EO_INIT(.entity) eoprot_entity_as_mais,
667 EO_INIT(.tag) eoprot_tag_as_mais_status_the15values,
686 uint32_t number =
sizeof(as_callbacks_descriptors_vars)/
sizeof(as_callbacks_descriptors_vars[0]);
689 for(i=0; i<number; i++)
691 eoprot_config_callbacks_variable_set(&as_callbacks_descriptors_vars[i]);
698 void BoardTransceiver::eoprot_override_sk(
void)
702 static const eOprot_callbacks_endpoint_descriptor_t sk_callbacks_descriptor_endp =
704 EO_INIT(.endpoint) eoprot_endpoint_skin,
705 EO_INIT(.raminitialise) NULL
708 static const eOprot_callbacks_variable_descriptor_t sk_callbacks_descriptors_vars[] =
712 EO_INIT(.endpoint) eoprot_endpoint_skin,
713 EO_INIT(.entity) eoprot_entity_sk_skin,
714 EO_INIT(.tag) eoprot_tag_sk_skin_status_arrayof10canframes,
716 EO_INIT(.update) eoprot_fun_UPDT_sk_skin_status_arrayof10canframes
732 uint32_t number =
sizeof(sk_callbacks_descriptors_vars)/
sizeof(sk_callbacks_descriptors_vars[0]);
735 for(i=0; i<number; i++)
737 eoprot_config_callbacks_variable_set(&sk_callbacks_descriptors_vars[i]);
745 long long unsigned int exp = expected_seqnum;
746 long long unsigned int rec = rec_seqnum;
747 printf(
"Error in sequence number from 0x%x!!!! \t Expected %llu, received %llu\n", remipv4addr,
exp, rec);
755 bool BoardTransceiver::prepareTransceiverConfig(yarp::os::Searchable &config)
758 memcpy(&devtxrxcfg, &eo_devicetransceiver_cfg_default,
sizeof(eOdevicetransceiver_cfg_t));
761 devtxrxcfg.nvsetdevcfg = getNVset_DEVcfg(config);
763 if(NULL == devtxrxcfg.nvsetdevcfg)
768 devtxrxcfg.remotehostipv4addr = remoteipaddr;
769 devtxrxcfg.remotehostipv4port = remoteipport;
772 const eOtransceiver_sizes_t devsizes =
774 EO_INIT(.capacityoftxpacket) 1408,
775 EO_INIT(.capacityofrop) 256,
776 EO_INIT(.capacityofropframeregulars) 1024,
777 EO_INIT(.capacityofropframeoccasionals) 128,
778 EO_INIT(.capacityofropframereplies) 256,
779 EO_INIT(.maxnumberofregularrops) 32
782 memcpy(&devtxrxcfg.sizes, &devsizes,
sizeof(eOtransceiver_sizes_t));
802 const eOnvset_DEVcfg_t * BoardTransceiver::getNVset_DEVcfg(yarp::os::Searchable &config)
805 const eOnvset_DEVcfg_t* nvsetdevcfg = NULL;
811 eOprotconfig_cfg_t protcfg;
812 memcpy(&protcfg, &eo_protconfig_cfg_default,
sizeof(eOprotconfig_cfg_t));
816 protcfg.board = get_protBRDnumber();
820 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: entire PROTOCOL group ... using max capabilities";
827 if(
false == config.check(
"endpointManagementIsSupported"))
829 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of entire MN endpoint ... enabled w/ max capabilities" <<
830 " (comm, appl) = (" << protcfg.en_mn_entity_comm_numberof <<
", " << protcfg.en_mn_entity_appl_numberof <<
")";
832 else if((
false == config.check(
"entityMNcommunicationNumberOf")) || (
false == config.check(
"entityMNapplicationNumberOf")))
834 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of some MN entities ... using max capabilities" <<
835 " (comm, appl) = (" << protcfg.en_mn_entity_comm_numberof <<
", " << protcfg.en_mn_entity_appl_numberof <<
")";
840 number = config.find(
"endpointManagementIsSupported").asInt32();
841 protcfg.ep_management_is_present = (0 == number) ? (eobool_false) : (eobool_true);
842 if(eobool_true == protcfg.ep_management_is_present)
844 protcfg.en_mn_entity_comm_numberof = config.find(
"entityMNcommunicationNumberOf").asInt32();
845 protcfg.en_mn_entity_appl_numberof = config.find(
"entityMNapplicationNumberOf").asInt32();
849 protcfg.en_mn_entity_comm_numberof = 0;
850 protcfg.en_mn_entity_appl_numberof = 0;
853 if((protcfg.en_mn_entity_comm_numberof > 1) || (protcfg.en_mn_entity_appl_numberof > 1))
855 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" has: a strange number of MN entities" <<
856 " (comm, appl) = (" << protcfg.en_mn_entity_comm_numberof <<
", " << protcfg.en_mn_entity_appl_numberof <<
")";
862 if(
false == config.check(
"endpointMotionControlIsSupported"))
864 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of entire MC endpoint ... enabled w/ max capabilities" <<
865 " (joint, motor, contr) = (" << protcfg.en_mc_entity_joint_numberof <<
", " << protcfg.en_mc_entity_motor_numberof <<
866 ", " << protcfg.en_mc_entity_controller_numberof <<
")";
868 else if((
false == config.check(
"entityMCjointNumberOf")) || (
false == config.check(
"entityMCmotorNumberOf")) ||
869 (
false == config.check(
"entityMCmotorNumberOf")))
871 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of some MC entities ... using max capabilities" <<
872 " (joint, motor, contr) = (" << protcfg.en_mc_entity_joint_numberof <<
", " << protcfg.en_mc_entity_motor_numberof <<
873 ", " << protcfg.en_mc_entity_controller_numberof <<
")";
877 number = config.find(
"endpointMotionControlIsSupported").asInt32();
878 protcfg.ep_motioncontrol_is_present = (0 == number) ? (eobool_false) : (eobool_true);
879 if(eobool_true == protcfg.ep_motioncontrol_is_present)
881 protcfg.en_mc_entity_joint_numberof = config.find(
"entityMCjointNumberOf").asInt32();
882 protcfg.en_mc_entity_motor_numberof = config.find(
"entityMCmotorNumberOf").asInt32();
883 protcfg.en_mc_entity_controller_numberof = config.find(
"entityMCcontrollerNumberOf").asInt32();
887 protcfg.en_mc_entity_joint_numberof = 0;
888 protcfg.en_mc_entity_motor_numberof = 0;
889 protcfg.en_mc_entity_controller_numberof = 0;
892 if((protcfg.en_mc_entity_joint_numberof > 16) || (protcfg.en_mc_entity_motor_numberof > 16) ||
893 (protcfg.en_mc_entity_controller_numberof > 1))
895 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" has: a strange number of MC entities" <<
896 " (joint, motor, contr) = (" << protcfg.en_mc_entity_joint_numberof <<
", " << protcfg.en_mc_entity_motor_numberof <<
897 ", " << protcfg.en_mc_entity_controller_numberof <<
")";
902 if(
false == config.check(
"endpointAnalogSensorsIsSupported"))
904 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of entire AS endpoint ... enabled w/ max capabilities" <<
905 " (strain, mais, extorque) = (" << protcfg.en_as_entity_strain_numberof <<
", " << protcfg.en_as_entity_mais_numberof <<
906 ", " << protcfg.en_as_entity_extorque_numberof <<
")";
908 else if((
false == config.check(
"entityASstrainNumberOf")) || (
false == config.check(
"entityASmaisNumberOf")) ||
909 (
false == config.check(
"entityASextorqueNumberOf")))
911 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of some AS entities ... using max capabilities" <<
912 " (strain, mais, extorque) = (" << protcfg.en_as_entity_strain_numberof <<
", " << protcfg.en_as_entity_mais_numberof <<
913 ", " << protcfg.en_as_entity_extorque_numberof <<
")";
917 number = config.find(
"endpointAnalogSensorsIsSupported").asInt32();
918 protcfg.ep_analogsensors_is_present = (0 == number) ? (eobool_false) : (eobool_true);
919 if(eobool_true == protcfg.ep_analogsensors_is_present)
921 protcfg.en_as_entity_strain_numberof = config.find(
"entityASstrainNumberOf").asInt32();
922 protcfg.en_as_entity_mais_numberof = config.find(
"entityASmaisNumberOf").asInt32();
923 protcfg.en_as_entity_extorque_numberof = config.find(
"entityASextorqueNumberOf").asInt32();
927 protcfg.en_as_entity_strain_numberof = 0;
928 protcfg.en_as_entity_mais_numberof = 0;
929 protcfg.en_as_entity_extorque_numberof = 0;
932 if((protcfg.en_as_entity_strain_numberof > 1) || (protcfg.en_as_entity_mais_numberof > 1) ||
933 (protcfg.en_as_entity_extorque_numberof > 16))
935 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" has: a strange number of AS entities" <<
936 " (strain, mais, extorque) = (" << protcfg.en_as_entity_strain_numberof <<
", " << protcfg.en_as_entity_mais_numberof <<
937 ", " << protcfg.en_as_entity_extorque_numberof <<
")";
942 if(
false == config.check(
"endpointSkinIsSupported"))
944 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of entire SK endpoint ... enabled w/ max capabilities" <<
945 " (skin) = (" << protcfg.en_sk_entity_skin_numberof <<
")";
947 else if((
false == config.check(
"entitySKskinNumberOf")))
949 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" misses: mandatory config of some SK entities ... using max capabilities" <<
950 " (skin) = (" << protcfg.en_sk_entity_skin_numberof <<
")";
954 number = config.find(
"endpointSkinIsSupported").asInt32();
955 protcfg.ep_skin_is_present = (0 == number) ? (eobool_false) : (eobool_true);
956 if(eobool_true == protcfg.ep_skin_is_present)
958 protcfg.en_sk_entity_skin_numberof = config.find(
"entitySKskinNumberOf").asInt32();
962 protcfg.en_sk_entity_skin_numberof = 0;
965 if((protcfg.en_sk_entity_skin_numberof > 2))
967 yWarning() <<
"BoardTransceiver-> board " << get_protBRDnumber()+1 <<
" has: a strange number of SK entities" <<
968 " (skin) = (" << protcfg.en_sk_entity_skin_numberof <<
")";
973 printf(
"\nprotcfg --> bdr %d, mn = %d, mc = %d, as = %d, sk = %d ... co = %d, ap = %d, jn = %d, mt = %d, ct = %d, st = %d, ma = %d, ex = %d, sk = %d\n",
975 protcfg.ep_management_is_present, protcfg.ep_motioncontrol_is_present, protcfg.ep_analogsensors_is_present, protcfg.ep_skin_is_present,
976 protcfg.en_mn_entity_comm_numberof, protcfg.en_mn_entity_appl_numberof,
977 protcfg.en_mc_entity_joint_numberof, protcfg.en_mc_entity_motor_numberof, protcfg.en_mc_entity_controller_numberof,
978 protcfg.en_as_entity_strain_numberof, protcfg.en_as_entity_mais_numberof, protcfg.en_as_entity_extorque_numberof,
979 protcfg.en_sk_entity_skin_numberof
987 nvsetdevcfg = eo_protconfig_DEVcfg_Get(eo_protconfig_New(&protcfg));
990 if(NULL == nvsetdevcfg)
992 yError() <<
"BoardTransceiver::getNVset_DEVcfg() -> FAILS as it produces a NULL result";
1001 eOmn_appl_state_t *newstate_ptr = (eOmn_appl_state_t *)rd->data;
1003 switch(*newstate_ptr)
1005 case applstate_running:
1006 case applstate_config:
1007 case applstate_error:
1017 eOnvBRD_t brd = eo_nv_GetBRD(nv);
1021 eOprotIndex_t index = eoprot_ID2index(rd->id32);
1022 eOenum08_t* pmode = (eOenum08_t*) rd->data;
1024 eOnvID32_t id32status = eoprot_ID_get(eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint, index, eoprot_tag_mc_joint_status);
1025 eo_nvset_NV_Get(mynvset, eok_ipv4addr_localhost, id32status, &aNV);
1027 eOmc_joint_status_t jointstatus = {0};
1030 eOresult_t res = eo_nv_Get(&aNV, eo_nv_strg_volatile, &jointstatus, &size);
1031 jointstatus.interactionmodestatus = *pmode;
1032 eo_nv_Set(&aNV, &jointstatus, eobool_true, eo_nv_upd_dontdo);
void eoprot_fun_UPDT_as_strain_status_calibratedvalues(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_strain_status_uncalibratedvalues(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_mais_status_the15values(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_mc_joint_status(const EOnv *nv, const eOropdescriptor_t *rd)
void cpp_protocol_callback_incaseoferror_in_sequencenumberReceived(uint32_t remipv4addr, uint64_t rec_seqnum, uint64_t expected_seqnum)
EOnvSet * arrayofnvsets[16]
void boardtransceiver_fun_UPDT_mn_appl_cmmnds_go2state(const EOnv *nv, const eOropdescriptor_t *rd)
void embOBJerror(eOerrmanErrorType_t errtype, eOid08_t taskid, const char *eobjstr, const char *info)
void eoy_initialise(void)
void boardtransceiver_fun_UPDT_mc_joint_cmmnds_interactionmode(const EOnv *nv, const eOropdescriptor_t *rd)
virtual void onMsgReception(uint8_t *data, uint16_t size)
bool init(yarp::os::Searchable &config, uint32_t localipaddr, uint32_t remoteipaddr, uint16_t ipport, uint16_t pktsize, FEAT_boardnumber_t board_n)
bool createSocket(ACE_INET_Addr local_addr)
bool configure(yarp::os::ResourceFinder &rf)
void fromDouble(ACE_Time_Value &v, double x, int unit)
void getTransmit(uint8_t **data, uint16_t *size)
eOprotBRD_t get_protBRDnumber(void)