Enter
the four commands below in the SmartMotor Terminal" window, following
each command with a return, and you will see motion:
|
Commands
|
Comments
|
|
A=100
|
‘Set Acceleration
|
|
V=1000000
|
‘Set
Velocity
|
|
P=1000000
|
‘Set Position
|
|
G
|
‘Start
move
|
On power-up
the motor defaults to position mode. Once Acceleration (A) and Velocity
(V) are set, you can simply issue new Position (P) commands, followed by
a Go (G) command to execute moves to new absolute locations. The motor
doesn't instantly go to the programmed position, but follows a trajectory
to get there. The trajectory is bound by the maximum Velocity and
Acceleration commands. This results in a trapezoidal velocity profile, or
a triangular profile if the maximum velocity is never met.
You can
change Position, Velocity and Acceleration at any time during or between
moves. The new parameters will only apply when a new G command is sent.
Command Set
Commands
are grouped by function - with the following notations:
|
#
|
Integer number
|
|
exp
|
Expression or signed integer
|
|
var
|
Variable
|
|
com
|
Communication channel
|
A=exp Set absolute acceleration
Acceleration
must be a positive integer within the range of 0 to 2,147,483,648. The
default is zero forcing you to enter something to get motion. A typical
value is 100. If left unchanged, while the motor is working, this value
will not only determine acceleration but also deceleration which will
form a triangular or trapezoidal velocity motion profile. This value can
be changed at any time. The value set doesn't get acted upon until the
next G command is sent.
If
your motor has a 2000 count encoder (sizes 17 & 23), multiply your
desired acceleration in rev/sec2 by 7.91 to arrive at the number to set A
to. With a 4000 count encoder (sizes 34, 42 & 56) you will need to
multiply by 15.82. These constants are a function of the motors PID rate.
If you lower the PID rate, you must raise these constants proportionally.
See The P.I.D. Filter" section of this manual for more information.
V=exp Set maximum permitted velocity
Use
the V command to set a limit to what velocity the motor can accelerate
to. That limit becomes the slew rate for all trajectory based motion
whether in position mode or velocity mode. The value defaults to zero so
it must be set before any motion can take place. The new value set does
not take effect until the next G command is executed. If your motor has a
2000 count encoder (sizes 17 & 23), multiply your desired velocity in
rev/sec by 32212 to arrive at the number to set V to. With a 4000 count
encoder (sizes 34, 42 & 56) you will need to multiply by 64424. These
constants are a function of the motors PID rate. If you lower the PID rate, you will
need to raise these constants..
P=exp Set absolute position for move
The
P= command allows the setting of an absolute end position. The number
following is encoder counts and can be positive or negative. The end
position can be set or changed at any time during or at the end of previous
motions.
The
following program illustrates how variables can be used to set motion
values to real-world units and have the working values scaled for motor
units.
|
a=100
|
‘Acceleration in rev/sec*sec
|
|
v=1
|
‘Velocity in rev/sec
|
|
p=100
|
‘Position in revs
|
|
GOSUB10
|
‘Initiate motion
|
|
END
|
‘End program
|
|
C10
|
‘Motion routine
|
|
A=a*8
|
‘Set Acceleration
|
|
V=v*32212
|
‘Set Velocity
|
|
P=p*2000
|
‘Set Position
|
|
G
|
‘Start move
|
|
RETURN
|
‘Return to call
|
D=exp Set relative distance for position move
The
D= command will allow you to specify a relative distance, instead of an
absolute position. The number following is encoder counts and can be
positive or negative.
The
relative distance will be added to the current position, either during or
after a move. It is added to the desired position rather than the actual
position so as to avoid the accumulation of small errors due to the fact
that any servo motor is seldom exactly where it should be
G Go, start motion
The
G command does more than just start motion. It can be used dynamically
during motion to create elaborate profiles. Since the SmartMotor allows
you to change Position, Velocity and Acceleration during motion,
on-the-fly", the G command can be used to trigger the next profile at
any time.
S Abruptly stop motion
in progress
If
the S command is issued while a move is in progress it will cause an
immediate and abrupt stop with all the force the motor has to offer.
After the stop, assuming there is no position error, the motor will still
be servoing.
X Decelerate to stop
If
the X command is issued while a move is in progress it will cause the
motor to decelerate to a stop at the last entered A= value. When the
motor comes to rest it will servo in place until commanded to move again.
O=exp Set/Reset origin to any position
The
O= command (using the letter O, not the number zero) allows the host or
program not just to declare the current position zero, but to declare it
to be any position, positive or negative. The exact position to be
re-declared is the ideal position, not the actual position which may be
changing slightly due to hunting or variable loading.
OFF Turn motor servo off
The
OFF command will stop the motor from servoing, much as a position error
or limit fault would.
MP Position Mode
Position
mode is the default mode of operation for the SmartMotor. If the mode
were to be changed, however, the MP command would put it back into
position mode. In position mode, the P# and D# commands will govern
motion.
Binary Data Transfer
The
ASCII based command string format, while convenient, is not the fastest
way to communicate data. It can be burdensome when performing multi-axis
contouring. For that reason a special binary format has been established
for the communication of trajectory critical data such as Position,
Velocity and Acceleration. These 32 bit parameters are sent as four bytes
following a code byte that flags the data for a particular purpose. The
code bytes are 252 for acceleration, 253 for velocity and 254 for
position. As an example, the following byte values communicate A=52, V=-1
& P=2137483648.
A=52 252 000 000 000 052 032
V=-1 253 255 255 255 254 032
P=2137483648 254 127 255 255 255 032
For
further expediency, the commands can be appended with the G command to
start motion immediately. Two examples are as follows (the ASCII value
for G is 71):
P=0 G 254 000 000 000 000 071 032
V=512 G 253 000 000 002 000 071 032
MV Velocity Mode
Velocity
mode will allow continuous rotation of the motor shaft. In Velocity mode
the programmed position using the P or the D commands is ignored.
acceleration and velocity need to be specified using the A= and the V=
commands. After a G command is issued, the motor will accelerate up to
the programmed velocity and continue at that velocity indefinitely. In
velocity mode as in Position mode, Velocity and Acceleration are
changeable on-the-fly, at any time. Simply specify new values and enter
another G command to trigger the change. In Velocity mode the velocity
can be entered as a negative number, unlike in Position mode where the
location of the target position determines velocity direction or sign. If
the 32 bit register that holds position rolls over in velocity mode it
will have no effect on the motion.
MT Torque Mode
In
torque mode the motor shaft will simply apply a torque independent of
position. The internal encoder tracking will still take place, and can be
read by a host or program, but the value will be ignored for motion
because the PID loop is inactive. To specify the amount of torque, use
the T= command, followed by a number between -1023 and 1023.
T=exp Set torque value, -1023 to 1023
In
torque mode, activated by the MT command, the actual torque value can be
set with the T= command. The following number or variable must fall in
the range between -1023 and 1023. The full scale value relates to full
scale or maximum torque.
Brake commands
(where optional brake exists)
BRKRLS Brake release
BRKENG Brake engage
BRKSRV Release brake when servo
active, engage break when inactive.
BRKTRJ Release brake when running a
trajectory.
Engage under all
other conditions.
Turns servo off
when the brake is engaged.
Many
SmartMotors are available with power safe brakes. These brakes will apply
a force to keep the shaft from rotating should the unit lose power.
Issuing the BRKRLS command will release the brake and BRKENG will engage
it. There are two other commands that initiate automated operating modes
for the brake. The command BRKSRV engages the brake automatically, should
the motor stop servoing and holding position for any reason. This might
be due to loss of power, a position error, limit fault, over-temperature
fault, etc..
Finally,
the BRKTRJ command will engage the brake in all of the previously
mentioned circumstances, plus any time the motor is not performing a
trajectory. In this mode the motor will be off, and the brake will be
holding it in position, perfectly still, rather than the motor servoing
when it is at rest,. As soon as another trajectory is started, the brake
will release. The time it takes for the brake to engage and release is on
the order of only a few milliseconds.
The
brakes used in SmartMotors are zero-backlash devices with extremely long
life spans. It is well within their capabilities to operate interactively
within an application. You need to be careful not to create a situation
where the brake will be set repeatedly during motion. That will reduce
the brake's life.