35 #ifndef ETHERCAT_DEVICE_H 36 #define ETHERCAT_DEVICE_H 41 #include <ethercat/ethercat_defs.h> 42 #include <al/ethercat_slave_handler.h> 48 #include <diagnostic_msgs/DiagnosticArray.h> 108 void collect(
EthercatCom *com, EtherCAT_SlaveHandler *sh);
137 virtual void construct(EtherCAT_SlaveHandler *sh,
int &start_address);
151 virtual void packCommand(
unsigned char *buffer,
bool halt,
bool reset) {}
153 virtual bool unpackState(
unsigned char *this_buffer,
unsigned char *prev_buffer) {
return true;}
161 virtual void multiDiagnostics(vector<diagnostic_msgs::DiagnosticStatus> &vec,
unsigned char *buffer);
187 virtual bool publishTrace(
const string &reason,
unsigned level,
unsigned delay) {
return false;}
196 return writeData(com, sh_, address, buffer, length, addrMode);
202 static int readData(
EthercatCom *com, EtherCAT_SlaveHandler *sh, EC_UINT address,
void *buffer, EC_UINT length,
AddrMode addrMode);
204 return readData(com, sh_, address, buffer, length, addrMode);
210 static int readWriteData(
EthercatCom *com, EtherCAT_SlaveHandler *sh, EC_UINT address,
void *buffer, EC_UINT length,
AddrMode addrMode);
212 return readWriteData(com, sh_, address, buffer, length, addrMode);
217 EtherCAT_SlaveHandler *
sh_;
unsigned int command_size_
bool isClosed(unsigned port)
bool isGreaterThan(unsigned value) const
ROSCONSOLE_DECL void initialize()
uint8_t forwarded_rx_error[4]
pthread_mutex_t newDiagnosticsIndexLock_
et1x00_error_counters errorCountersPrev_
virtual void packCommand(unsigned char *buffer, bool halt, bool reset)
unsigned newDiagnosticsIndex_
diagnostic_updater::DiagnosticStatusWrapper diagnostic_status_
virtual bool publishTrace(const string &reason, unsigned level, unsigned delay)
Asks device to publish (motor) trace. Only works for devices that support it.
int writeData(EthercatCom *com, EC_UINT address, void const *buffer, EC_UINT length, AddrMode addrMode)
bool writeData(EthercatCom *com, EtherCAT_SlaveHandler *sh, EthercatDevice::AddrMode addrMode, unsigned num) const
pthread_mutex_t diagnosticsLock_
bool hasLink(unsigned port)
int devicesRespondingToNodeAddress_
uint64_t invalidFrameTotal
static const EC_UINT BASE_ADDR
EtherCAT_SlaveHandler * sh_
bool hasCommunication(unsigned port)
uint64_t forwardedRxErrorTotal
unsigned int status_size_
virtual bool unpackState(unsigned char *this_buffer, unsigned char *prev_buffer)
int readWriteData(EthercatCom *com, EC_UINT address, void *buffer, EC_UINT length, AddrMode addrMode)
int readData(EthercatCom *com, EC_UINT address, void *buffer, EC_UINT length, AddrMode addrMode)
struct EthercatPortDiagnostics __attribute__
bool errorCountersMayBeCleared_
bool readData(EthercatCom *com, EtherCAT_SlaveHandler *sh, EthercatDevice::AddrMode addrMode, unsigned num)