Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
embedded_systems:ethercat:ethercatinterface [2019-04-16 11:20]
mgehrig2
embedded_systems:ethercat:ethercatinterface [2019-06-26 15:47] (aktuell)
Graf Urs
Zeile 1: Zeile 1:
-====== ​EtherCatInterface and ecmasterlib ======+====== ecmasterlib ​and EtherCATInterface ​======
 ===== Overview ===== ===== Overview =====
 {{ :​embedded_systems:​ethercat:​ethercatinterfaceelmo_inheritance.png?​direct&​|}} {{ :​embedded_systems:​ethercat:​ethercatinterfaceelmo_inheritance.png?​direct&​|}}
  
-The //"ecmasterilb"// and //"EtherCatInterface"// offer a relative easy way to use EtherCAT with EEROS or in standalone project.+The //"ecmasterlib"// and //"EtherCATInterface"// offer a relative easy way to use EtherCAT with [[http://​eeros.org/​|EEROS]] or in standalone project. ​
  
   * **EEROS**: The robotic framework   * **EEROS**: The robotic framework
-  * **EtherCAT stack**: The EtherCAT stack from Acontis. Detailed describtion ​[[https://​wiki.ntb.ch/​infoportal/​embedded_systems/​ethercat/understanding_acontis | here]] +  * **EtherCAT stack**: The EtherCAT stack from Acontis, see [[embedded_systems:ethercat:understanding_acontis|The Acontis EtherCAT Stack]]. 
-  * **ecmasterlib**:​ This library provides an easy interface to the EtherCAT stack. The library initializes the stack and takes over the periodic sending and receiving of the bus data. It provides the following ​interfaces: +  * **ecmasterlib**:​ This library provides an easy interface to the EtherCAT stack. The library initializes the stack and takes over the periodic sending and receiving of the bus data. It provides the following ​basic interface: **[[embedded_systems:​ethercat:​ethercatinterface:​EtherCATInterfaceBase]]** 
-    * **EtherCATInterfaceBase**: Basic interface for //​ecmasterlib//​ +  * **EtherCATInterfaceElmo**: ​An interface based on //​EtherCATInterfaceBase//​ designed for Elmo drives. See **[[embedded_systems:​ethercat:​ethercatinterface:​EtherCATInterfaceElmo]]** for details. You may need to implement your own interface for different drives. ​the interface further includes to EEROS blocks for the control system: 
-    * **EtherCATInterfaceElmo**: ​Based on //​EtherCATInterfaceBase//​. An interface ​designed for Elmo drives. You may need to implement your own interface for different drives. +    * **getDrivesBlock**: ​It has a signal output for every PDO input value (i.e. encoder values). You may need to modify this block in your application. 
-    ​* **EtherCATInterfaceElmo_config** +    * **setDrivesBlock**: ​It has a signal input for every PDO output value (i.e. setTorque). You may need to modify this block in your application.
-  ​* **getDrivesBlock**: ​EEROS-block in control system. I has a signal output for every PDO input value (i.e. encoder values). You may need to modify this block in your application. +
-  * **setDrivesBlock**: ​EEROS-block in control system. I has a signal input for every PDO output value (i.e. setTorque). You may need to modify this block in your application.+
    
  
 ===== Installation ===== ===== Installation =====
-==== Install ​EtherCAT ​==== +Please make sure that you have previously installed the EtherCAT ​stack software and EEROS beforehand. Install EEROS as described in [[http://wiki.eeros.org/getting_started/compile_eeros|this tutorial]], but use the command line option ''​-DUSE_ETHERCAT=TRUE''​ when calling cmake
-First, read [[https://wiki.ntb.ch/infoportal/embedded_systems/​ethercat/​start ​| this tutorial]] ​on how to install EtherCAT on your system and how to run a demo application without EEROS+<​code>​ 
- +... 
-If the demo application runs successfully,​ install ​//ecmasterlib//. +cmake -DCMAKE_INSTALL_PREFIX=/absolute/path/to/working/​directory/​install-x86-64 -DUSE_ETHERCAT=TRUE .
 +... 
 +</​code>​
  
 ==== Install ecmasterlib ==== ==== Install ecmasterlib ====
-Once the EtherCAT stack has been installed and the demo application is running, the //​ecmasterlib//​ can be installed.+Once the EtherCAT stack has been installed and the demo application is running, the //​ecmasterlib//​ can be installed. ​
  
-Clone, build and install //​ecmasterlib//​ 
-TODO:​(URL) ​ 
 <​code>​ <​code>​
 $ cd path/​to/​working/​directory $ cd path/​to/​working/​directory
-$ git clone url-to-ecmasterlib+$ git clone https://​github.com/​ntb-ch/ecmasterlib.git
 $ cd ecmasterlib $ cd ecmasterlib
 +$ mkdir externalLib
 +$ cp ''<​classB_path>''/​SDK/​LIB/​Linux/​x64/​libAtemRasSrv.a externalLib
 +$ cp ''<​classB_path>''/​SDK/​LIB/​Linux/​x64/​libEcMaster.a externalLib
 $ mkdir build-x86-64 $ mkdir build-x86-64
 $ cd build-x86-64 $ cd build-x86-64
Zeile 38: Zeile 38:
 </​code>​ </​code>​
  
- +==== Install ​EtherCATInterfaceElmo ​====
-==== Install ​EEROS ==== +
-Install EEROS as described in [[http://​wiki.eeros.org/​getting_started/​compile_eeros|this tutorial]], but use the command line option ''​-DUSE_ETHERCAT=TRUE''​ when calling cmake.+
 <​code>​ <​code>​
-... +$ cd path/​to/​working/​directory 
-cmake -DCMAKE_INSTALL_PREFIX=/​absolute/​path/​to/​working/​directory/​install-x86-64 ​-DUSE_ETHERCAT=TRUE ​.. +$ git clone https://​github.com/​ntb-ch/​ethercatinterfaceelmo.git 
-...+$ cd EtherCATInterfaceElmo 
 +$ mkdir build-x86-64 
 +$ cd build-x86-64 
 +cmake -DCMAKE_INSTALL_PREFIX=/​absolute/​path/​to/​working/​directory/​install-x86-64 .. 
 +$ make 
 +$ make install
 </​code>​ </​code>​
 +
 +===== Functionality =====
 +The //"​ecmasterlib"//​ provides a callback function (''​void callbackFct(...)''​) which is called by the Acontis stack once per EtherCAT cycle.
 +This method:
 +  * Copies the received data from the stack into the receive buffer of //"​ecmasterlib"//​
 +  * Copies the data to be sent from the send buffer of //"​ecmasterlib"//​ to the stack.
 +
 +The receive and send buffers of //"​ecmasterlib"//​ are byte arrays (''​uint8_t* inBuffer; uint8_t* outBuffer;''​) which are the same size as the PDOs.
 +
 +The //"​ecmasterlib"//​ also provides a condition variable (''​std::​condition_variable cv;''​) to synchronize the user application (i.e. EEROS).
 +
 +When an //"​ecmasterlib"//​ object is created, an instance (monotonic) is created.
 +The stack is started in the same way as in the //"​EcMasterDemoDC"//​ of Acontis.
 +
  
  
Zeile 55: Zeile 72:
  
 ===== Attachment ===== ===== Attachment =====
-{{:​embedded_systems:​ethercat:​diagram_ethercatinterface.rar|Download diagram}}+{{:​embedded_systems:​ethercat:​diagram_ethercatinterface.rar|Class Hierarchy}}