Go to the documentation of this file.00001 #ifndef PHIDGETS_API_MOTOR_H
00002 #define PHIDGETS_API_MOTOR_H
00003
00004 #include "phidgets_api/phidget.h"
00005
00006 namespace phidgets
00007 {
00008
00009 class MotorController: public Phidget
00010 {
00011 public:
00012 MotorController();
00013
00014
00015 int getMotorCount();
00016 double getVelocity(int index);
00017 void setVelocity(int index, double velocity);
00018 double getAcceleration(int index);
00019 void setAcceleration(int index, double acceleration);
00020 double getAccelerationMax(int index);
00021 double getAccelerationMin(int index);
00022 double getCurrent(int index);
00023
00024
00025 int getInputCount();
00026 bool getInputState(int index);
00027
00028
00029 int getEncoderCount();
00030 int getEncoderPosition(int index);
00031 void setEncoderPosition(int index, int position);
00032
00033
00034 int getBackEMFSensingState(int index);
00035 void setBackEMFSensingState(int index, int bEMFState);
00036 double getBackEMF(int index);
00037
00038 double getSupplyVoltage();
00039
00040 double getBraking(int index);
00041 void setBraking(int index, double braking);
00042
00043
00044 int getSensorCount();
00045 int getSensorValue(int index);
00046 int getSensorRawValue(int index);
00047
00048 int getRatiometric();
00049 void setRatiometric(int ratiometric);
00050
00051 protected:
00052 CPhidgetMotorControlHandle motor_handle_;
00053
00054 virtual void velocityChangeHandler(int index, double velocity);
00055 virtual void currentChangeHandler(int index, double current);
00056 virtual void inputChangeHandler(int index, int inputState);
00057 virtual void encoderPositionChangeHandler(int index, int time, int positionChange);
00058 virtual void encoderPositionUpdateHandler(int index, int positionChange);
00059 virtual void backEMFUpdateHandler(int index, double voltage);
00060 virtual void sensorUpdateHandler(int index, int sensorValue);
00061 virtual void currentUpdateHandler(int index, double current);
00062
00063 private:
00064 static int VelocityChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double velocity);
00065 static int CurrentChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current);
00066 static int InputChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int inputState);
00067 static int EncoderPositionChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int time, int positionChange);
00068 static int EncoderPositionUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int positionChange);
00069 static int BackEMFUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double voltage);
00070 static int SensorUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int sensorValue);
00071 static int CurrentUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current);
00072 };
00073
00074 }
00075
00076 #endif // PHIDGETS_API_MOTOR_H