Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 789 of 909
Equations for Real-World Units:
Encoder resolution and sample rate can vary. Therefore, the following general equations can
be used to convert the real-world units of velocity to a value for VT, where af[0] is already set
with the real-world unit value. These equations force floating-point calculations to avoid
overflow and maintain resolution. They can be placed in a user program, or they can be
precalculated if the values of SAMP and RES are known (SAMP and RES can be reported from
the terminal using the RSAMP and RRES commands, respectively). SAMP can change if the PID
command is used. The value of REScan differ between motor models.
Input as Value
in af[0]
Equation
Radians/Sec VT=((af[0]*RES)/(PI*2.0*SAMP))*65536
Encoder Counts/Sec VT=(af[0]/(SAMP*1.0))*65536
Rev/Sec VT=((af[0]*RES)/(SAMP*1.0))*65536
RPM VT=((af[0]*RES)/(60.0*SAMP))*65536
A useful Scale Factor Multiplier code example, which also illustrates the use of af[], SAMP and
RES, is shown in RES on page 670 and SAMP on page 690.
EXAMPLE: (Shows use of ADT, PT and VT)
MP 'Set mode position
ADT=5000 'Set target accel/decel
PT=20000 'Set absolute position
VT=10000 'Set velocity
G 'Start motion
END 'End program
EXAMPLE: (Routine homes motor against a hard stop)
MDS 'Using Sine mode commutation
KP=3200 'Increase stiffness from default
KD=10200 'Increase damping from default
F 'Activate new tuning parameters
AMPS=100 'Lower current limit to 10%
VT=-10000 'Set maximum velocity
ADT=100 'Set maximum accel/decel
MV 'Set Velocity mode
G 'Start motion
WHILE EA>-100 'Loop while position error is small
LOOP 'Loop back to WHILE
O=-100 'While pressed, declare home offset
S 'Abruptly stop trajectory
MP 'Switch to Position mode
VT=20000 'Set higher maximum velocity
PT=0 'Set target position to be home
G 'Start motion
TWAIT 'Wait for motion to complete
AMPS=1023 'Restore current limit to maximum
END 'End program
Part 2: Commands: VT=formula