Versionen im Vergleich
Schlüssel
- Diese Zeile wurde hinzugefügt.
- Diese Zeile wurde entfernt.
- Formatierung wurde geändert.
Overview
The „ecmasterlib“ offers an easy way to use EtherCAT with EEROS or in a standalone project.
EtherCAT stack: The EtherCAT stack from Acontis, see 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 data on the bus. It provides the following basic interfaces
Elmo.hpp: An interface for Elmo drives
Beckhoff/EL1008.hpp: An interface for digital input terminal
Beckhoff/EL2008.hpp: An interface for digital output terminal
Beckhoff/EL3004.hpp: An interface for analog input terminal
Beckhoff/EL4004.hpp: An interface for analog output terminal
| Warnung |
|---|
The devices only work with the same PDO configuration/Eni file. If different PDO's are used, a new interface must be implemented. |
You may need to implement your own interfaces for other drives and terminals.
Image Added
Installation
Once the EtherCAT stack has been installed and the demo application is running, the ecmasterlib can be installed.
| Codeblock | ||
|---|---|---|
| ||
cd path/to/working/directory git clone https://gitlab.ost.ch/tech/inf/public/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 cd build-x86-64 cmake -DCMAKE_INSTALL_PREFIX=/absolute/path/to/working/directory/install-x86-64 .. make make install |
Device Interface
The ecmasterlib offers device interfaces for Elmo drives. To use this interface, the PDO's must be correctly configured. This can be done e.g. with ECEngineer. TODO link ELMO
Elmo.hpp: An interface for Elmo drives
Beckhoff/EL1008.hpp: An interface for digital input terminal
Beckhoff/EL2008.hpp: An interface for digital output terminal
Beckhoff/EL3004.hpp: An interface for analog input terminal
Beckhoff/EL4004.hpp: An interface for analog output terminal
| Warnung |
|---|
The devices only work with the same PDO configuration/Eni file. If different PDO's are used, a new interface must be implemented. |
Functionality
The examples show how to use the interfaces, e.g.
| Codeblock | ||
|---|---|---|
| ||
ecmasterlib::device::beckhoff::EL1008 inputs{};
auto &stack = ecmasterlib::EcMasterlibMain::createInstance(argc, argv, inputs);
std::cout << inputs[0] << std::endl; // reads first digital input channel |
You create an interface instance which must be passed to the EtherCAT stack. See the examples within ecmasterlib. Elmo drives could be used as follows
| Codeblock | ||
|---|---|---|
| ||
ecmasterlib::device::Elmo drive{};
auto &stack = ecmasterlib::EcMasterlibMain::createInstance(argc, argv, drive);
sleep(10);
std::cout << "init start\n";
drive.init([&stack]() { stack.sync(); });
drive.setMode(ecmasterlib::device::Elmo::Mode::PROFILE_VELOCITY);
drive.setTargetVelocity(1000);
drive.setMaximumTorque(300);
std::cout << "loop start\n";
while(stack.isRunning()) {
std::cout << "Current Position: " << drive.getPosition() << '\n';
sleep(1);
} |
Modifications
If you switch to other drives or terminals or if you want to transmit a different set of PDOs, you have to undertake the following steps
Create or modify ENI-Files
Create or modify interface files accordingly
| Panel | ||
|---|---|---|
| ||
|