DeviceInterface Class Referenceabstract

Brief description of class DeviceInterface. More...

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

+ Inheritance diagram for DeviceInterface:

Classes

class  SubDeviceInterface
 

Public Types

enum  AllAssignedResult { ok, slavesMissing }
 
enum  TryAssignResult { assigned, unknown, alreadyAssigned }
 

Public Member Functions

 DeviceInterface (const std::string &name)
 
virtual void execute ()
 
virtual std::string getClassName () const =0
 
virtual const std::vector< std::shared_ptr< SubDeviceInterface > > getSubDevices () const
 
virtual AllAssignedResult onAllAssigned ()=0
 Method called by the EtherCAT bus after all slaves have been assigned. More...
 
virtual void postSwitchToOp ()
 Hook for executing code after the bus has successfully switched into the Op-State. More...
 
virtual void postSwitchToSafeOp ()
 Hook for executing code after the bus has successfully switched into the SafeOp-State. More...
 
virtual TryAssignResult tryAssign (SlaveInterface &slave)=0
 Method called by the EtherCAT bus to try to assign slaves to functional devices. More...
 
virtual ~DeviceInterface ()
 
- Public Member Functions inherited from DeviceBase
 DeviceBase (const std::string &name)
 Create a Device with the given name. More...
 
const std::string & getDeviceName () const
 
const std::set< std::string > & getTags () const
 
virtual bool hasError ()
 
bool hasTag (const std::string &tag) const
 
const char * rtGetDeviceName () const
 
virtual ~DeviceBase ()=default
 

Protected Attributes

std::vector< std::shared_ptr< SubDeviceInterface > > subDevices
 

Additional Inherited Members

- Protected Member Functions inherited from DeviceBase
void addDeviceTag (const std::string &tag)
 adds the given tag to the Device More...
 

Detailed Description

Brief description of class DeviceInterface.

Detailed description of class DeviceInterface.

Definition at line 35 of file DeviceInterface.h.

Member Enumeration Documentation

◆ AllAssignedResult

enum AllAssignedResult
strong
Enumerator
ok 

Used if assignments were successful. (Expected)

slavesMissing 

Used if slaves are missing. (Error)

Definition at line 107 of file DeviceInterface.h.

◆ TryAssignResult

enum TryAssignResult
strong
Enumerator
assigned 

Used if the slave was adpoted by this device. (Expected)

unknown 

Used if the slave is unknown to this device. (Expected)

alreadyAssigned 

Used if the slave was already adopted before. (Error)

Definition at line 86 of file DeviceInterface.h.

Constructor & Destructor Documentation

◆ DeviceInterface()

DeviceInterface ( const std::string &  name)

Definition at line 32 of file DeviceInterface.cpp.

◆ ~DeviceInterface()

virtual ~DeviceInterface ( )
inlinevirtual

Definition at line 54 of file DeviceInterface.h.

Member Function Documentation

◆ execute()

virtual void execute ( )
inlinevirtual

Definition at line 82 of file DeviceInterface.h.

◆ getClassName()

virtual std::string getClassName ( ) const
pure virtual

◆ getSubDevices()

const std::vector< std::shared_ptr< DeviceInterface::SubDeviceInterface > > getSubDevices ( ) const
virtual

Definition at line 37 of file DeviceInterface.cpp.

◆ onAllAssigned()

virtual AllAssignedResult onAllAssigned ( )
pure virtual

Method called by the EtherCAT bus after all slaves have been assigned.

This method allows further initialization of assigned slaves and allows indicating missing slaves. When this method was called, all slaves have already been assigned, so if this device is still missing slaves, it should indicate it by returning AllAssignedResult::slavesMissing. AllAssignedResult::ok indicates that all expected slaves were assigned.

Returns
ok if all expected slaves were assigned, slavesMissing otherwise.

◆ postSwitchToOp()

virtual void postSwitchToOp ( )
inlinevirtual

Hook for executing code after the bus has successfully switched into the Op-State.

Before executing this hook, the PDO of all slaves have been updated at least once. Updates can be sent to slaves via PDO.

Definition at line 77 of file DeviceInterface.h.

◆ postSwitchToSafeOp()

virtual void postSwitchToSafeOp ( )
inlinevirtual

Hook for executing code after the bus has successfully switched into the SafeOp-State.

SDO of the slaves can be read and written. PDO data from the slaves have been read after switching to SafeOp, but no new updates to the slaves can bus until the bus in Op-state

Definition at line 66 of file DeviceInterface.h.

◆ tryAssign()

virtual TryAssignResult tryAssign ( SlaveInterface slave)
pure virtual

Method called by the EtherCAT bus to try to assign slaves to functional devices.

See also
TryAssignResult
Parameters
slave
Returns
TryAssignResult holding the outcome of the method.

Member Data Documentation

◆ subDevices

std::vector<std::shared_ptr<SubDeviceInterface> > subDevices
protected

Definition at line 134 of file DeviceInterface.h.


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