Bus Class Reference

Brief description of class Bus. More...

#include <armarx/control/ethercat/Bus.h>

+ Inheritance diagram for Bus:

Public Types

using DeviceFactory = std::function< std::shared_ptr< DeviceInterface >(hardware_config::DeviceConfig &config, const VirtualRobot::RobotPtr &robot)>
 
using SlaveFactory = std::function< std::unique_ptr< SlaveInterface >(SlaveIdentifier sid)>
 

Public Member Functions

void configureErrorCountersReading (bool enable, unsigned int periodInMS)
 configureErrorCountersReading configure stuff More...
 
const std::vector< std::shared_ptr< DeviceInterface > > & getDevices () const
 Returns all initialized devices. More...
 
std::uint64_t getIterationCount () const
 
PDOValidity getPDOValidity () const
 
std::experimental::observer_ptr< SlaveInterfacegetSlaveAtIndex (std::uint16_t slaveIndex) const
 
std::vector< std::experimental::observer_ptr< SlaveInterface > > getSlaves () const
 Returns all identifiied slaves on the bus. More...
 
std::string logErrorsToFile (std::filesystem::path path, unsigned int lastSeconds)
 
void registerDeviceFactory (const std::string &name, const DeviceFactory &factory)
 
void registerSlaveFactory (const SlaveFactory &factory)
 
EtherCATState rtGetEtherCATState () const
 
BusFunctionalState rtGetFunctionalState () const
 
bool rtHasError () const
 
bool rtIsEmergencyStopActive () const
 
bool rtUpdateBus (bool doErrorHandling=true, size_t iterationCount=0)
 Updates all information on the bus, so all commands will be send to the Bus and all sensor and other monitored values will be recived from the bus. More...
 
void setAndParseHardwareConfig (const MultiNodeRapidXMLReader &hwconfig)
 
void setIfName (const std::string &ifname)
 
void setRobot (const VirtualRobot::RobotPtr &robot)
 
void setSocketFileDescriptor (int socketFileDescriptor)
 
void shutdown ()
 Shuts the bus down by executing the shutdown-hook for each slave and afterwards switch all slaves to EC_STATE_INIT. More...
 
bool switchBusToInit ()
 
bool switchBusToOp ()
 
bool switchBusToPreOp ()
 
bool switchBusToSafeOp ()
 
- Public Member Functions inherited from BusIO
EtherCATState changeStateOfBus (EtherCATState state, bool validate=true)
 
EtherCATState changeStateOfSlave (std::uint16_t slaveIndex, EtherCATState state, bool validate=true)
 
void deactivateCOECA (std::uint16_t slaveIndex)
 This deactivates the Complete access mode in CoE for the given slave. More...
 
bool readRegisters (EtherCATFrameList *frames, std::uint16_t amountFramesToRead=0)
 
bool readRegisters (std::vector< RegisterDataList > &registerData)
 
bool readSDOByteBuffer (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, int *buflen, unsigned char *buf, bool completeAccess=false)
 Performs a SDO read from the slave and returns true if it succeeds. More...
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
bool readSDOEntry (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, T &result, bool completeAccess=false)
 Performs a SDO read of an single entry from the slave and returns true if it succeeds. More...
 
EtherCATState readStates ()
 
bool resetErrorRegisters (std::uint16_t slaveIndex)
 
void setTimeouts (Timeouts const &timeouts)
 
bool writeSDOByteBuffer (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, int buflen, const unsigned char *buf, bool completeAccess=false)
 Performs a SDO write to the slave with the given slaveIndex and returns true if it succeeds. More...
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
bool writeSDOEntry (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, T value, bool completeAccess=false)
 Performs a SDO write to a single entry to the slave with the give slaveIndex and returns true if it succeeds. More...
 
virtual ~BusIO ()
 
- Public Member Functions inherited from Logging
SpamFilterDataPtr deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
 disables the logging for the current line for the given amount of seconds. More...
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set. More...
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Static Public Member Functions

static BusgetBus ()
 This returns the one and only Bus object. More...
 

Additional Inherited Members

- Protected Types inherited from BusIO
using IOMap = std::array< char, 4096 >
 IOmap the IO map where the process data are mapped in. More...
 
- Protected Member Functions inherited from BusIO
 BusIO ()
 
void rtUpdatePDO ()
 Updates the PDO of all slaves. More...
 
- Protected Member Functions inherited from ESIHandler
std::optional< std::vector< std::byte > > readESIBinaryBlob (std::uint16_t slaveIndex, std::uint16_t startAddress, std::uint16_t endAddress) const
 
- Protected Member Functions inherited from Logging
bool checkLogLevel (MessageTypeT level) const
 
const LogSenderPtrgetLogSender () const
 Retrieve log sender. More...
 
LogSenderPtr loghelper (const char *file, int line, const char *function) const
 
- Protected Attributes inherited from BusIO
IOMap ioMap
 
int lastWorkCounter = 0
 
bool pdoAccessAvailable = false
 
bool sdoAccessAvailable = false
 
Timeouts timeouts
 
- Protected Attributes inherited from Logging
MessageTypeT minimumLoggingLevel
 
SpamFilterDataPtr spamFilter
 
LogTag tag
 

Detailed Description

Brief description of class Bus.

Detailed description of class Bus.

Definition at line 55 of file Bus.h.

Member Typedef Documentation

◆ DeviceFactory

using DeviceFactory = std::function<std::shared_ptr<DeviceInterface>(hardware_config::DeviceConfig& config, const VirtualRobot::RobotPtr& robot)>

Definition at line 136 of file Bus.h.

◆ SlaveFactory

using SlaveFactory = std::function<std::unique_ptr<SlaveInterface>(SlaveIdentifier sid)>

Definition at line 130 of file Bus.h.

Member Function Documentation

◆ configureErrorCountersReading()

void configureErrorCountersReading ( bool  enable,
unsigned int  periodInMS 
)

configureErrorCountersReading configure stuff

more configure stuff explanation

Parameters
enablesadösdm
periodInMSasdsads

Definition at line 1442 of file Bus.cpp.

◆ getBus()

Bus & getBus ( )
static

This returns the one and only Bus object.

An implements the singelton pattern

Returns
The Bus instance

Definition at line 29 of file Bus.cpp.

+ Here is the caller graph for this function:

◆ getDevices()

const std::vector< std::shared_ptr< DeviceInterface > > & getDevices ( ) const

Returns all initialized devices.

Returns

Definition at line 1387 of file Bus.cpp.

◆ getIterationCount()

std::uint64_t getIterationCount ( ) const

Definition at line 1466 of file Bus.cpp.

◆ getPDOValidity()

PDOValidity getPDOValidity ( ) const

Definition at line 635 of file Bus.cpp.

◆ getSlaveAtIndex()

std::experimental::observer_ptr< SlaveInterface > getSlaveAtIndex ( std::uint16_t  slaveIndex) const

Definition at line 1397 of file Bus.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSlaves()

std::vector< std::experimental::observer_ptr< SlaveInterface > > getSlaves ( ) const

Returns all identifiied slaves on the bus.

Returns

Definition at line 1375 of file Bus.cpp.

+ Here is the caller graph for this function:

◆ logErrorsToFile()

std::string logErrorsToFile ( std::filesystem::path  path,
unsigned int  lastSeconds 
)

Definition at line 36 of file Bus.cpp.

+ Here is the call graph for this function:

◆ registerDeviceFactory()

void registerDeviceFactory ( const std::string &  name,
const DeviceFactory factory 
)

Definition at line 1361 of file Bus.cpp.

◆ registerSlaveFactory()

void registerSlaveFactory ( const SlaveFactory factory)

Definition at line 1355 of file Bus.cpp.

◆ rtGetEtherCATState()

EtherCATState rtGetEtherCATState ( ) const

Definition at line 1343 of file Bus.cpp.

◆ rtGetFunctionalState()

BusFunctionalState rtGetFunctionalState ( ) const

Definition at line 1349 of file Bus.cpp.

◆ rtHasError()

bool rtHasError ( ) const

Definition at line 1427 of file Bus.cpp.

+ Here is the call graph for this function:

◆ rtIsEmergencyStopActive()

bool rtIsEmergencyStopActive ( ) const

Definition at line 1411 of file Bus.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rtUpdateBus()

bool rtUpdateBus ( bool  doErrorHandling = true,
size_t  iterationCount = 0 
)

Updates all information on the bus, so all commands will be send to the Bus and all sensor and other monitored values will be recived from the bus.

Returns
false if the bus has not been switched to .
Parameters
doErrorHandling
Returns
asdojis EtherCATState::op

Definition at line 465 of file Bus.cpp.

+ Here is the call graph for this function:

◆ setAndParseHardwareConfig()

void setAndParseHardwareConfig ( const MultiNodeRapidXMLReader hwconfig)

Definition at line 1367 of file Bus.cpp.

+ Here is the call graph for this function:

◆ setIfName()

void setIfName ( const std::string &  ifname)

Definition at line 459 of file Bus.cpp.

◆ setRobot()

void setRobot ( const VirtualRobot::RobotPtr robot)

Definition at line 1436 of file Bus.cpp.

+ Here is the caller graph for this function:

◆ setSocketFileDescriptor()

void setSocketFileDescriptor ( int  socketFileDescriptor)

Definition at line 453 of file Bus.cpp.

◆ shutdown()

void shutdown ( )

Shuts the bus down by executing the shutdown-hook for each slave and afterwards switch all slaves to EC_STATE_INIT.

If the bus state is already EC_STATE_INIT these steps are skipped. Afterwards the socket will be closed and no communication with the bus is possible anymore.

Definition at line 584 of file Bus.cpp.

+ Here is the call graph for this function:

◆ switchBusToInit()

bool switchBusToInit ( )

Definition at line 641 of file Bus.cpp.

+ Here is the caller graph for this function:

◆ switchBusToOp()

bool switchBusToOp ( )

Definition at line 700 of file Bus.cpp.

◆ switchBusToPreOp()

bool switchBusToPreOp ( )

Definition at line 660 of file Bus.cpp.

◆ switchBusToSafeOp()

bool switchBusToSafeOp ( )

Definition at line 680 of file Bus.cpp.


The documentation for this class was generated from the following files: