Bus Class Reference

Brief description of class Bus. More...

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

+ Inheritance diagram for Bus:

Public Types

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

Public Member Functions

void configureErrorCountersReading (bool enable, unsigned int periodInMS)
 configureErrorCountersReading configure stuff
 
const std::vector< std::shared_ptr< DeviceInterface > > & getDevices () const
 Returns all initialized devices.
 
std::uint64_t getIterationCount () const
 
PDOValidity getPDOValidity () const
 
std::experimental::observer_ptr< SlaveInterface > getSlaveAtIndex (std::uint16_t slaveIndex) const
 
std::vector< std::experimental::observer_ptr< SlaveInterface > > getSlaves () const
 Returns all identifiied slaves on the bus.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
MessageTypeT getEffectiveLoggingLevel () const
 
 Logging ()
 
void setLocalMinimumLoggingLevel (MessageTypeT level)
 With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set.
 
void setTag (const LogTag &tag)
 
void setTag (const std::string &tagName)
 
virtual ~Logging ()
 

Static Public Member Functions

static Bus & getBus ()
 This returns the one and only Bus object.
 

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.
 
- Protected Member Functions inherited from BusIO
 BusIO ()
 
void rtUpdatePDO ()
 Updates the PDO of all slaves.
 
- 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 LogSenderPtr & getLogSender () const
 Retrieve log sender.
 
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.

Member Typedef Documentation

◆ DeviceFactory

Initial value:
std::function<std::shared_ptr<DeviceInterface>(hardware_config::DeviceConfig& config,
const VirtualRobot::RobotPtr& robot)>
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19

◆ SlaveFactory

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

Member Function Documentation

◆ configureErrorCountersReading()

void configureErrorCountersReading ( bool enable,
unsigned int periodInMS )

configureErrorCountersReading configure stuff

more configure stuff explanation

Parameters
enablesadösdm
periodInMSasdsads

◆ getBus()

Bus & getBus ( )
static

This returns the one and only Bus object.

An implements the singelton pattern

Returns
The Bus instance

◆ getDevices()

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

Returns all initialized devices.

Returns

◆ getIterationCount()

std::uint64_t getIterationCount ( ) const

◆ getPDOValidity()

PDOValidity getPDOValidity ( ) const

◆ getSlaveAtIndex()

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

◆ getSlaves()

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

Returns all identifiied slaves on the bus.

Returns

◆ logErrorsToFile()

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

◆ registerDeviceFactory()

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

◆ registerSlaveFactory()

void registerSlaveFactory ( const SlaveFactory & factory)

◆ rtGetEtherCATState()

EtherCATState rtGetEtherCATState ( ) const

◆ rtGetFunctionalState()

BusFunctionalState rtGetFunctionalState ( ) const

◆ rtHasError()

bool rtHasError ( ) const

◆ rtIsEmergencyStopActive()

bool rtIsEmergencyStopActive ( ) const

◆ 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 op

◆ setAndParseHardwareConfig()

void setAndParseHardwareConfig ( const MultiNodeRapidXMLReader & hwconfig)

◆ setIfName()

void setIfName ( const std::string & ifname)

◆ setRobot()

void setRobot ( const VirtualRobot::RobotPtr & robot)

◆ setSocketFileDescriptor()

void setSocketFileDescriptor ( int socketFileDescriptor)

◆ 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.

◆ switchBusToInit()

bool switchBusToInit ( )

◆ switchBusToOp()

bool switchBusToOp ( )

◆ switchBusToPreOp()

bool switchBusToPreOp ( )

◆ switchBusToSafeOp()

bool switchBusToSafeOp ( )

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