Class EcSlaveSGDV. More...
#include <EcSlaveSGDV.h>
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 |
Class EcSlaveSGDV.
The class EcSlaveSGDV configures and controls the SGDV motors.
The ControlWord values. The positioning words are only used in the profile position mode (operational mode = 1).
The index of the PDO entries
The StatusWord values
cpp4ec::EcSlaveSGDV::EcSlaveSGDV | ( | ec_slavet * | mem_loc | ) |
Constructor.
mem_loc | A posinter to the slave information of ec_slave (SOEM) |
|
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.
index | the index of the object. |
subindex | the subindedex of the objec. |
psize | the size of the param buffer. |
param | a 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
ActualValue | Contain position,velocity,torque and timestamp. |
bool cpp4ec::EcSlaveSGDV::readPDO | ( | EcPDOEntry | entry, |
int & | value | ||
) |
Read on the input PDOentry.
entry | especifies the entry that occupies the object that is wanted to read on. |
value | return 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.
position | return 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.
statusWord | return the value of the Statusword object . |
bool cpp4ec::EcSlaveSGDV::readTimestamp | ( | int64 & | time | ) |
Read the actual timestamp.
Reads the timestamp of the last PDO readed.
time | return 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.
torque | return 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.
velocity | return the value of the Velocity Actual Value object . |
|
virtual |
Set DC.
Configure the sync0 event
active | true to active DC, false to disconect. |
sync0Time | the cycle time of the sync0 event |
sync0Shift | the shifted time of the sync0 event |
Reimplemented from cpp4ec::EcSlave.
|
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.
input | the pointer to the right location on the master input buffer |
output | the 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.
index | the index of the object. |
subindex | the subindedex of the objec. |
psize | the size of the param buffer. |
param | a buffer with the desired value. |
|
virtual |
Start motors.
Switch on motors.
Reimplemented from cpp4ec::EcSlave.
|
virtual |
Stop motors.
Reimplemented from cpp4ec::EcSlave.
|
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.
controlWord | the desired value of the Controlword object . |
bool cpp4ec::EcSlaveSGDV::writePDO | ( | EcPDOEntry | entry, |
int | value | ||
) |
Writes on the output PDOentry.
entry | especifies the entry that occupies the object thatis wanted to write on. |
value | the 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.
position | the 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.
torque | the 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.
velocity | the desired value of the Target Velocity object. |
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.