extern void eom_emsappl_hid_userdef_on_exit_RUN(EOMtheEMSappl* p)
{    
    // EOtheCANservice: set straigth mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  
  
    
    // stop services 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
    
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
}
Esempio n. 2
0
extern void eom_emsappl_hid_userdef_on_exit_RUN(EOMtheEMSappl* p)
{
    eOresult_t res = eores_NOK_generic;
    
    // set run mode straigth. then read all can frames received
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    const uint8_t maxframes2read = 255; // 255 is the max number possible. the function however exits when all canframes are 
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport1, maxframes2read, NULL);    
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport2, maxframes2read, NULL);
  
    
    // stop skin. the check whether to stop skin or not is done internally.
    eo_skin_DisableTX(eo_skin_GetHandle());


    // stop motion control
    res = eo_emsapplBody_DisableTxAllJointOnCan(eo_emsapplBody_GetHandle());
    if (eores_NOK_generic == res)
	{
		// handle the error ... not important
    }
    
    // stop tx of strain, if present
    eo_strain_DisableTX(eo_strain_GetHandle());        
}
Esempio n. 3
0
extern void eom_emsappl_hid_userdef_on_entry_RUN(EOMtheEMSappl* p)
{
    eOresult_t res = eores_NOK_generic;
    
    // enable joints
    res = eo_emsapplBody_EnableTxAllJointOnCan(eo_emsapplBody_GetHandle());
    if (eores_NOK_generic == res)
    {
        //handle the error
    }
    
    // enable the tx mode of strain, if present and as configured
    eo_strain_SendTXmode(eo_strain_GetHandle());
    
    // pulse led3 forever at 1 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/1, 0); 
     
    // set mode on demand. then tx all canframes remained in the tx queue
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_ondemand);
   
    eo_canserv_TXstart(eo_canserv_GetHandle(), eOcanport1, NULL);    
    eo_canserv_TXstart(eo_canserv_GetHandle(), eOcanport2, NULL);    
    
    eo_canserv_TXwaituntildone(eo_canserv_GetHandle(), eOcanport1, 5*eok_reltime1ms);
    eo_canserv_TXwaituntildone(eo_canserv_GetHandle(), eOcanport2, 5*eok_reltime1ms);

    // Start reading the encoders
    eo_appEncReader_StartRead(eo_emsapplBody_GetEncoderReader(eo_emsapplBody_GetHandle()));
}
Esempio n. 4
0
extern void eom_emsappl_hid_userdef_on_entry_ERR(EOMtheEMSappl* p)
{
    // pulse led3 forever at 4 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/4, 0);
   
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    const uint8_t maxframes2read = 255; // 255 is the max number possible. the function however exits when all canframes are 
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport1, maxframes2read, NULL);    
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport2, maxframes2read, NULL);
}
Esempio n. 5
0
extern void eom_emsappl_hid_userdef_on_entry_CFG(EOMtheEMSappl* p)
{    
    // pulse led3 forever at 0.50 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, 2*EOK_reltime1sec, 0);

    // set the EOtheCANservice to be on event and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    const uint8_t maxframes2read = 255; // 255 is the max number possible. the function however exits when all canframes are 
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport1, maxframes2read, NULL);    
    eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport2, maxframes2read, NULL);
 
}
// marco.accame on Nov 26 2014: the user-defined emsconfigurator_evt_userdef00 is triggered by the EOtheEMSapplBody to
// tell the EOMtheEMSconfigurator that has received a CAN frame.
extern void eom_emsconfigurator_hid_userdef_ProcessUserdef00Event(EOMtheEMSconfigurator* p)
{
    static uint32_t count_msg = 0;
    count_msg++;
    
   // in here we want to read all can frames that we have on can1 (can2 is not supported on MC4plus)  
    uint8_t numofrxframes = 0;
    
    if(0 != (numofrxframes = eo_canserv_NumberOfFramesInRXqueue(eo_canserv_GetHandle(), eOcanport1)))
    {
        eo_canserv_Parse(eo_canserv_GetHandle(), eOcanport1, numofrxframes, NULL);        
    }
}
Esempio n. 7
0
extern void eom_emsappl_hid_userdef_on_entry_RUN(EOMtheEMSappl* p)
{
    // pulse led3 forever at 1 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/1, 0);  
    
    // EOtheCANservice: set on demand mode. then tx all canframes remained in the tx queues
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_ondemand);    
    eo_canserv_TXstartAll(eo_canserv_GetHandle(), NULL, NULL);
    eo_canserv_TXwaitAllUntilDone(eo_canserv_GetHandle(), 5*eok_reltime1ms);
    
    // tell the ethmonitor to alert no task, because the runner will tick it now at every cycle
//    eo_ethmonitor_SetAlert(eo_ethmonitor_GetHandle(), NULL, 0);

    // we dont start services.
}
Esempio n. 8
0
extern void eom_emsappl_hid_userdef_on_entry_CFG(EOMtheEMSappl* p)
{    
    // pulse led3 forever at 0.50 hz.       
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, 2*EOK_reltime1sec, 0);

    // EOtheCANservice: set straight mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());
    
    // tell the ethmonitor to alert the task of the configurator
//    eo_ethmonitor_SetAlert(eo_ethmonitor_GetHandle(), eom_emsconfigurator_GetTask(eom_emsconfigurator_GetHandle()), emsconfigurator_evt_userdef02);
    
    // prefer sending a tx request just in case. because cfg state transmit only if requested an we dont want to have missed a previous request.
    eom_task_SetEvent(eom_emsconfigurator_GetTask(eom_emsconfigurator_GetHandle()), emsconfigurator_evt_ropframeTx);    
}
Esempio n. 9
0
extern void eom_emsappl_hid_userdef_on_entry_ERR(EOMtheEMSappl* p)
{
    // pulse led3 forever at 4 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/4, 0);
   

    // EOtheCANservice: set straight mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  

    
    
    // stop services which may have been started 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
        
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
    
    // inertials3
    eo_inertials3_Stop(eo_inertials3_GetHandle());    
    eo_inertials3_Deactivate(eo_inertials3_GetHandle());
    
    // temperatures
    eo_temperatures_Stop(eo_temperatures_GetHandle());    
    eo_temperatures_Deactivate(eo_temperatures_GetHandle());     
}