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

Class EcSlaveSGDV. More...

#include <EcSlaveSGDV.h>

Inheritance diagram for cpp4ec::EcSlaveSGDV:
cpp4ec::EcSlave

Public Types

enum  EcPDOEntry {
  FIRST_ENTRY, SECOND_ENTRY, THIRD_ENTRY, FOURTH_ENTRY,
  FIFTH_ENTRY, SIXTH_ENTRY, SEVENTH_ENTRY, EIGHTH_ENTRY
}
 
enum  EcControlWord {
  CW_QUICK_STOP = 0x02, CW_SHUTDOWN = 0x06, CW_SWITCH_ON = 0x07, CW_ENABLE_OP = 0x0F,
  CW_DIASABLE_OP = 0x07, CW_DISABLE_VOLTAGE = 0x00, CW_FAULT_RESET = 0x80, CW_HALT = 0x09,
  CW_START_ABS_POSITIONING = 0x1F, CW_START_REL_POSITIONING = 0x5F, CW_START_QUICK_ABS_POSITIONING = 0x3F, CW_START_QUICK_REL_POSITIONING = 0x7F,
  CW_START_ABS_POSITIONING_WITH_VELOCITY = 0x21F, CW_START_REL_POSITIONING_WITH_VELOCITY = 0x25F
}
 
enum  EcStatusWord {
  SW_NOT_READY_SWICH_ON = 0x00, SW_SWITCH_ON_DISABLED = 0x40, SW_READY_SWITCH_ON = 0x31, SW_SWITCHED_ON = 0x33,
  SW_OPERATION_ENABLED = 0x37, SW_QUICK_STOP_ACTIVE = 0x07, SW_FAULT = 0x08, SW_FAULT_RACTION_ACTIVE = 0x0F,
  SW_HIGH_MASK = 0x00FF, SW_LOW_MASK = 0xFF00
}
 

Public Member Functions

 EcSlaveSGDV (ec_slavet *mem_loc)
 Constructor. More...
 
 ~EcSlaveSGDV ()
 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 setDC (bool active, unsigned int sync0Time, unsigned int sync0Shift) throw (EcErrorSGDV)
 Set DC. More...
 
void setPDOBuffer (char *input, char *output)
 Sets locations Buffer. More...
 
bool writePDO (EcPDOEntry entry, int value)
 Writes on the output PDOentry. More...
 
bool readPDO (EcPDOEntry entry, int &value)
 Read on the input PDOentry. More...
 
bool readActualValue (ActualValue &value)
 read Actual values structure 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...
 
bool readTimestamp (int64 &time)
 Read the actual timestamp. More...
 
void setSGDVObject (uint16_t index, uint8_t subindex, int psize, void *param)
 Set an SGDV object. More...
 
void getSGDVObject (uint16_t index, uint8_t subindex, int *psize, void *param)
 Set an SGDV object. More...
 
- 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, int64_t)> 
slaveValues
 A signal to emit information. More...
 
- 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

Class EcSlaveSGDV.

The class EcSlaveSGDV configures and controls the SGDV motors.

Examples:
demo2.cpp, demo3.cpp, and demo4.cpp.

Member Enumeration Documentation

The ControlWord values. The positioning words are only used in the profile position mode (operational mode = 1).

Enumerator
CW_START_ABS_POSITIONING 

Start the next positioning after the current positioning completes (target reached). The target position is an absolute value

CW_START_REL_POSITIONING 

Start the next positioning after the current positioning completes (target reached). The target position is a relative value

CW_START_QUICK_ABS_POSITIONING 

Start next positioning immediately. The target position is an absolute value

CW_START_QUICK_REL_POSITIONING 

Start next positioning immediately. The target position is a relative value

CW_START_ABS_POSITIONING_WITH_VELOCITY 

Positioning with current profile velocity up to the current set-point is proceeded and then next positioning will be applied. The target position is an absolute value

CW_START_REL_POSITIONING_WITH_VELOCITY 

Positioning with current profile velocity up to the current set-point is proceeded and then next positioning will be applied. The target position is a relative value

The index of the PDO entries

The StatusWord values

Constructor & Destructor Documentation

cpp4ec::EcSlaveSGDV::EcSlaveSGDV ( ec_slavet *  mem_loc)

Constructor.

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

Member Function Documentation

bool cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::getSGDVObject ( uint16_t  index,
uint8_t  subindex,
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.
bool cpp4ec::EcSlaveSGDV::readActualValue ( ActualValue value)

read Actual values structure

This function read the important or essential parameter togheter and put it in actualValue structure

Parameters
ActualValueContain position,velocity,torque and timestamp.
bool cpp4ec::EcSlaveSGDV::readPDO ( 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.
bool cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::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::EcSlaveSGDV::readTimestamp ( int64 &  time)

Read the actual timestamp.

Reads the timestamp of the last PDO readed.

Parameters
timereturn the value of the actual timestamp.
bool cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::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::EcSlaveSGDV::setDC ( bool  active,
unsigned int  sync0Time,
unsigned int  sync0Shift 
)
throw (EcErrorSGDV
)
virtual

Set DC.

Configure the sync0 event

Parameters
activetrue to active DC, false to disconect.
sync0Timethe cycle time of the sync0 event
sync0Shiftthe shifted time of the sync0 event

Reimplemented from cpp4ec::EcSlave.

void cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::setSGDVObject ( uint16_t  index,
uint8_t  subindex,
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::EcSlaveSGDV::start ( )
throw (EcErrorSGDV
)
virtual

Start motors.

Switch on 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::EcSlaveSGDV::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::EcSlaveSGDV::update ( void  )
virtual

Update the data.

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

Implements cpp4ec::EcSlave.

bool cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::writePDO ( EcPDOEntry  entry,
int  value 
)

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::EcSlaveSGDV::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
positionthe desired value of the Target Position object.
bool cpp4ec::EcSlaveSGDV::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::EcSlaveSGDV::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.

Member Data Documentation

boost::signals2::signal<void (int, uint16_t, int32_t, int32_t, int16_t, int64_t)> cpp4ec::EcSlaveSGDV::slaveValues

A signal to emit information.

Is a function designed to send the important data of the slave. Whatever component that is conected to this signal can recieve the slavenumber, statusWord, Position, Velocity, Torque and timestamp of each slave.


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