#include <ethercat_hardware.h>
Public Member Functions | |
void | collectDiagnostics () |
Collects diagnostics from all devices. | |
EthercatHardware (const std::string &name, hardware_interface::HardwareInterface *hw, const string ð, bool allow_unprogrammed) | |
Constructor. | |
const std::vector < boost::shared_ptr< const EthercatDevice > > | getSlaves () const |
void | init () |
Initialize the EtherCAT Master Library. | |
void | printCounters (std::ostream &os=std::cout) |
bool | publishTrace (int position, const string &reason, unsigned level, unsigned delay) |
Ask one or all EtherCAT devices to publish (motor) traces. | |
bool | txandrx_PD (unsigned buffer_size, unsigned char *buffer, unsigned tries) |
Send process data. | |
void | update (bool reset, bool halt) |
Send most recent motor commands and retrieve updates. This command must be run at a sufficient rate or else the motors will be disabled. | |
~EthercatHardware () | |
Destructor. | |
Static Public Member Functions | |
static std::vector < EtherCAT_SlaveHandler > | scanPort (const std::string ð) |
Scans the network and gives a list of detected devices on a given ethercat port. | |
Public Attributes | |
hardware_interface::HardwareInterface * | hw_ |
Private Member Functions | |
boost::shared_ptr< EthercatDevice > | configNonEthercatDevice (const std::string &product_id, const std::string &data) |
boost::shared_ptr< EthercatDevice > | configSlave (EtherCAT_SlaveHandler *sh) |
void | haltMotors (bool error, const char *reason) |
void | loadNonEthercatDevices () |
void | publishDiagnostics () |
Collects raw diagnostics data and passes it to diagnostics_publisher. | |
bool | setRouterToSlaveHandlers () |
Static Private Member Functions | |
static void | changeState (EtherCAT_SlaveHandler *sh, EC_State new_state) |
static void | updateAccMax (double &max, const accumulator_set< double, stats< tag::max, tag::mean > > &acc) |
Private Attributes | |
bool | allow_unprogrammed_ |
if the driver should treat the discovery of unprogrammed boards as a fatal error. Set to 'true' during board configuration, and set to 'false' otherwise. | |
EtherCAT_AL * | application_layer_ |
unsigned int | buffer_size_ |
unsigned char * | buffers_ |
pluginlib::ClassLoader < EthercatDevice > | device_loader_ |
EthercatHardwareDiagnostics | diagnostics_ |
EthercatHardwareDiagnosticsPublisher | diagnostics_publisher_ |
EtherCAT_Master * | ethercat_master_ |
bool | halt_motors_ |
string | interface_ |
The socket interface that is connected to the EtherCAT devices (e.g., eth0) | |
ros::Time | last_published_ |
ros::Time | last_reset_ |
EtherCAT_DataLinkLayer | m_dll_instance_ |
EC_Logic | m_logic_instance_ |
EtherCAT_Router * | m_router_ |
unsigned | max_pd_retries_ |
Max number of times to retry sending process data before halting motors. | |
realtime_tools::RealtimePublisher < std_msgs::Bool > | motor_publisher_ |
struct netif * | ni_ |
ros::NodeHandle | node_ |
unsigned int | num_ethercat_devices_ |
EthercatOobCom * | oob_com_ |
EtherCAT_PD_Buffer | pd_buffer_ |
unsigned char * | prev_buffer_ |
unsigned int | reset_state_ |
std::vector< boost::shared_ptr < EthercatDevice > > | slaves_ |
int | start_address_ |
unsigned char * | this_buffer_ |
unsigned | timeout_ |
Timeout (in microseconds) to used for sending/recieving packets once in realtime mode. |
Definition at line 202 of file ethercat_hardware.h.
EthercatHardware::EthercatHardware | ( | const std::string & | name, |
hardware_interface::HardwareInterface * | hw, | ||
const string & | eth, | ||
bool | allow_unprogrammed | ||
) |
Constructor.
Definition at line 68 of file ethercat_hardware.cpp.
Destructor.
Definition at line 96 of file ethercat_hardware.cpp.
void EthercatHardware::changeState | ( | EtherCAT_SlaveHandler * | sh, |
EC_State | new_state | ||
) | [static, private] |
Definition at line 127 of file ethercat_hardware.cpp.
void EthercatHardware::collectDiagnostics | ( | ) |
Collects diagnostics from all devices.
Definition at line 1030 of file ethercat_hardware.cpp.
boost::shared_ptr< EthercatDevice > EthercatHardware::configNonEthercatDevice | ( | const std::string & | product_id, |
const std::string & | data | ||
) | [private] |
Definition at line 923 of file ethercat_hardware.cpp.
boost::shared_ptr< EthercatDevice > EthercatHardware::configSlave | ( | EtherCAT_SlaveHandler * | sh | ) | [private] |
Definition at line 813 of file ethercat_hardware.cpp.
const std::vector<boost::shared_ptr<const EthercatDevice> > EthercatHardware::getSlaves | ( | ) | const [inline] |
Definition at line 260 of file ethercat_hardware.h.
void EthercatHardware::haltMotors | ( | bool | error, |
const char * | reason | ||
) | [private] |
Definition at line 756 of file ethercat_hardware.cpp.
void EthercatHardware::init | ( | void | ) |
Initialize the EtherCAT Master Library.
Definition at line 211 of file ethercat_hardware.cpp.
void EthercatHardware::loadNonEthercatDevices | ( | ) | [private] |
Definition at line 962 of file ethercat_hardware.cpp.
void EthercatHardware::printCounters | ( | std::ostream & | os = std::cout | ) |
Definition at line 1064 of file ethercat_hardware.cpp.
void EthercatHardware::publishDiagnostics | ( | ) | [private] |
Collects raw diagnostics data and passes it to diagnostics_publisher.
Definition at line 787 of file ethercat_hardware.cpp.
bool EthercatHardware::publishTrace | ( | int | position, |
const string & | reason, | ||
unsigned | level, | ||
unsigned | delay | ||
) |
Ask one or all EtherCAT devices to publish (motor) traces.
position | device ring position to publish trace for. Use -1 to trigger all devices. |
reason | Message to put in trace as reason. |
level | Level to put in trace (aka ERROR=2, WARN=1, OK=0) |
delay | Publish trace after delay cycles. For 1kHz realtime loop 1cycle = 1ms. |
Definition at line 1106 of file ethercat_hardware.cpp.
std::vector< EtherCAT_SlaveHandler > EthercatHardware::scanPort | ( | const std::string & | eth | ) | [static] |
Scans the network and gives a list of detected devices on a given ethercat port.
eth | is the thernet port to be scanned |
Definition at line 145 of file ethercat_hardware.cpp.
bool EthercatHardware::setRouterToSlaveHandlers | ( | ) | [private] |
Definition at line 118 of file ethercat_hardware.cpp.
bool EthercatHardware::txandrx_PD | ( | unsigned | buffer_size, |
unsigned char * | buffer, | ||
unsigned | tries | ||
) |
Send process data.
Definition at line 1088 of file ethercat_hardware.cpp.
void EthercatHardware::update | ( | bool | reset, |
bool | halt | ||
) |
Send most recent motor commands and retrieve updates. This command must be run at a sufficient rate or else the motors will be disabled.
reset | A boolean indicating if the motor controller boards should be reset |
halt | A boolean indicating if the motors should be halted |
Definition at line 649 of file ethercat_hardware.cpp.
void EthercatHardware::updateAccMax | ( | double & | max, |
const accumulator_set< double, stats< tag::max, tag::mean > > & | acc | ||
) | [static, private] |
Definition at line 781 of file ethercat_hardware.cpp.
bool EthercatHardware::allow_unprogrammed_ [private] |
if the driver should treat the discovery of unprogrammed boards as a fatal error. Set to 'true' during board configuration, and set to 'false' otherwise.
Definition at line 317 of file ethercat_hardware.h.
EtherCAT_AL* EthercatHardware::application_layer_ [private] |
Definition at line 288 of file ethercat_hardware.h.
unsigned int EthercatHardware::buffer_size_ [private] |
Definition at line 298 of file ethercat_hardware.h.
unsigned char* EthercatHardware::buffers_ [private] |
Definition at line 297 of file ethercat_hardware.h.
Definition at line 315 of file ethercat_hardware.h.
Definition at line 306 of file ethercat_hardware.h.
Definition at line 307 of file ethercat_hardware.h.
Definition at line 290 of file ethercat_hardware.h.
bool EthercatHardware::halt_motors_ [private] |
Definition at line 300 of file ethercat_hardware.h.
Definition at line 258 of file ethercat_hardware.h.
string EthercatHardware::interface_ [private] |
The socket interface that is connected to the EtherCAT devices (e.g., eth0)
Definition at line 283 of file ethercat_hardware.h.
ros::Time EthercatHardware::last_published_ [private] |
Definition at line 308 of file ethercat_hardware.h.
ros::Time EthercatHardware::last_reset_ [private] |
Definition at line 309 of file ethercat_hardware.h.
Definition at line 285 of file ethercat_hardware.h.
EC_Logic EthercatHardware::m_logic_instance_ [private] |
Definition at line 286 of file ethercat_hardware.h.
EtherCAT_Router* EthercatHardware::m_router_ [private] |
Definition at line 289 of file ethercat_hardware.h.
unsigned EthercatHardware::max_pd_retries_ [private] |
Max number of times to retry sending process data before halting motors.
Definition at line 304 of file ethercat_hardware.h.
realtime_tools::RealtimePublisher<std_msgs::Bool> EthercatHardware::motor_publisher_ [private] |
Definition at line 311 of file ethercat_hardware.h.
struct netif* EthercatHardware::ni_ [private] |
Definition at line 281 of file ethercat_hardware.h.
ros::NodeHandle EthercatHardware::node_ [private] |
Definition at line 279 of file ethercat_hardware.h.
unsigned int EthercatHardware::num_ethercat_devices_ [private] |
Definition at line 293 of file ethercat_hardware.h.
EthercatOobCom* EthercatHardware::oob_com_ [private] |
Definition at line 313 of file ethercat_hardware.h.
Definition at line 287 of file ethercat_hardware.h.
unsigned char* EthercatHardware::prev_buffer_ [private] |
Definition at line 296 of file ethercat_hardware.h.
unsigned int EthercatHardware::reset_state_ [private] |
Definition at line 301 of file ethercat_hardware.h.
std::vector<boost::shared_ptr<EthercatDevice> > EthercatHardware::slaves_ [private] |
Definition at line 292 of file ethercat_hardware.h.
int EthercatHardware::start_address_ [private] |
Definition at line 319 of file ethercat_hardware.h.
unsigned char* EthercatHardware::this_buffer_ [private] |
Definition at line 295 of file ethercat_hardware.h.
unsigned EthercatHardware::timeout_ [private] |
Timeout (in microseconds) to used for sending/recieving packets once in realtime mode.
Definition at line 303 of file ethercat_hardware.h.