Description Function Coding Example
Set Motor Degrees
Implements velocity and positional PID
control to set the constant speeds and
the degree target holding positions
of both TETRIX DC Motor channels
with TETRIX encoders installed. Both
PULSE 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 degree target position is a
signed long integer from -536,870,912
to 536,870,911 with a 1-degree
resolution.
setMotorDegrees(speed1, degrees1,
speed2, degrees2);
Data Type:
speed1 = integer
degrees1 = long
speed2 = integer
degrees2 = long
Data Range:
speed1 = 0 to 720
degrees1 = -536870912 to 536870911
speed2 = 0 to 720
degrees2 = -536870912 to 536870911
setMotorDegrees(180, 360, 180, 360);
Spin Motor 1 and Motor 2 at a constant
speed of 180 DPS until each motor
encoder degree count equals 360. When
a motor reaches its degree target count,
hold position in a servo-like mode.
setMotorDegrees(360, 720, 90, 360);
Spin Motor 1 at a constant speed of
360 DPS until encoder 1 degree count
equals 720. Spin Motor 2 at a constant
speed of 90 DPS until encoder 2 degree
count equals 360. Each motor will hold
its position in a servo-like mode when it
reaches the encoder target.
Set Motor Direction Invert
Inverts the forward/reverse direction
mapping of a DC motor channel. This
function is intended to harmonize
the forward and reverse directions
for motors on opposite sides of a
skid-steer robot chassis. Inverting
one motor channel can make coding
opposite-facing DC motors working
in tandem more intuitive. An invert
parameter of 1 = invert. An invert
parameter of 0 = no invert. The default
is no invert.
setMotorInvert(motor#, invert);
Data Type:
motor# = integer
invert = integer
Data Range:
motor# = 1 or 2
invert = 0 or 1
setMotorInvert(1, 1);
Invert the spin direction mapping of
Motor 1.
setMotorInvert(2, 1);
Invert the spin direction mapping of
Motor 2.
setMotorInvert(1, 0);
Do not invert the spin direction mapping
of Motor 1.
setMotorInvert(2, 0);
Do not invert the spin direction mapping
of Motor 2.
Note: Non-inverting is the default on
PULSE power-up or reset.
Read Motor Busy Status
Reads the busy flag to check on the
status of a DC motor that is operating
in positional PID mode. The motor
busy status will return “1” if it is moving
toward a positional target (degrees or
encoder count). When it has reached
its target and is in hold mode, the busy
status will return “0.”
readMotorBusy(motor#);
Data Type:
motor# = integer
Data Range:
motor# = 1 or 2
Data Type Returned:
value = integer (0 or 1)
readMotorBusy(1);
Return the busy status of Motor 1.
readMotorBusy(2);
Return the busy status of Motor 2.
136 Appendix