Go to the documentation of this file.
18 class SlaveErrorRegistersDevice;
125 virtual void setName(
const std::string& name);
142 template <
class InputT,
class OutputT>
152 const auto ptrAsInt =
reinterpret_cast<std::uint64_t
>(ptr);
154 <<
"\nThe alignment is wrong!\nIt has to be " <<
alignof(InputT)
155 <<
", but the data is aligned with " << ptrAsInt %
alignof(std::max_align_t)
156 <<
"!\nThis is an offset of " << (ptrAsInt %
alignof(InputT))
157 <<
" bytes!\nThe datatype is " << GetTypeString<InputT>() <<
"\nIts size is "
158 <<
sizeof(InputT) <<
" bytes";
159 inputs =
static_cast<InputT*
>(ptr);
165 const auto ptrAsInt =
reinterpret_cast<std::uint64_t
>(ptr);
167 <<
"\nThe alignment is wrong!\nIt has to be " <<
alignof(OutputT)
168 <<
", but the data is aligned with " << ptrAsInt %
alignof(std::max_align_t)
169 <<
"!\nThis is an offset of " << (ptrAsInt %
alignof(OutputT))
170 <<
" bytes!\nThe datatype is " << GetTypeString<OutputT>() <<
"\nIts size is "
171 <<
sizeof(OutputT) <<
" bytes";
172 outputs =
static_cast<OutputT*
>(ptr);
199 template <
typename Slave>
200 std::unique_ptr<armarx::control::ethercat::SlaveInterface>
204 sidWithDefaultName.
setName(Slave::getDefaultName());
206 if (Slave::isSlaveIdentifierAccepted(sidWithDefaultName))
208 return std::make_unique<Slave>(sidWithDefaultName);
virtual void prepareForSafeOp()
virtual bool isEmergencyStopActive() const
Brief description of class SlaveInterface.
SlaveIdentifier slaveIdentifier
std::unique_ptr< armarx::control::ethercat::SlaveInterface > createSlave(const SlaveIdentifier &sid)
OutputT * getOutputsPtr()
virtual bool prepareForRun()=0
This gets triggered by the bus controller before it will start the control loop.
virtual void prepareForOp()=0
This gets called between the SafeOp an the Op state of the bus at the initizialisation.
virtual void setName(const std::string &name)
SlaveErrorRegistersDevicePtr getErrorRegistersDevice() const
void setOutputPDO(void *ptr) override
virtual void doMappings()=0
This is called after EtherCAT Bus is PreOp Mode.
The SlaveIdentifier class is a POD-type representing a unique set of values identifying an EtherCAT s...
bool setName(const std::string &name)
Sets the slave name of a SlaveIdentifier and returns whether the new name fits together with the pare...
const SlaveIdentifier & getSlaveIdentifier() const
SlaveErrorRegistersDevicePtr errorRegistersDevice
virtual void execute()=0
This method gets triggered by the Bus Controller, this function hast to be implemented cooperative.
virtual void setOutputPDO(void *ptr)=0
virtual bool shutdown()=0
This gets triggered by the bus Controller before it will close the EtherCAT bus.
void setErrorRegistersDevice(SlaveErrorRegistersDevicePtr errorRegistersDevice)
void setInputPDO(void *ptr) override
virtual bool hasPDOMapping() const
virtual bool hasError()=0
This function indicates if there is a error or Problem with this slave.
virtual bool handleErrors()
This tries to clear oder fix the errors or problems of the slave or just gives detailed information a...
void setParentDeviceName(const std::string &name)
SlaveInterface(const SlaveIdentifier &slaveIdentifier)
virtual ~SlaveInterface() override
virtual void setInputPDO(void *ptr)=0
bool hasPDOMapping() const final override
Base Class for all Logging classes.
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
virtual void finishPreparingForOp()
This gets called after prepareForOp() was called.
std::shared_ptr< SlaveErrorRegistersDevice > SlaveErrorRegistersDevicePtr
virtual bool recoverFromEmergencyStop()
virtual void finishPreparingForSafeOp()
std::uint16_t getSlaveNumber() const
This returns the slave number of the slave on the bus +1 because slave 0 is the master.