© 2013 spiiplus training class motion profile generation 1
TRANSCRIPT
© 2013
SPiiPlus Training Class
Motion Profile Generation
1
© 2013
What is Motion Profile Generation?
Motion profile generation is the process by which the controller takes a high level command and creates a finely sampled motion profile
o At a minimum the controller will calculate a new position every update cycle
Advanced controllers will also calculate velocity, acceleration, and jerk (acceleration/sec)
o High level command can be streamed by a host or executed directly by the motion controller
o Many different algorithms can be used to generate the motion profile / trajectory
o Motion profile / trajectory can be for a single or multi-axis move
2
© 20133
Position
Time
Sampled Motion Trajectory
© 20134
Motion Generation: SPiiPlus
SP0SP1
MasterFormula
ECATECATECAT
MasterPosition(MPOS)
Motion Generator
Axis Position (APOS)
CONNECT formula
Reference Position (RPOS)
Convert units to counts (EFAC)
Convert counts to
units (EFAC)
Feedback Position (FPOS)
User Commands / External
Signals
Feedback FeedbackDrive
CommandDrive
Command
MPU
© 2013
Important ACSPL+ Motion VariablesVEL: Commanded Velocity
o Motor commanded velocity in user units / secondo This is the maximum velocity of the motion profile
ACC: Commanded Accelerationo Motor commanded acceleration in user units / second2
o This is the maximum acceleration of the motion profile
DEC: Commanded Decelerationo Motor commanded deceleration in user units / second2
o This is the maximum deceleration of the motion profile
JERK: Commanded Jerko Motor commanded jerk in user units / second3
o This is the maximum jerk of the motion profile
KDEC: Kill Decelerationo Used for the KILL command only
5
© 2013
Important ACSPL+ Motion VariablesAPOS: Axis Position
o Logical axis position in user-defined unitso Calculated directly from motion generator every MPU cycleo Comes before the CONNECT function
RPOS: Reference Positiono Motor commanded position in user-defined unitso Calculated via the CONNECT function every MPU cycleo Sent to servo processor servo loop every MPU cycleo Typically RPOS = APOS
FPOS: Feedback Positiono Sensor feedback position in user-defined unitso Read from servo processor every MPU cycle
PE: Position Erroro Difference between RPOS and FPOSo Updated every MPU cycle
6
© 2013
Important ACSPL+ Motion Variables
EFAC: Encoder Factoro Used to translate between encoder counts on the servo processor and user-
defined units on the MPU
EOFFS: Encoder Offseto Offset between zero position on the servo processor and zero position on the
MPUo Updated whenever RPOS or FPOS is SET (homed).
7
Note: FP is feedback position stored in the Servo Processor
RP is the reference position stored in the Servo Processor
© 2013
Important ACSPL+ Motion VariablesRVEL: Reference Velocity
o Motor commanded velocity in user units / secondo Calculated as the first difference of RPOS, with optional smoothing, every
MPU cycle
FVEL: Feedback Velocityo Sensor feedback velocity in user units / secondo Calculated as first difference of FPOS, with optional smoothing, every MPU
cycle
8
© 2013
Important ACSPL+ Motion Variables
RACC: Reference Accelerationo Motor commanded acceleration in user units / second2
o Calculated as the first difference of RVEL every MPU cycle
FACC: Feedback Accelerationo Sensor feedback acceleration in user units / second2
o Calculated as the first difference of FVEL every MPU cycle
9
RACC𝑛=(RVEL𝑛−RVEL𝑛− 1 )
𝑇
FACC𝑛=(FVEL𝑛−FVEL𝑛− 1)
𝑇
© 2013
Important ACSPL+ Motion Variables
GPHASE: Group Motion Phaseo Integer value for current motion phase
0: no motion 1: acceleration buildup 2: constant acceleration 3: acceleration finishing 4: constant velocity 5: deceleration buildup 6: constant deceleration 7: deceleration finishing
GRTIME: Group Remaining Motion Timeo Estimated value of time (in milliseconds) until end of current motion
10
© 2013
Important ACSPL+ Motion Variables
MST: Motor Stateo Bitwise encoded physical motor state information
Bit 0: Enabled Bit 1: Open Loop Bit 5: In motion Bit 6: Accelerating
AST: Axis Stateo Bitwise encoded logical axis state information
Bit 2: PEG is in progress Bit 3: Data collection is in progress Bit 5: In motion Bit 6: Accelerating
11
© 2013
Move vs. Move and Settle
Move time: time it takes for commanded motion to finishMove and settle time: time it takes for commanded motion to finish AND physical axis to settle within a specified window
12
TimeMotion Start
Event
Motion Time
Po
sit
ion
Motion Complete
Event
Feedback Position
SETTLE var. (msec) TARGRAD variable (user
units)
Target position MST.#MOVE=0
AST.#MOVE=0
© 2013
Trajectory Algorithms
13
© 2013
Step Profile: BasicsStep Profile:
o Instantaneous change in position
o Infinite velocityo Infinite accelerationo Infinite jerk
Comments:o Not realistico Should never be used in
real motion systems
14
© 2013
Step Profile: Equations
15
© 2013
Step Profile: ACSPL+ ExampleShould not be run on real systems!
16
© 2013
1st Order Profile: Basics1st Order Profile:
o Linear position profileo Instantaneous change in
velocityo Infinite accelerationo Infinite jerk
Comments:o Not realistico Should never be used in
real motion systems
17
© 2013
1st Order Profile: Equations
18
© 2013
1st Order Profile: ACSPL+ ExampleShould not be run on real systems!
19
© 2013
2nd Order Profile: Basics2nd Order Profile:
o Quadratic position profileo Linear velocity profileo Instantaneous change in
accelerationo Infinite jerk
Comments:o Not realistico Simple controllers use this
type of interpolationo Results in ‘jerky’ behavior
of motion systems
20
© 2013
2nd Order Profile: Equations
21
© 2013
2nd Order Profile: ACSPL+ ExampleNot ideal for real systems
22
© 2013
3rd Order Profile: Basics3rd Order Profile:
o Cubic position profileo Quadratic velocity profileo Linear acceleration profileo Instantaneous change in
jerk
Comments:o Realistico Results in smooth motiono Complex profileo Requires appropriate jerk
setting
23
© 2013
3rd Order Profile: Equations
24
© 2013
3rd Order Profile: Equations
25
© 2013
3rd Order Profile: ACSPL+ Example
26
© 2013
Jogging: BasicsJogging:
o Accelerating to constant velocityo No defined end-pointo Can be done with 1st order, 2nd order or 3rd order profiles
27
© 2013
Jogging: ACSPL+ Example
28
© 2013
CAM Motion: Basics
CAM Motion:o Multi-axis motion along a continuous path 2 or 3 dimensional spaceo Can involved more than 3 axeso Common in CAD/CAM applications where motion profile is a tool path
created from a CAD fileo Typically composed of arc and line segments
29
© 2013
CAM Motion: Equations
Line Segment:o Constant linear velocity along an n-dimensional patho Requires knowledge of start point, end point, and velocity
Arc Segment:o Constant angular velocity along circumference of a circleo Confined to 2D planeo Requires knowledge of start point, center point or end point (or
equivalent)
30
© 2013
CAM Motion: ACSPL+ Example
31
© 2013
Master / Slave: Basics
Master / Slave Motion:o Axis is slaved to a master signalo Master signal could be an encoder, virtual axis, analog input, etco Slave is moved to track the masters position (position lock) or velocity
(velocity lock) as best as possible without exceeding its maximum velocity or acceleration
o There will always be a delay between the master and slaveo Common in applications where the master signal has unknown
dynamics or controlled externally
32
© 2013
Master / Slave: ACSPL+ Example
33
© 2013
Spline: BasicsSpline:
o Smooth piece-wise polynomial functiono Used for interpolating in between data points to any degree of
interpolationo Different types of splines have different properties
Catmull-Rom:o Guarantees motion through control pointso Guarantees continuous position and velocity profiles (does not
guarantee continuous acceleration profile)
B-Spline:o Does not guarantee motion through control pointso Guarantees continuous position, velocity and acceleration profiles
34
© 2013
Spline: PVT Motion
PVT Motion:o User provides position, velocity, and time pointso Motion generator interpolates between time points to determine
position at each controller cycleo Acceleration is implicitly defined by the PVT points
35
© 2013
Spline: ACSPL+ Example
36
© 2013
Kinematics: Basics
Kinematics:o Relationship between actuators positions and end-effector positionso Common with multi-axis applications where end-effector motion is
dependent on multiple actuators
Forward Kinematics:o Determining end-effector position as a function of actuator positions
Inverse Kinematics:o Determining actuator positions as a function of end-effector position
37
© 2013
Kinematics: Inverse Kinematics Example
For the flexible gantry table below, determine the actuator positions as a function of the end-effector X-q position.
38
© 2013
Kinematics: ACSPL+ Example
39
© 2013
ACSPL+ Programming Example: 1
1. Load program “Programming 06 – SetMotionParams.prg” to the controllero Should populate buffer 19
2. Open communication terminal and set it up to show DISP messages3. From the communication terminal start buffer 19 at label ‘Begin’
(“START 19, BEGIN”). Follow the instructions on the screen
What happens?
40
© 2013
ACSPL+ Programming Example: 2
An application requires an axis to have two modes: slow and fast. The customer wants to use a digital input (IN(0).0) to toggle between the two modes (if ‘0’, set for slow mode, if ‘1’, set for fast mode). They will use a second digital input (IN(0).1) to toggle motion.
1. Use buffer 20 to write the program. Once running program should not stop (hint: WHILE 1 loop).
2. Anytime IN(0).0 is toggled the motion parameters should switch between a slow and fast mode (determine your own slow and fast parameters)
3. Anytime IN(0).1 goes from low to high a new motion should be started. Use the motion command “PTP/r (axis), distance” for the motion.
4. Run the program and test.
41