libcpp4ec
C++ for EtherCat Library
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Public Attributes | List of all members
cpp4ec::EcSlaveTrack Class Reference

EcSlaveTrack. More...

#include <EcSlaveTrack.h>

Inheritance diagram for cpp4ec::EcSlaveTrack:
cpp4ec::EcSlave

Public Member Functions

 EcSlaveTrack (ec_slavet *mem_loc)
 Constructor. More...
 
 ~EcSlaveTrack ()
 Destructor.
 
const std::string & getName () const
 Gets the name.
 
bool configure () throw (EcErrorSGDV)
 Configure the SGDV servopack. More...
 
void start () throw (EcErrorSGDV)
 Start motors. More...
 
void update ()
 Update the data. More...
 
void stop () throw (EcErrorSGDV)
 Stop motors. More...
 
void setPDOBuffer (char *input, char *output)
 Sets locations Buffer. More...
 
void setDC (bool active, unsigned int sync0Time, unsigned int sync0Shift) throw (EcErrorSGDV)
 Set the Distributed clock.
 
bool writeMDT (EcPDOEntry entry, int value) throw (EcErrorSGDV)
 Writes on the output PDOentry. More...
 
bool readAT (EcPDOEntry entry, int &value)
 Read on the input PDOentry. More...
 
bool writeControlWord (uint16_t controlWord)
 Write on the Controlword object. More...
 
bool readStatusWord (uint16_t &statusWord)
 Read the Statusword object. More...
 
bool writePosition (int32_t position)
 Write on the position object. More...
 
bool readPosition (int32_t &position)
 Read the position object. More...
 
bool writeVelocity (int32_t velocity)
 Write on the velocity object. More...
 
bool readVelocity (int32_t &velocity)
 Read the velocity object. More...
 
bool writeTorque (int16_t torque)
 Write on the torque object. More...
 
bool readTorque (int16_t &torque)
 Read the torque object. More...
 
void setSGDVOject (uint16_t idn, uint8_t elementflags, int psize, void *param)
 Set an SGDV object. More...
 
void getSGDVObject (uint16_t idn, uint8_t elementflags, int *psize, void *param)
 Set an SGDV object. More...
 
std::vector< int > readIDNofIDNs (int idn, bool print)
 Read the IDN that are contained in a IDN. More...
 
void setMDT (std::vector< int > listidn)
 Set the IDN that will be contained in the MDT. More...
 
void setAT (std::vector< int > listidn)
 Set the IDN that will be contained in the AT. More...
 
void modeSetUp (EcMode mode, int nmode)
 Set the operation mode. More...
 
void TelegramType (EcTelegramType type)
 Set the telegram type. More...
 
void DefaultParameters ()
 
void ClearError ()
 
- Public Member Functions inherited from cpp4ec::EcSlave
virtual ~EcSlave ()
 Destructor.
 
const std::string & getName () const
 Get the slave name.
 
virtual bool requestState (ec_state state)
 Requests the slave state.
 
virtual bool checkState (ec_state state)
 Checks the slave state.
 
virtual ec_state getState ()
 Gets the slave state.
 

Public Attributes

boost::signals2::signal< void(int,
uint16_t, int32_t, int32_t,
int16_t)> 
slaveValues
 
- Public Attributes inherited from cpp4ec::EcSlave
boost::signals2::signal< void()> updateMaster
 Update Master outputs.
 

Additional Inherited Members

- Protected Member Functions inherited from cpp4ec::EcSlave
 EcSlave (ec_slavet *mem_loc)
 
- Protected Attributes inherited from cpp4ec::EcSlave
ec_slavet * m_datap
 
std::string m_name
 
unsigned int m_slave_nr
 

Detailed Description

EcSlaveTrack.

The class EcSlaveTrack configures and controls the SGDV motors.

Constructor & Destructor Documentation

cpp4ec::EcSlaveTrack::EcSlaveTrack ( ec_slavet *  mem_loc)

Constructor.

Parameters
mem_locA posinter to the slave information of ec_slave (SOEM)

Member Function Documentation

bool cpp4ec::EcSlaveTrack::configure ( )
throw (EcErrorSGDV
)
virtual

Configure the SGDV servopack.

Set the parameters readed from the XML, which include the PDO mapping.

Reimplemented from cpp4ec::EcSlave.

void cpp4ec::EcSlaveTrack::getSGDVObject ( uint16_t  idn,
uint8_t  elementflags,
int *  psize,
void *  param 
)

Set an SGDV object.

This functions set the desired value on the desired object of an SGDV Servopack.

Parameters
indexthe index of the object.
subindexthe subindedex of the objec.
psizethe size of the param buffer.
parama pointer to the buffer with the returned value.
void cpp4ec::EcSlaveTrack::modeSetUp ( EcMode  mode,
int  nmode 
)

Set the operation mode.

This functions set operation mode of the slave.

Parameters
modeis the mode that will be set in the nmode position.
nmodeposition of the mode, you could configure up to 4 mode at the same time and change it while the slave is in the cyclic data transfer mode using the controlword to switch between the mode on te fly. Set nmode with [0,1,2,3] to configure the 4 modes simultaniosly.
bool cpp4ec::EcSlaveTrack::readAT ( EcPDOEntry  entry,
int &  value 
)

Read on the input PDOentry.

Parameters
entryespecifies the entry that occupies the object that is wanted to read on.
valuereturn the value of this onject.
std::vector< int > cpp4ec::EcSlaveTrack::readIDNofIDNs ( int  idn,
bool  print 
)

Read the IDN that are contained in a IDN.

This functions reads the idn that are contained in a IDN that have IDN as values.

Parameters
idnthe idn that are going to be read.
printhas to be set as true for printing the values and false for not printing the values.
bool cpp4ec::EcSlaveTrack::readPosition ( int32_t &  position)

Read the position object.

It's an specific function to read the Position Actual Value object (0x6064).If this object is not mapped in the PDO, then an error will happen.

Parameters
positionreturn the value of the Position Actual Value object .
bool cpp4ec::EcSlaveTrack::readStatusWord ( uint16_t &  statusWord)

Read the Statusword object.

It's an specific function to read the Statusword object (0x6041).If this object is not mapped in the PDO, then an error will happen.

Parameters
statusWordreturn the value of the Statusword object .
bool cpp4ec::EcSlaveTrack::readTorque ( int16_t &  torque)

Read the torque object.

It's an specific function to read the Torque Actual Value object (0x6077).If this object is not mapped in the PDO, then an error will happen.

Parameters
torquereturn the value of the Torque Actual Value object .
bool cpp4ec::EcSlaveTrack::readVelocity ( int32_t &  velocity)

Read the velocity object.

It's an specific function to read the Velocity Actual Value object (0x606C).If this object is not mapped in the PDO, then an error will happen.

Parameters
velocityreturn the value of the Velocity Actual Value object .
void cpp4ec::EcSlaveTrack::setAT ( std::vector< int >  listidn)

Set the IDN that will be contained in the AT.

This functions set the IDN that will be contained in te AT during the cyclic data transfer

Parameters
listidnvector with all the parameters that wil be set in the AT (the statuslword has not to be set in this list).
void cpp4ec::EcSlaveTrack::setMDT ( std::vector< int >  listidn)

Set the IDN that will be contained in the MDT.

This functions set the IDN that will be contained in te MDT during the cyclic data transfer

Parameters
listidnvector with all the parameters that wil be set in the MDT (the controlword has not to be set in this list).
void cpp4ec::EcSlaveTrack::setPDOBuffer ( char *  input,
char *  output 
)
virtual

Sets locations Buffer.

The master join all the outputs and inputs in their respective buffer to transmit to the real time task. This functions sets the input and output pointers to the right location on the where the PDO must be put.

Parameters
inputthe pointer to the right location on the master input buffer
outputthe pointer to the right location on the master input buffer

Reimplemented from cpp4ec::EcSlave.

void cpp4ec::EcSlaveTrack::setSGDVOject ( uint16_t  idn,
uint8_t  elementflags,
int  psize,
void *  param 
)

Set an SGDV object.

This functions set the desired value on the desired object of an SGDV Servopack.

Parameters
indexthe index of the object.
subindexthe subindedex of the objec.
psizethe size of the param buffer.
parama buffer with the desired value.
void cpp4ec::EcSlaveTrack::start ( )
throw (EcErrorSGDV
)
virtual

Start motors.

Switch on the motors.

Returns
A vector with the secuence of buffer outputs that has to be sent to stop the servos

Reimplemented from cpp4ec::EcSlave.

void cpp4ec::EcSlaveTrack::stop ( )
throw (EcErrorSGDV
)
virtual

Stop motors.

Returns
A vector with the secuence of buffer outputs that has to be sent to stop the servos

Reimplemented from cpp4ec::EcSlave.

void cpp4ec::EcSlaveTrack::TelegramType ( EcTelegramType  type)

Set the telegram type.

This functions set the telegram type, it is possible to choose between 6 congigurated telegrams and a configurable one.

Parameters
typethe type of telegram that are going to be set VZ0 MDT: no cyclic data, AT: no cyclic data VZ1 MDT: S-0-0080 torque command, AT: no cyclic data VZ2 MDT: S-0-0036 velocity command, AT: S-0-0040 velocity feedback VZ3 MDT: S-0-0036 velocity command, AT: S-0-0051/53 position feedback 1/2 VZ4 MDT: S-0-0047 position command, AT: S-0-0051/53 position feedback 1/2 VZ5 MDT: S-0-0047 position command and S-0-0036 velocity command, AT:S-0-0051/53 position feedback 1/2 and S-0-0040 velocity feedback VZ6 MDT: S-0-0036 velocity command, AT: no cyclic data VZ7 Configurable, you will need to set up the telegrams by yourself using the functions setMDT and setAT
void cpp4ec::EcSlaveTrack::update ( void  )
virtual

Update the data.

Update the output and input values to and from their respective buffers.

Implements cpp4ec::EcSlave.

bool cpp4ec::EcSlaveTrack::writeControlWord ( uint16_t  controlWord)

Write on the Controlword object.

It's an specific function to write on the Controlword object (0x6040).If this object is not mapped in the PDO, then an error will happen.

Parameters
controlWordthe desired value of the Controlword object .
bool cpp4ec::EcSlaveTrack::writeMDT ( EcPDOEntry  entry,
int  value 
)
throw (EcErrorSGDV
)

Writes on the output PDOentry.

Parameters
entryespecifies the entry that occupies the object thatis wanted to write on.
valuethe desired value of the onject.
bool cpp4ec::EcSlaveTrack::writePosition ( int32_t  position)

Write on the position object.

It's an specific function to write on the Target Position object (0x607A).If this object is not mapped in the PDO, then an error will happen.

Parameters
postionthe desired value of the Target Position object.
bool cpp4ec::EcSlaveTrack::writeTorque ( int16_t  torque)

Write on the torque object.

It's an specific function to write on the Target Torque object (0x6071).If this object is not mapped in the PDO, then an error will happen.

Parameters
torquethe desired value of the Target Torque object.
bool cpp4ec::EcSlaveTrack::writeVelocity ( int32_t  velocity)

Write on the velocity object.

It's an specific function to write on the Target Velocity object (0x60FF).If this object is not mapped in the PDO, then an error will happen.

Parameters
velocitythe desired value of the Target Velocity object.

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