#include <MipDevice.h>
Public Member Functions | |
MipDevice (MipBus *mipbus=0, int deviceid=0) | |
Constructor. | |
MipDevice (MipManager *mm, const std::string &device, int baudrate, int deviceid) | |
Constructor. | |
MipBus * | GetMipBus () const |
Returns the MipBus object. | |
int | GetDeviceID () const |
Returns the device id (slave). | |
bool | Open () |
Opens the MipDevice. The corresponding MipBus opens the serial interface automatically if necessary. | |
bool | Close () |
Closes the MipDevice. The corresponding MipBus closes the serial interface automatically if no other MipDevice is open on this MipBus. | |
bool | IsOpen () |
Returns whether the MipDevice is open. | |
void | OnAckReceived (MipCommand *cmd) |
Called when an ACK is received. The MIP sends an ACK after having received the message and checked its checksum. | |
void | OnPacketReceived (MipCommand *cmd) |
Called when the response packet has been received successfully. | |
void | OnErronousPacketReceived (MipCommand *cmd) |
Called when the response packet has been received erronously (wrong packet checksum, wrong length checksum). | |
bool | AddCommand (MipCommand *cmd) |
Adds a command to the queue. | |
bool | AddPriorityCommand (MipCommand *cmd) |
Adds a command to the beginning of the queue. It will be executed just after the current. | |
void | FlushCommandQueue () |
Deletes the command queue. This does not abort the current command. | |
MipCommand * | GetNextCommand () |
Switches to the next command. | |
int | GetMipCommandMax () |
Returns the maximum number of commands. | |
MipCommand * | GetMipCommand (int i) |
Returns a MipCommand. | |
void | SetMipBus (MipBus *MipBus) |
Sets the MipBus object. | |
void | SetDeviceID (int deviceid) |
Sets the device ID (slave). | |
void | SetDevice (MipManager *mm, const std::string &device, int baudrate, int deviceid) |
Sets the mip bus and the device id. The mip bus is determined using the MipManager object. | |
void | SetDevice (MipBus *mipbus, int deviceid) |
Sets the mip bus and the device id. | |
bool | SendCommand (int cmdid, MipMessage::eType type) |
bool | SendCommand_SignedInteger32 (int cmdid, MipMessage::eType type, int param1) |
bool | SendCommand_Float (int cmdid, MipMessage::eType type, float param1) |
bool | SendCommand_Byte (int cmdid, MipMessage::eType type, unsigned char param1) |
bool | SendCommand_ByteFloatFloat (int cmdid, MipMessage::eType type, unsigned char param1, float param2, float param3) |
bool | SendReadAxisStatus (int cmdid=0) |
bool | SendReadError (int cmdid=0) |
bool | SendClearError (int cmdid=0) |
bool | SendReadWarning (int cmdid=0) |
bool | SendClearWarning (int cmdid=0) |
bool | SendReadVersion (int cmdid=0) |
bool | SendSetRegMode (int cmdid, unsigned char mode) |
bool | SendSetPosVelocity (int cmdid, float velocity) |
bool | SendSetWaitMode (int cmdid, unsigned char mode) |
bool | SendMoveAbsolute (int cmdid, int position) |
bool | SendMoveRelative (int cmdid, int relposition) |
bool | SendStopMotion (int cmdid=0, unsigned char stopmode=0) |
bool | SendFindHomeSys (int cmdid=0, int timeoutms=0) |
bool | SendReadPosition (int cmdid=0) |
bool | SendReadVelocity (int cmdid=0) |
bool | SendReadVelocityMean (int cmdid=0) |
bool | SendReadCurrent (int cmdid=0) |
bool | SendCheckCRC (int cmdid, unsigned char selection) |
virtual void | OnReceivedReadAxisStatus (int cmdid, eAxisStatusFlags status)=0 |
virtual void | OnReceivedReadError (int cmdid, eError error)=0 |
virtual void | OnReceivedClearError (int cmdid)=0 |
virtual void | OnReceivedReadWarning (int cmdid, eWarning warning)=0 |
virtual void | OnReceivedClearWarning (int cmdid)=0 |
virtual void | OnReceivedReadVersion (int cmdid, int command_interpreter_version, int runtime_library_version, int hardware_revision, int bootrom_version, int application_number, int application_version)=0 |
virtual void | OnReceivedSetPosVelocity (int cmdid)=0 |
virtual void | OnReceivedSetWaitMode (int cmdid)=0 |
virtual void | OnReceivedMoveAbsolute (int cmdid)=0 |
virtual void | OnReceivedMoveRelative (int cmdid)=0 |
virtual void | OnReceivedStopMotion (int cmdid)=0 |
virtual void | OnReceivedFindHomeSys (int cmdid)=0 |
virtual void | OnReceivedReadPosition (int cmdid, int value)=0 |
virtual void | OnReceivedReadVelocity (int cmdid, int value)=0 |
virtual void | OnReceivedReadVelocityMean (int cmdid, int value)=0 |
virtual void | OnReceivedReadCurrent (int cmdid, int value)=0 |
virtual void | OnReceivedCheckCRC (int cmdid, bool ok, int crc)=0 |
void | Report (const std::string &name, std::ostream &out, int ccindent=0) const |
Writes a report of this object to the given stream. This is mainly useful for debugging. | |
Protected Types | |
enum | eError { sErrorNone = 0, sErrorCurofs0 = 1, sErrorCurofs1 = 2, sErrorHall = 3, sErrorGatedrv = 4, sErrorNobrake = 5, sErrorHwconfig = 7, sErrorEncoder = 6, sErrorEncodersw = 8, sErrorDigovld = 10, sErrorUplimit = 11, sErrorLolimit = 12, sErrorPosreg = 20, sErrorLeft = 21, sErrorRight = 22, sErrorHome = 23, sErrorIndex = 25, sErrorAmpdisab = 24, sErrorStop = 40, sErrorHalt = 42, sErrorBrake = 43, sErrorCurmax = 41, sErrorOvrcur = 44, sErrorOvrtemp = 45, sErrorComwatch = 46, sErrorWatchdog = 47, sErrorBatch = 48 } |
The MIP error codes. More... | |
enum | eWarning { sWarnNone = 0, sWarnUnknown = 100, sWarnSyntax = 110, sWarnLine = 120, sWarnRange = 130, sWarnDef = 140, sWarnError = 150, sWarnForbid = 160, sWarnNomove = 170, sWarnUplimit = 171, sWarnLolimit = 172, sWarnUnreachable = 173, sWarnTimeout = 174, sWarnPosregoff = 180, sWarnCurregoff = 181, sWarnAmpdisab = 182, sWarnStop = 183, sWarnLeft = 184, sWarnRight = 185, sWarnReset = 186, sWarnHardwareReset = 187, sWarnFlash = 200 } |
The MIP warning codes. More... | |
enum | eAxisStatusFlags { sAxisStatusMoving = 0x1, sAxisStatusCteVel = 0x2, sAxisStatusSinus = 0x4, sAxisStatusVelMode = 0x8, sAxisStatusCmdActive = 0x10, sAxisStatusWaitEnd = 0x20, sAxisStatusLoLimit = 0x40, sAxisStatusHiLimit = 0x80, sAxisStatusError = 0x100, sAxisStatusWarning = 0x200, sAxisStatusCurReg = 0x400, sAxisStatusPosReg = 0x800, sAxisStatusReferenced = 0x1000, sAxisStatusHome = 0x2000, sAxisStatusRight = 0x4000, sAxisStatusLeft = 0x8000 } |
The axis status flags as defined in the MIP documentation. These flags are returned by the ReadAxisStatus command. | |
enum | eTrajectoryFlags { sTrajectoryDone = 0x1, sTrajectoryOvershoot = 0x2, sTrajectoryTrapez = 0x4, sTrajectoryVmaxNeg = 0x8, sTrajectoryUpLimit = 0x10, sTrajectoryLoLimit = 0x20, sTrajectoryForbidden = 0x40 } |
The trajectory flags as defined in the MIP documentation. |
A MipDevice objects represents one physical MIP. A MIP is addressed with a device ID on a serial bus. The serial bus is modelled with a MipBus object and the MipManager handles a list of MipBus objects.
This class should not be used directly. It is intended to be inherited by a subclass implementing the desired functionality. MipDevice objects can then be created as follows:
|
|
The MIP warning codes.
|