static void* s_eocanprotASperiodic_get_entity(eOprotEndpoint_t endpoint, eOprot_entity_t entity, eOcanframe_t *frame, eOcanport_t port, uint8_t *index)
{
    void * ret = NULL;
    uint8_t ii = 0;
    eObrd_canlocation_t loc = {0};
    
    loc.port = port;
    loc.addr = EOCANPROT_FRAME_GET_SOURCE(frame);    
    loc.insideindex = eobrd_caninsideindex_none;
    
    ii = eo_canmap_GetEntityIndexExtraCheck(eo_canmap_GetHandle(), loc, endpoint, entity);
    
    if(EOK_uint08dummy == ii)
    {     
        //#warning -> TODO: add diagnostics about not found board as in s_eo_icubCanProto_mb_send_runtime_error_diagnostics()
        return(NULL);
    }
    
    ret = eoprot_entity_ramof_get(eoprot_board_localboard, endpoint, entity, ii);
    
    if(NULL != index)
    {
        *index = ii;        
    }  

    return(ret);   
}
예제 #2
0
extern void* eo_nvset_RAMofEntity_Get(EOnvSet* p, eOnvEP8_t ep8, eOnvENT_t ent, uint8_t index)
{
    if((NULL == p)) 
    {
        return(NULL); 
    }
    
    // get directly the ram using the eoprot function.     
    return(eoprot_entity_ramof_get(p->theboard.boardnum, ep8, ent, index));
}
extern eOmc_joint_config_t * eo_protocolwrapper_GetJointConfig(EOtheProtocolWrapper *p, eOmc_jointId_t id)
{
    // don't do any control on p, as ... it is a dummy object
    eOmc_joint_config_t *ret = NULL;    
    eOmc_joint_t *jo = (eOmc_joint_t *)eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint, (eOprotIndex_t)id);
    
    if(NULL != jo)
    {
        ret = &(jo->config);
    }

    return(ret);
}
extern eOsk_status_t * eo_protocolwrapper_GetSkinStatus(EOtheProtocolWrapper *p, eOsk_skinId_t id)
{
    // don't do any control on p, as ... it is a dummy object
    eOsk_status_t *ret = NULL;    
    eOsk_skin_t *sk = (eOsk_skin_t *)eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_skin, eosk_entity_skin, (eOprotIndex_t)id);
    
    if(NULL != sk)
    {
        ret = &(sk->status);
    }

    return(ret);
}
extern eOas_strain_status_t * eo_protocolwrapper_GetStrainStatus(EOtheProtocolWrapper *p, eOas_strainId_t id)
{
    // don't do any control on p, as ... it is a dummy object
    eOas_strain_status_t *ret = NULL;    
    eOas_strain_t *st = (eOas_strain_t *)eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_strain, (eOprotIndex_t)id);
    
    if(NULL != st)
    {
        ret = &(st->status);
    }

    return(ret);
}
extern eOas_mais_config_t * eo_protocolwrapper_GetMaisConfig(EOtheProtocolWrapper *p, eOas_maisId_t id)
{
    // don't do any control on p, as ... it is a dummy object
    eOas_mais_config_t *ret = NULL;    
    eOas_mais_t *ma = (eOas_mais_t *)eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_mais, (eOprotIndex_t)id);
    
    if(NULL != ma)
    {
        ret = &(ma->config);
    }

    return(ret);
}
extern eOmc_motor_status_t * eo_protocolwrapper_GetMotorStatus(EOtheProtocolWrapper *p, eOmc_motorId_t id)
{
    // don't do any control on p, as ... it is a dummy object
    eOmc_motor_status_t *ret = NULL;    
    eOmc_motor_t *mo = (eOmc_motor_t *)eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor, (eOprotIndex_t)id);
    
    if(NULL != mo)
    {
        ret = &(mo->status);
    }

    return(ret);
}
예제 #8
0
extern EOCurrentsWatchdog* eo_currents_watchdog_Initialise(void)
{
    uint8_t m;
    //reserve memory for the number of thresholds needed
    s_eo_currents_watchdog.numberofmotors = eo_entities_NumOfMotors(eo_entities_GetHandle());
    
    if (s_eo_currents_watchdog.numberofmotors == 0)
        return NULL;

    s_eo_currents_watchdog.themotors = (eOmc_motor_t**) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(eOmc_motor_t*), s_eo_currents_watchdog.numberofmotors);
    // retrieve pointers to motors   
    for(m=0; m<s_eo_currents_watchdog.numberofmotors; m++)
    {
        s_eo_currents_watchdog.themotors[m] = eo_entities_GetMotor(eo_entities_GetHandle(), m);
    }
    
    
    s_eo_currents_watchdog.nominalCurrent2 = (float*) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.nominalCurrent2, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    s_eo_currents_watchdog.I2T_threshold = (float*) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.I2T_threshold, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    s_eo_currents_watchdog.avgCurrent = (eoCurrentWD_averageData_t*) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(eoCurrentWD_averageData_t), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.avgCurrent, 0, s_eo_currents_watchdog.numberofmotors*sizeof(eoCurrentWD_averageData_t));

    s_eo_currents_watchdog.accomulatorEp = (float*) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.accomulatorEp, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    s_eo_currents_watchdog.motorinI2Tfault = (eObool_t*) eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(eObool_t), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.motorinI2Tfault, 0, s_eo_currents_watchdog.numberofmotors*sizeof(eObool_t)); //all motors are not in I2t fault

    s_eo_currents_watchdog.initted = eobool_true;
    
    suppliedVoltage_counter = 0;
    nv_controller_ptr = (eOmc_controller_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_controller, 0);
    
    if(nv_controller_ptr == NULL)
        return NULL;
    
    
    return(&s_eo_currents_watchdog);
}
extern EOCurrentsWatchdog* eo_currents_watchdog_Initialise(void)
{
    uint8_t m;
    //reserve memory for the number of thresholds needed
    s_eo_currents_watchdog.numberofmotors = eo_entities_NumOfJoints(eo_entities_GetHandle());
    
    if (s_eo_currents_watchdog.numberofmotors == 0)
        return NULL;

    s_eo_currents_watchdog.themotors = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(eOmc_motor_t*), s_eo_currents_watchdog.numberofmotors);
    // retrieve pointers to motors   
    for(m=0; m<s_eo_currents_watchdog.numberofmotors; m++)
    {
        s_eo_currents_watchdog.themotors[m] = eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor, m);
    }
    
    
    s_eo_currents_watchdog.nominalCurrent2 = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.nominalCurrent2, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    s_eo_currents_watchdog.I2T_threshold = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.I2T_threshold, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    //s_eo_currents_watchdog.filter_reg = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    //memset(s_eo_currents_watchdog.filter_reg, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));
    
    s_eo_currents_watchdog.avgCurrent = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(eoCurrentWD_averageData_t), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.avgCurrent, 0, s_eo_currents_watchdog.numberofmotors*sizeof(eoCurrentWD_averageData_t));

    s_eo_currents_watchdog.accomulatorEp = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeof(float), s_eo_currents_watchdog.numberofmotors);
    memset(s_eo_currents_watchdog.accomulatorEp, 0, s_eo_currents_watchdog.numberofmotors*sizeof(float));

    s_eo_currents_watchdog.initted = eobool_true;
    
    return(&s_eo_currents_watchdog);
}
예제 #10
0
extern eOresult_t eo_entities_Reset(EOtheEntities *p)
{
    uint8_t i=0;
    uint8_t max = 0;
    
    memset(s_eo_theentities.joints, 0, sizeof(s_eo_theentities.joints));
    memset(s_eo_theentities.motors, 0, sizeof(s_eo_theentities.motors));
    memset(s_eo_theentities.skins, 0, sizeof(s_eo_theentities.skins));
    memset(s_eo_theentities.strains, 0, sizeof(s_eo_theentities.strains));
    memset(s_eo_theentities.maises, 0, sizeof(s_eo_theentities.maises));
    memset(s_eo_theentities.temperatures, 0, sizeof(s_eo_theentities.temperatures));
    memset(s_eo_theentities.inertials, 0, sizeof(s_eo_theentities.inertials));
    memset(s_eo_theentities.inertials3, 0, sizeof(s_eo_theentities.inertials3));
    
    // joints
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint);
    if(max>eoprotwrap_max_joints) max = eoprotwrap_max_joints;
    s_eo_theentities.numofjoints = 0;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.joints[i] = (eOmc_joint_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint, (eOprotIndex_t)i);
    }
    
    // motors
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor);
    s_eo_theentities.numofmotors = 0;
    if(max>eoprotwrap_max_motors) max = eoprotwrap_max_motors;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.motors[i] = (eOmc_motor_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_motioncontrol, eoprot_entity_mc_motor, (eOprotIndex_t)i);
    } 
    
    // skins
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_skin, eoprot_entity_sk_skin);
    s_eo_theentities.numofskins = 0;
    if(max>eoprotwrap_max_skins) max = eoprotwrap_max_skins;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.skins[i] = (eOsk_skin_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_skin, eoprot_entity_sk_skin, (eOprotIndex_t)i);
    }  
    
    // strains
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_strain);
    s_eo_theentities.numofstrains = 0;
    if(max>eoprotwrap_max_strains) max = eoprotwrap_max_strains;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.strains[i] = (eOas_strain_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_strain, (eOprotIndex_t)i);
    }  
    
    // maises
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_mais);
    s_eo_theentities.numofmaises = 0;
    if(max>eoprotwrap_max_maises) max = eoprotwrap_max_maises;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.maises[i] = (eOas_mais_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_mais, (eOprotIndex_t)i);
    }    

    // temperatures
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_temperature);
    s_eo_theentities.numoftemperatures = 0;
    if(max>eoprotwrap_max_temperatures) max = eoprotwrap_max_temperatures;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.temperatures[i] = (eOas_temperature_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_temperature, (eOprotIndex_t)i);
    } 
    
    
    // inertials
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_inertial);
    s_eo_theentities.numofinertials = 0;
    if(max>eoprotwrap_max_inertials) max = eoprotwrap_max_inertials;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.inertials[i] = (eOas_inertial_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_inertial, (eOprotIndex_t)i);
    } 

    // inertials3
    max = eoprot_entity_numberof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_inertial3);
    s_eo_theentities.numofinertials3 = 0;
    if(max>eoprotwrap_max_inertials3) max = eoprotwrap_max_inertials3;
    for(i=0; i<max; i++)
    {
        s_eo_theentities.inertials3[i] = (eOas_inertial3_t*) eoprot_entity_ramof_get(eoprot_board_localboard, eoprot_endpoint_analogsensors, eoprot_entity_as_inertial3, (eOprotIndex_t)i);
    } 
    
    return(eores_OK);
}