This class provides a CPP interface to the SimpleOpenEthercatMaster library Given the name of an ethernet device, such as "eth0", it will connect, start a thread that cycles data around the network, and provide read/write access to the underlying io map. More...
#include <ethercat_manager.h>
Public Member Functions | |
EtherCatManager (const std::string &ifname) | |
Constructs and initializes the ethercat slaves on a given network interface. | |
uint8_t | readInput (int slave_no, uint8_t channel) const |
Reads the "channel-th" input-register of the given slave no. | |
uint8_t | readOutput (int slave_no, uint8_t channel) const |
Reads the "channel-th" output-register of the given slave no. | |
void | write (int slave_no, uint8_t channel, uint8_t value) |
writes 'value' to the 'channel-th' output-register of the given 'slave' | |
~EtherCatManager () | |
Private Member Functions | |
bool | initSoem (const std::string &ifname) |
Private Attributes | |
boost::thread | cycle_thread_ |
const std::string | ifname_ |
boost::scoped_array< uint8_t > | iomap_ |
boost::mutex | iomap_mutex_ |
bool | stop_flag_ |
This class provides a CPP interface to the SimpleOpenEthercatMaster library Given the name of an ethernet device, such as "eth0", it will connect, start a thread that cycles data around the network, and provide read/write access to the underlying io map.
Please note that as used in these docs, 'Input' and 'Output' are relative to your program. So the 'Output' registers are the ones you write to, for example.
Definition at line 37 of file ethercat_manager.h.
robotiq_ethercat::EtherCatManager::EtherCatManager | ( | const std::string & | ifname | ) |
Constructs and initializes the ethercat slaves on a given network interface.
[in] | ifname | the name of the network interface that the ethercat chain is connected to (i.e. "eth0") |
Constructor can throw EtherCatError exception if SOEM could not be initialized.
Definition at line 111 of file ethercat_manager.cpp.
Definition at line 128 of file ethercat_manager.cpp.
bool robotiq_ethercat::EtherCatManager::initSoem | ( | const std::string & | ifname | ) | [private] |
Definition at line 153 of file ethercat_manager.cpp.
uint8_t robotiq_ethercat::EtherCatManager::readInput | ( | int | slave_no, |
uint8_t | channel | ||
) | const |
Reads the "channel-th" input-register of the given slave no.
[in] | slave_no | The slave number of the device to read from (>= 1) |
[in] | channel | The byte offset into the input IOMap to read from |
Definition at line 141 of file ethercat_manager.cpp.
uint8_t robotiq_ethercat::EtherCatManager::readOutput | ( | int | slave_no, |
uint8_t | channel | ||
) | const |
Reads the "channel-th" output-register of the given slave no.
[in] | slave_no | The slave number of the device to read from (>= 1) |
[in] | channel | The byte offset into the output IOMap to read from |
Definition at line 147 of file ethercat_manager.cpp.
void robotiq_ethercat::EtherCatManager::write | ( | int | slave_no, |
uint8_t | channel, | ||
uint8_t | value | ||
) |
writes 'value' to the 'channel-th' output-register of the given 'slave'
[in] | slave_no | The slave number of the device to write to (>= 1) |
[in] | channel | The byte offset into the output IOMap to write value to |
[in] | value | The byte value to write |
This method currently makes no attempt to catch out of bounds errors. Make sure you know your IOMap bounds.
Definition at line 135 of file ethercat_manager.cpp.
boost::thread robotiq_ethercat::EtherCatManager::cycle_thread_ [private] |
Definition at line 86 of file ethercat_manager.h.
const std::string robotiq_ethercat::EtherCatManager::ifname_ [private] |
Definition at line 84 of file ethercat_manager.h.
boost::scoped_array<uint8_t> robotiq_ethercat::EtherCatManager::iomap_ [private] |
Definition at line 85 of file ethercat_manager.h.
boost::mutex robotiq_ethercat::EtherCatManager::iomap_mutex_ [mutable, private] |
Definition at line 87 of file ethercat_manager.h.
bool robotiq_ethercat::EtherCatManager::stop_flag_ [private] |
Definition at line 88 of file ethercat_manager.h.