Description Function Coding Example (for controller ID = 1)
Set DC Motor Targets
Implements velocity and positional
PID control to simultaneously set the
constant speeds and the encoder
count target holding positions of both
TETRIX DC Motor channels each with
TETRIX encoders installed. Both Motor
1 and Motor 2 channel parameters are
set with a single statement. The speed
parameter range is 0 to 720 degrees
per second (DPS). The encoder count
target position is a signed long integer
from -2,147,483,648 to 2,147,483,647.
Each encoder count = 1/4-degree
resolution.
setMotorTargets(ID#, speed1,
target1, speed2, target2);
Data Type:
ID# = integer
speed1 = integer
target1 = long
speed2 = integer
target2 = long
Data Range:
speed1 = 0 to 720
target1 = -2147483648 to
2147483647
speed2 = 0 to 720
target2 = -2147483648 to
2147483647
setMotorTargets(1, 360, 1440, 360,
1440);
Spin Motor 1 and Motor 2 at a constant
speed of 360 DPS until each motor
encoder count equals 1,440. When a
motor reaches its encoder target count,
hold position in a servo-like mode.
setMotorTargets(1, 360, 1440, 180,
2880);
Spin Motor 1 at a constant speed of 360
DPS until encoder 1 count equals 1,440.
Spin Motor 2 at a constant speed of 180
DPS until encoder 2 equals 2,880. Each
motor will hold its position in a servo-like
mode when it reaches the encoder target.
Note: One encoder count equals
1/4-degree resolution. For example, 1
motor revolution equals 1,440 encoder
counts (1,440 / 4 = 360).
Set Motor Degree
Implements velocity and positional
PID control to set the constant speed
and the degree target holding position
of a TETRIX DC Motor with a TETRIX
encoder installed. The speed parameter
range is 0 to 720 degrees per second
(DPS). The encoder degrees target
position is a signed long integer from
-536,870,912 to 536,870,911 with a
1-degree resolution.
setMotorDegree(ID#, motor#, speed,
degrees);
Data Type:
ID# = integer
motor# = integer
speed = integer
degrees = long
Data Range:
motor# = 1 or 2
speed = 0 to 720
degrees = -536870912 to 536870911
setMotorDegree(1, 1, 180, 360);
Spin Motor 1 at a constant speed of 180
DPS until encoder 1 degree count equals
360. When at encoder target degree
count, hold position in a servo-like mode.
setMotorDegree(1, 2, 90, 180);
Spin Motor 2 at a constant speed of 90
DPS until encoder 2 degree count equals
180. When at encoder target degree
count, hold position in a servo-like mode.