User manual

Copyright © Dr Robot Inc. 2005
44
Figure III.1 Digital Controlled DC Motor System
In the case of PID control, the transfer function of the PID controller looks like as:
SKSKKsEsU
IDP
/)(/)(
+
+
=
When using potentiometers (optical encoder and etc.) as the rotational position feedback, you have to
set the motor polarity properly using “WiRobotSDK” ActiveX control API “SetMotorPolarityX“ so
that the negative feedback is achieved. See “SetMotorPolarityX“ for detail.
The control of the standard RC servo motors is carried out by the built-in analog PID controller.
III.2.1 DC Motor Control
75 void SetMotorPolarity1 (short polarity);
76 void SetMotorPolarity2 (short polarity);
77 void SetMotorPolarity3 (short polarity);
78 void SetMotorPolarity4 (short polarity);
79 void SetMotorPolarity5 (short polarity);
80 void SetMotorPolarity6 (short polarity);
81 void SetMotorPolarity (short channel, short polarity);
Description:
SetMotorPolarityX set the motor polarity to 1 or -1 for each motor channel.
1. When the motor is running in positive direction, the potentiometer value is also
increasing; motor polarity should be set to 1 which is default.
2. When the motor is running in positive direction, the potentiometer value is decreasing,
motor polarity should be set to -1 or change the sensor mounting so that the
potentiometer value increases.
Syntax: ival = SetMotorPolarity1 (short polarity); // Motor #1
ival = SetMotorPolarity2 (short polarity); // Motor #2
ival = SetMotorPolarity3 (short polarity); // Motor #3
ival = SetMotorPolarity4 (short polarity); // Motor #4
-
+
Y
F
G
U
E
Controller
DC Motor
Potentiometer