Main Page | Class Hierarchy | Class List | File List | Class Members

MipDevice Class Reference

Models a Mip device on a Mip bus. More...

#include <MipDevice.h>

List of all members.

Public Member Functions

 MipDevice (MipBus *mipbus=0, int deviceid=0)
 Constructor.
 MipDevice (MipManager *mm, const std::string &device, int baudrate, int deviceid)
 Constructor.
MipBusGetMipBus () 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.
MipCommandGetNextCommand ()
 Switches to the next command.
int GetMipCommandMax ()
 Returns the maximum number of commands.
MipCommandGetMipCommand (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.


Detailed Description

Models a Mip device on a Mip bus.

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:


Member Enumeration Documentation

enum MipDevice::eError [protected]
 

The MIP error codes.

Enumeration values:
sErrorNone  not in error state
sErrorCurofs0  Bad offset in current measurement MAX.
sErrorCurofs1  Bad offset in current measurement MAX.
sErrorHall  Bad hall signals combination MAX.
sErrorGatedrv  Gate driver : Undervoltage MAX.
sErrorNobrake  Braking failed (motor +/- reversal ?) MAX.
sErrorHwconfig  Hardware configuration error MAX.
sErrorEncoder  Bad encoder signal MID.
sErrorEncodersw  missing encoder signals (SW detection) MID
sErrorDigovld  Digital output overload STD.
sErrorUplimit  Target position out of upper bond STD.
sErrorLolimit  Target position out of lower bond STD.
sErrorPosreg  Position error too large STD.
sErrorLeft  Left switch encountered STD.
sErrorRight  Right switch encountered STD.
sErrorHome  Home switch not found STD.
sErrorIndex  Index not found STD.
sErrorAmpdisab  Amplifier has been disabled STD.
sErrorStop  Stop was activated MID.
sErrorHalt  Regulation stopped by 'Halt' command MID.
sErrorBrake  Motor braked by 'Brake' command STD.
sErrorCurmax  Motor current average to high STD.
sErrorOvrcur  Overcurrent on power stage STD.
sErrorOvrtemp  Overtemperature on power stage STD.
sErrorComwatch  Communication watchdog STD.
sErrorWatchdog  System watchdog (Firmware failure) MAX.
sErrorBatch  Batch execution aborted STD.

enum MipDevice::eWarning [protected]
 

The MIP warning codes.

Enumeration values:
sWarnNone  No warning.
sWarnUnknown  Unknown command.
sWarnSyntax  Syntax error.
sWarnLine  Command line too long.
sWarnRange  Value out of range.
sWarnDef  Parameters not fully defined.
sWarnError  Error not cleared.
sWarnForbid  Command not allowed at the moment.
sWarnNomove  Motion not started.
sWarnUplimit  Target position out of bonds.
sWarnLolimit  Target position out of bonds.
sWarnUnreachable  Position cannot be reached.
sWarnTimeout  Requested action took to much time.
sWarnPosregoff  Pos. Regulation is switched off.
sWarnCurregoff  Cur. Regulation is switched off.
sWarnAmpdisab  Power stage is disabled.
sWarnStop  STOP still activated.
sWarnLeft  LEFT still activated.
sWarnRight  RIGHT still activated.
sWarnReset  RESET is required.
sWarnHardwareReset  hardware RESET is required
sWarnFlash  Problem with flash.


The documentation for this class was generated from the following file:
Generated on Wed Jun 1 09:19:08 2005 for libmip by doxygen 1.3.8