6 #define GAR(type, name) \ 8 int ret = CPhidgetMotorControl_get##name(motor_handle_, &x); \ 9 assert(ret == EPHIDGET_OK); \ 11 #define GAR_I(type, name, i) \ 13 int ret = CPhidgetMotorControl_get##name(motor_handle_, i, &x); \ 14 assert(ret == EPHIDGET_OK); \ 18 #define SET(name, x) \ 19 int ret = CPhidgetMotorControl_set##name(motor_handle_, x); \ 20 assert(ret == EPHIDGET_OK); 21 #define SET_I(name, x, i) \ 22 int ret = CPhidgetMotorControl_set##name(motor_handle_, i, x); \ 23 assert(ret == EPHIDGET_OK); 39 CPhidgetMotorControl_set_OnVelocityChange_Handler(
41 CPhidgetMotorControl_set_OnCurrentChange_Handler(
43 CPhidgetMotorControl_set_OnInputChange_Handler(motor_handle_,
45 CPhidgetMotorControl_set_OnEncoderPositionChange_Handler(
47 CPhidgetMotorControl_set_OnEncoderPositionUpdate_Handler(
49 CPhidgetMotorControl_set_OnBackEMFUpdate_Handler(
51 CPhidgetMotorControl_set_OnSensorUpdate_Handler(motor_handle_,
53 CPhidgetMotorControl_set_OnCurrentUpdate_Handler(
68 GAR_I(
double, Velocity, index);
73 SET_I(Velocity, velocity, index);
78 GAR_I(
double, Acceleration, index);
83 SET_I(Acceleration, acceleration, index);
88 GAR_I(
double, AccelerationMax, index);
93 GAR_I(
double, AccelerationMin, index);
98 GAR_I(
double, Current, index);
103 GAR(
int, InputCount);
109 int ret = CPhidgetMotorControl_getInputState(
motor_handle_, index, &state);
111 assert(ret == EPHIDGET_OK);
113 return state == PTRUE;
118 GAR(
int, EncoderCount);
123 GAR_I(
int, EncoderPosition, index);
128 SET_I(EncoderPosition, position, index);
133 GAR_I(
int, BackEMFSensingState, index);
138 SET_I(BackEMFSensingState, bEMFState, index);
143 GAR_I(
double, BackEMF, index);
148 GAR(
double, SupplyVoltage);
153 GAR_I(
double, Braking, index);
158 SET_I(Braking, braking, index);
163 GAR(
int, SensorCount);
168 GAR_I(
int, SensorValue, index);
173 GAR_I(
int, SensorRawValue, index);
178 GAR(
int, Ratiometric);
183 SET(Ratiometric, ratiometric);
187 CPhidgetMotorControlHandle ,
void *userPtr,
int index,
195 void *userPtr,
int index,
203 void *userPtr,
int index,
211 CPhidgetMotorControlHandle ,
void *userPtr,
int index,
int time,
215 ->encoderPositionChangeHandler(index, time, positionChange);
220 CPhidgetMotorControlHandle ,
void *userPtr,
int index,
224 ->encoderPositionUpdateHandler(index, positionChange);
229 void *userPtr,
int index,
237 void *userPtr,
int index,
245 void *userPtr,
int index,
double getVelocity(int index)
void setRatiometric(int ratiometric)
static int InputChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int inputState)
double getCurrent(int index)
virtual void backEMFUpdateHandler(int index, double voltage)
virtual void encoderPositionUpdateHandler(int index, int positionChange)
void setEncoderPosition(int index, int position)
static int EncoderPositionChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int time, int positionChange)
static int SensorUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int sensorValue)
virtual void currentUpdateHandler(int index, double current)
static int EncoderPositionUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, int positionChange)
virtual ~MotorController()
static int BackEMFUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double voltage)
bool getInputState(int index)
double getAcceleration(int index)
int getEncoderPosition(int index)
int getBackEMFSensingState(int index)
static int CurrentChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current)
int getSensorRawValue(int index)
#define SET_I(name, x, i)
CPhidgetMotorControlHandle motor_handle_
virtual void encoderPositionChangeHandler(int index, int time, int positionChange)
virtual void sensorUpdateHandler(int index, int sensorValue)
static int VelocityChangeHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double velocity)
void setVelocity(int index, double velocity)
virtual void inputChangeHandler(int index, int inputState)
double getBackEMF(int index)
int getSensorValue(int index)
void setAcceleration(int index, double acceleration)
#define GAR_I(type, name, i)
double getBraking(int index)
void setBraking(int index, double braking)
double getSupplyVoltage()
void setBackEMFSensingState(int index, int bEMFState)
double getAccelerationMax(int index)
void init(CPhidgetHandle handle)
virtual void velocityChangeHandler(int index, double velocity)
virtual void currentChangeHandler(int index, double current)
double getAccelerationMin(int index)
static int CurrentUpdateHandler(CPhidgetMotorControlHandle phid, void *userPtr, int index, double current)